Crate bicycle

source ·
Expand description

§BicycleDB Manager

ci crates.io docs.rs license dependency status

The CLI and build functions for BicycleDB.

§CLI

Before installing bicycle you’ll need to have Rust and protoc installed.

§Install

cargo install bicycle

§Building

With your schema, you can use the build command to generate your Bicycle components.

bicycle build schema.proto

§Engines

Bicycle’s default storage engine is RocksDB but librocksdb-sys takes quite awhile for the initial build (subsequent builds should be quicker as you iterate on your schema). If you’d like a faster initial build or would prefer SQLite for other reasons you can also use the SQLite engine by supplying the --engine flag.

bicycle build schema.proto --engine sqlite

§Running the server

You can now start the server with the following command.

bicycle start

§Invoke and Deploy Biplane Functions (a.k.a SPROCs)

bicycle fn commands depend on cargo-wasi when compiling for --lang rust; the binary can be installed using cargo install cargo-wasi (details here).

§Deploy
bicycle fn deploy \
  --addr http://0.0.0.0:50051 \
  --lang rust \
  --path ./path/to/fn \
  --name some-fn-name
§Invoke Deployed
bicycle fn invoke \
  --addr http://0.0.0.0:50051 \
  --name some-fn-name \
  --args '{"some_key": "some_value"}'
§One-off
bicycle fn invoke \
  --addr http://0.0.0.0:50051 \
  --lang rust \
  --path ./path/to/fn \
  --args '{"some_key": "some_value"}'

§Automated builds

The components used in the CLI executable are also exposed for usage in build.rs files.

# Cargo.toml
[build-dependencies]
bicycle = "x.x.x"

NOTE: if using path imports for bicycle_shims or bicycle_core will need to run bicycle build schema.proto prior to the initial build so that cargo has a __bicycle__/core|shims/Cargo.toml to reference. Subsequent changes to schema.proto should not require a re-run of the bicycle build command with the CLI.

// build.rs
use std::env;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let schema_path = concat!(env!("CARGO_MANIFEST_DIR"), "/schema.proto");
    bicycle::build(schema_path, "rocksdb")
}

See examples for more detailed usage.

§License

AGPL-v3

Functions§

  • builds BicycleDB components.