I open sourced Octopii, a batteries included framework for building distributed systems

54 points Ok_Marionberry8922 13 comments

Hi r/rust , I recently open sourced Octopii, A batteries-included framework for building distributed systems which I have been building for the better part of an year now.

it bundles everything you need to build distributed systems without hunting for individual components.

What's included:
- Raft consensus for leader election and replication
- QUIC transport for networking
- Write Ahead Log (Walrus) for durability
- P2P file transfers with checksum verifications (Shipping Lane)
- RPC framework with timeouts and correlation
- Pluggable state machines for custom logic

high level architecture

Quick example, replicated KV store in ~20 lines:

  use octopii::{Config, OctopiiNode, OctopiiRuntime};

  #[tokio::main]
  async fn main() -> Result<(), Box<dyn std::error::Error>> {
      let runtime = OctopiiRuntime::new(4);
      let config = Config {
          node_id: 1,
          bind_addr: "127.0.0.1:5001".parse()?,
          peers: vec!["127.0.0.1:5002".parse()?],
          wal_dir: "./data/node1".into(),
          is_initial_leader: true,
          ..Default::default()
      };

      let node = OctopiiNode::new(config, runtime).await?;
      node.start().await?;

      // Replicated write
      node.propose(b"SET key value".to_vec()).await?;

      // Local read
      let value = node.query(b"GET key").await?;

      Ok(())
  }

I built this because while Rust's distributed systems ecosystem is growing with amazing crates, I found myself wanting something like go's ready to use frameworks (like https://github.com/hashicorp/raft ) but just for Rust. Rather than keep rebuilding the same stack, I wanted to contribute something that lets people focus on their application logic instead of infrastructure plumbing.

Links:

- GitHub: https://github.com/octopii-rs/octopii

- Docs: https://github.com/octopii-rs/octopii/tree/master/docs

- It is powered by walrus (another project of mine), a purpose built log storage engine with io_uring support on Linux for extreme I/O throughput.

This is an early-stage project (v0.1.0). The API is still evolving, and critical features like authentication are not yet implemented (so please do not use this on public networks). I'm primarily looking to hear your thoughts on it and and potential contributors!