A simple key value store that I personally use for learning rust and getting comfortable with its learning curve, including concurrency support, borrowing and whatnot. Part of The Sprawl Project.
- Clone using SSH
$ git clone [email protected]:the-sprawl-project/construct-cache.gitThe system now supports synchronous multi-node replication via a central controlplane.
-
Start the Controlplane: This launches the orchestrator and 3 cache instances (ports 9001-9003).
cargo run --bin controlplane
-
Launch Clients: Open new terminal windows and connect to different nodes to see replication in action:
# Terminal A cargo run --bin construct_cache_client 9001 # Terminal B cargo run --bin construct_cache_client 9002
-
Verify Sync: Create a key on port 9001 (
c key val) and then read it from port 9002 (g key).
If you prefer running a single isolated instance:
-
Run the server:
cargo run --bin construct_cache_server
-
Run the client:
cargo run --bin construct_cache_client
(Note: Use
hfor help within the client.)
When developing features, you might want to sync your protobufs to the main
spawl-protocol repository as well. This will allow other repositories to use
the same protobuf structures when accessing the Construct Cache.
To sync protobufs, do the following:
- Setup the
sprawl-protocolrepository through agit clone. - Set the
SPRAWL_PROTOCOLS_LOCAL_PATHvariable in your.rcfile (.zshrcfor example) to point to the root of the repository - Run
make sync-protos-localto sync the protobufs from thesprawl-protocolrepo to this project. - If any changes are made in this repo to the protobuf structures and should be
committed to the
sprawl-protocolrepository, runmake push-protosand commit the changes in that repository.
New features coming soon! Check out the issues tab.