百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
D

dson

> 编程语言
开源

Rust 提供以空间为主的 CRDT 执行

192 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

Rust 提供以空间为主的 CRDT 执行

DSON: A Delta-State CRDT for JSON-like Data Structures

This crate provides a Rust implementation of DSON, a space-efficient, delta-state Conflict-Free Replicated Datatype (CRDT) for JSON-like data structures. It is based on the research paper "DSON: JSON CRDT Using Delta-Mutations For Document Stores" and started as a port of the original author's JavaScript implementation.

The primary goal of this library is to enable robust, and efficient multi-writer collaboration in extremely constrained environments (high latency and low bandwidth; opportunistic networking).

See also Helsing's announcement blog post.

Core Concepts

DSON provides three fundamental, composable CRDTs:

  • OrMap: An Observed-Remove Map, mapping string keys to other CRDT values.
  • OrArray: An Observed-Remove Array, providing a list-like structure.
  • MvReg: A Multi-Value Register, for storing primitive values. When concurrent writes occur, the register holds all conflicting values.

These primitives can be nested to create arbitrarily complex data structures. All modifications produce a delta, which is a small set of changes that can be transmitted to other replicas.

Observed-Remove Semantics

DSON uses Observed-Remove (OR) semantics. This means an element can only be removed if its addition has been observed. If an element is updated concurrently with its removal, the update "wins" and the element is preserved.

Causal CRDTs and Tombstone-Free Removals

DSON is a causal CRDT, using causal history to resolve conflicts. A key advantage of this model is the elimination of tombstones, which prevents unbounded metadata growth in long-lived documents.

Scope of this Crate

This crate provides the core data structures and algorithms for DSON. It is a low-level library, and you will likely want to build a typed abstraction layer on top of it.

It does not include any networking protocols. You are responsible for implementing the transport layer to broadcast deltas to other replicas.

Attribution

The initial version of this crate was based on the JavaScript implementation by the DSON paper authors.

The following people have contributed to this implementation:

  • @jonhoo
  • @wngr
  • @asmello
  • @avl
  • @oktal

License

This project is licensed under either of

  • Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)

at your option.

Further Resources

  • Talk on DSON and CRDTs - A presentation covering CRDTs in general and DSON in particular.

Development

This repository provides a Nix development shell. If you have Nix installed, you can enter the shell by running:

bash
nix develop

This will provide you with a consistent development environment, including the correct Rust toolchain and other helpful dependencies.

In general, dson has very little dependencies, so you should expect to run cargo build/cargo test just fine.

Benchmarks

Two benchmark harnesses are available:

Tango - Paired-testing benchmarks for detecting performance regressions:

bash
# Establish baseline
cargo bench --bench tango

# After making changes, compare against baseline
cargo bench --bench tango -- compare

# Filter specific benchmarks
cargo bench --bench tango -- compare -f "transaction::map::*"

# Quick absolute timings (non-comparative mode)
cargo bench --bench tango -- solo -f "transaction::map::*" -s 100

IAI-Callgrind - Instruction-level profiling using Valgrind (Linux only):

bash
# Run IAI benchmarks (requires Linux and Valgrind)
cargo bench --bench iai
cargo bench --bench nested_transactions

Documentation

For a complete guide, including detailed explanations of the core concepts, advanced topics, and API usage, please refer to the generated docs.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言