Skip to main content

Crate mdcs_db

Crate mdcs_db 

Source
Expand description

§mdcs-db

Database layer for the MDCS (Merkle-Delta CRDT Store).

This crate provides:

  • Document-based API with path operations
  • Collaborative text (RGAText, RichText)
  • JSON/Object CRDT for flexible schemas
  • Presence and awareness for real-time collaboration
  • Undo/Redo support

§Example

use mdcs_db::{DocumentStore, DocumentId, JsonValue};

let mut store = DocumentStore::new("replica_1");

// Create a text document
let doc_id = store.create_text("My Document");
store.text_insert(&doc_id, 0, "Hello World").unwrap();

// Create a JSON document
let json_id = store.create_json("Config");
store.json_set(&json_id, "name", JsonValue::String("Test".into())).unwrap();

// Rich text with formatting
let rich_id = store.create_rich_text("Formatted");
store.rich_text_insert(&rich_id, 0, "Bold text").unwrap();
store.rich_text_bold(&rich_id, 0, 4).unwrap();

Re-exports§

pub use rga_list::ListId;
pub use rga_list::ListNode;
pub use rga_list::RGAList;
pub use rga_list::RGAListDelta;
pub use rga_text::RGAText;
pub use rga_text::RGATextDelta;
pub use rga_text::TextId;
pub use rich_text::Anchor;
pub use rich_text::Mark;
pub use rich_text::MarkId;
pub use rich_text::MarkType;
pub use rich_text::RichText;
pub use rich_text::RichTextDelta;
pub use json_crdt::ArrayChange;
pub use json_crdt::ArrayId;
pub use json_crdt::JsonCrdt;
pub use json_crdt::JsonCrdtDelta;
pub use json_crdt::JsonPath;
pub use json_crdt::JsonValue;
pub use json_crdt::ObjectChange;
pub use json_crdt::ObjectId;
pub use json_crdt::PathSegment;
pub use document::CrdtValue;
pub use document::Document;
pub use document::DocumentDelta;
pub use document::DocumentId;
pub use document::DocumentStore;
pub use document::DocumentType;
pub use document::QueryOptions;
pub use document::SortField;
pub use document::StoreChange;
pub use presence::Cursor;
pub use presence::CursorBuilder;
pub use presence::CursorColors;
pub use presence::PresenceDelta;
pub use presence::PresenceTracker;
pub use presence::UserId;
pub use presence::UserInfo;
pub use presence::UserPresence;
pub use presence::UserStatus;
pub use undo::CollaborativeUndoManager;
pub use undo::FormatOperation;
pub use undo::GroupId;
pub use undo::JsonOperation;
pub use undo::Operation;
pub use undo::OperationId;
pub use undo::TextOperation;
pub use undo::UndoManager;
pub use undo::UndoableOperation;
pub use error::DbError;

Modules§

document
Document Store - High-level API for managing CRDT documents.
error
Error types for the database layer.
json_crdt
JSON CRDT - Automerge-like nested object CRDT.
presence
Presence System - Real-time user presence and cursor tracking.
rga_list
RGA List - Replicated Growable Array for ordered sequences.
rga_text
RGA Text - Collaborative text CRDT based on Replicated Growable Array.
rich_text
Rich Text CRDT - Collaborative rich text with formatting marks.
undo
Undo/Redo System - Operation-based undo with causal grouping.