Crates.io | bicycle |
lib.rs | bicycle |
version | 0.2.2 |
source | src |
created_at | 2023-08-31 07:52:13.135891 |
updated_at | 2024-03-13 20:59:06.945475 |
description | The CLI and build functions for BicycleDB. |
homepage | https://ordinarylabs.io |
repository | https://github.com/ordinarylabs/bicycle |
max_upload_size | |
id | 959656 |
size | 134,902 |
The CLI and build functions for BicycleDB.
Before installing bicycle
you'll need to have Rust and protoc installed.
cargo install bicycle
With your schema, you can use the build
command to generate your Bicycle components.
bicycle build schema.proto
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
You can now start the server with the following command.
bicycle start
bicycle fn
commands depend on cargo-wasi
when compiling for --lang rust
; the binary can be installed using cargo install cargo-wasi
(details here).
bicycle fn deploy \
--addr http://0.0.0.0:50051 \
--lang rust \
--path ./path/to/fn \
--name some-fn-name
bicycle fn invoke \
--addr http://0.0.0.0:50051 \
--name some-fn-name \
--args '{"some_key": "some_value"}'
bicycle fn invoke \
--addr http://0.0.0.0:50051 \
--lang rust \
--path ./path/to/fn \
--args '{"some_key": "some_value"}'
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.