12 releases
0.2.2 | Mar 13, 2024 |
---|---|
0.2.1 | Mar 13, 2024 |
0.1.8 | Mar 5, 2024 |
0.1.5 | Feb 28, 2024 |
0.1.3 |
|
#631 in Command line utilities
91KB
2K
SLoC
BicycleDB Manager
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
Dependencies
~6–13MB
~156K SLoC