lnx Datacake

Easy to use tooling for building eventually consistent distributed data systems in Rust.

"Oh consistency where art thou?" - CF.

Features ✨

The packages

Datacake provides several utility libraries as well as some pre-made data store handlers:

Examples

Check out some pre-built apps we have in the example folder

You can also look at some heavier integration tests here

Single Node Cluster

Here's an example of a basic cluster with one node that runs on your local network, it uses almost all of the packages including:

```rust use std::net::SocketAddr; use datacake::node::{Consistency, ConnectionConfig, DCAwareSelector, DatacakeNodeBuilder}; use datacake::eventualconsistency::testutils::MemStore; use datacake::eventual_consistency::EventuallyConsistentStoreExtension;

[tokio::main]

async fn main() -> anyhow::Result<()> { let addr = "127.0.0.1:8080".parse::().unwrap(); let connectioncfg = ConnectionConfig::new(addr, addr, Vec::::new()); let node = DatacakeNodeBuilder::::new(1, connectioncfg) .connect() .await .expect("Connect node.");

let store = node
    .add_extension(EventuallyConsistentStoreExtension::new(MemStore::default()))
    .await
    .expect("Create store.");

let handle = store.handle();

handle
    .put(
        "my-keyspace",
        1,
        b"Hello, world! From keyspace 1.".to_vec(),
        Consistency::All,
    )
    .await
    .expect("Put doc.");

Ok(())

} ```

Why does Datacake exist?

Datacake is the result of my attempts at bringing high-availability to lnx unlike languages like Erlang or Go, Rust currently has a fairly young ecosystem around distributed systems. This makes it very hard to build a replicated system in Rust without implementing a lot of things from scratch and without a lot of research into the area to begin with.

Currently, the main algorithms available in Rust is Raft which is replication via consensus, overall it is a very good algorithm, and it's a very simple to understand algorithm however, I'm not currently satisfied that the current implementations are stable enough or are maintained in order to choose it. (Also for lnx's particular use case leader-less eventual consistency was more preferable.)

Because of the above, I built Datacake with the aim of building a reliable, well tested, eventual consistent system akin to how Cassandra or more specifically how ScyllaDB behave with eventual consistent replication, but with a few core differences:

It's worth noting that Datacake itself does not implement the consensus and membership algorithms from scratch, instead we use chitchat developed by Quickwit which is an implementation of the scuttlebutt algorithm.

Inspirations and references

Contributing

Contributions are always welcome, although please open an issue for an idea about extending the main cluster system if you wish to extend or modify it heavily as something's are not always as simple as they seem.

What sort of things could I contribute?

🧪 Tests! 🧪 Tests! 🧪 Tests! Joking aside testing is probably the most important part of the system, extending these tests in any way you might think of, big or small is a huge help :)

Future Ideas