Skip to content

Latest commit

 

History

History
140 lines (88 loc) · 3.37 KB

README.md

File metadata and controls

140 lines (88 loc) · 3.37 KB

BonsaiDb Examples

This folder contains crates that are full of examples that demonstrate various usages of BonsaiDb. The examples are grouped into crates by two things:

  • The feature flags they enable in the bonsaidb crate
  • Shared list of dependencies

This approach to organizing examples will keep individual example build times as low as possible, as only the dependencies and features needed for each example will be built.

Single offline database

Source code: basic-local/examples/basic-local.rs

cargo run --example basic-local

Offline storage with multiple databases

Source code: basic-local/examples/basic-local-multidb.rs

cargo run --example basic-local-multidb

Introduction to Views

Source code: basic-local/examples/view-examples.rs

cargo run --example view-examples

Async version: basic-local/examples/view-examples-async.rs

cargo run --example view-examples-async --features async

Using a View for Keyword Search

Source code: basic-local/examples/keyword-search.rs

cargo run --example keyword-search

Using Views with hdrhistogram

Source code: view-histogram/examples/view-histogram.rs

cargo run --example view-histogram

PubSub: Publish messages to subscribable topics

Source code: basic-local/examples/pubsub.rs

cargo run --example pubsub

Key-Value Storage

Source code: basic-local/examples/key-value-store.rs

cargo run --example key-value-store

Async version: basic-local/examples/key-value-store-async.rs

cargo run --example key-value-store-async --features async

Storing Large Files

Basic file storage

Source code: ../crates/bonsaidb-files/examples/basic-files.rs

cargo run --example basic-files

Async version: ../crates/bonsaidb-files/examples/basic-files-async.rs

cargo run --example basic-files-async --features async

Storing multiple sets of files in one schema

Source code: ../crates/bonsaidb-files/examples/file-configs.rs

cargo run --example file-configs

Basic BonsaiDb Server + Network Access

Source code: basic-server/examples/basic-server.rs

cargo run --example basic-server

Users and Permissions

Source code: basic-server/examples/users.rs

cargo run --example users

Building a command-line interface

Source code: basic-server/examples/cli.rs

cargo run --example cli

Automatically requesting an ACME certificate

Source code: acme/examples/acme.rs

cargo run --example acme

Running a webserver with BonsaiDb websockets

Source code: axum/examples/axum.rs

cargo run --example axum