Expand description
Real-time Collaboration Module for Armature Framework
Provides CRDTs (Conflict-free Replicated Data Types) and collaboration primitives for building real-time collaborative applications.
§Overview
┌─────────────────────────────────────────────────────────────────┐
│ Collaboration Architecture │
│ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │ Client A │───▶│ CRDT │───▶│ Sync │◀───│ Client B │ │
│ └──────────┘ │ State │ │ Engine │ └──────────┘ │
│ └──────────┘ └──────────┘ │
│ │ │ │
│ ▼ ▼ │
│ ┌──────────┐ ┌──────────┐ │
│ │ Document │ │ Presence │ │
│ │ State │ │ State │ │
│ └──────────┘ └──────────┘ │
└─────────────────────────────────────────────────────────────────┘§Quick Start
ⓘ
use armature_collab::{Document, TextCrdt, CollabSession};
// Create a collaborative document
let doc = Document::new("doc-123");
// Add a text field with CRDT
let text = doc.add_text("content");
// Make edits (automatically synced)
text.insert(0, "Hello, ");
text.insert(7, "World!");
// Subscribe to changes
doc.on_change(|change| {
println!("Document updated: {:?}", change);
});§CRDT Types
| Type | Use Case | Merge Strategy |
|---|---|---|
LwwRegister | Single values | Last-Writer-Wins |
GCounter | Increment-only counters | Max per replica |
PnCounter | Inc/dec counters | G-Counter pair |
GSet | Append-only sets | Union |
OrSet | Add/remove sets | Observed-Remove |
LwwMap | Key-value stores | LWW per key |
RgaText | Collaborative text | RGA algorithm |
§Features
text- Text CRDT with RGA algorithm (default)websocket- WebSocket sync integrationfull- All features
Re-exports§
pub use crdt::*;pub use document::*;pub use error::*;pub use presence::*;pub use session::*;pub use sync::*;pub use text::*;
Modules§
- crdt
- Core CRDT (Conflict-free Replicated Data Type) implementations
- document
- Collaborative document abstraction
- error
- Error types for collaboration module
- presence
- Presence and awareness for collaborative sessions
- session
- Collaboration session management
- sync
- Synchronization protocol for collaborative editing
- text
- Text CRDT for collaborative text editing
Structs§
- Logical
Clock - Logical timestamp for ordering operations
- Operation
- An operation that can be applied to a CRDT
- Replica
Id - Unique identifier for a replica (client/node)
- Vector
Clock - Vector clock for tracking causality