Crates.io | crdt-sample |
lib.rs | crdt-sample |
version | 0.2.0 |
source | src |
created_at | 2023-03-09 14:56:16.833314 |
updated_at | 2023-06-01 13:13:08.991998 |
description | A library containing samples of crdts |
homepage | |
repository | https://github.com/Jumaruba/crdt-sample |
max_upload_size | |
id | 805719 |
size | 23,712 |
A repository containing some CRDTs implementations in Rust.
CRDT | Type | Tests |
---|---|---|
[Aworset] Add-Wins Observed Remove Set | State-Based | aworset.rs |
[Aworset Optimized] Add-Wins Observed Remove Set | State-Based | --- |
[GCounter] Grow-Only Counter | State-Based | -- |
[PnCounter] Positive-Negative Counter | State-Based | -- |
[MvReg] Multi-Value Register [on progress] | State-Based | --- |
Some auxiliary structures were built to create some CRDTs:
Name | Tests | Explanation | Reference |
---|---|---|---|
DotContext | dotcontext.rs | Bartosz Sypytkowski Blog | delta-enabled-crdts |
The cargo package is available at:
Add the following piece of code to your Cargo.toml
:
[dependencies]
crdt-sample = "0.1.0"
use crdt_sample::{AworsetOpt, NodeId};
fn main() {
let node_id = NodeId::new(1, "addr".to_string());
let mut aworset: AworsetOpt<i32> = AworsetOpt::new(node_id);
aworset.add(1);
println!("{:?}", aworset);
// AworsetOpt { id: addr1, set: {(addr1, 1, 1)}, cc: DotContext { cc: {addr1: 1}, dc: {} } }
}