Skip to main content

Crate mdcs_sdk

Crate mdcs_sdk 

Source
Expand description

MDCS SDK - High-level SDK for building collaborative applications

This SDK provides a simple, ergonomic API for building real-time collaborative applications using the MDCS (Merkle-Delta CRDT Store).

§Quick Start

use mdcs_sdk::{Client, ClientConfig};

// Create a client with a unique replica ID
let config = ClientConfig {
    user_name: "Alice".to_string(),
    ..Default::default()
};
let client = Client::new_with_memory_transport(config);

// Create a collaborative session
let session = client.create_session("my-session");

// Open a text document
let doc = session.open_text_doc("meeting-notes");

// Edit the document
doc.write().insert(0, "# Meeting Notes\n");

// Read the content
let content = doc.read().get_text();

§Architecture

The SDK is organized into several modules:

  • client - Main entry point for creating and managing collaborative sessions
  • document - Document types (text, rich text, JSON)
  • presence - Real-time cursor and user presence
  • sync - Network synchronization and peer management
  • network - Network transport abstractions
  • session - Session management for collaborative editing
  • error - Error types

Re-exports§

pub use client::Client;
pub use client::ClientConfig;
pub use client::ClientConfigBuilder;
pub use document::CollaborativeDoc;
pub use document::DocEvent;
pub use document::JsonDoc;
pub use document::RichTextDoc;
pub use document::TextDoc;
pub use error::Result;
pub use error::SdkError;
pub use network::MemoryTransport;
pub use network::Message;
pub use network::NetworkTransport;
pub use network::Peer;
pub use network::PeerId;
pub use network::PeerState;
pub use presence::Awareness;
pub use presence::AwarenessEvent;
pub use presence::CursorInfo;
pub use presence::UserPresenceInfo;
pub use session::Session;
pub use session::SessionEvent;
pub use sync::SyncConfig;
pub use sync::SyncConfigBuilder;
pub use sync::SyncEvent;
pub use sync::SyncManager;

Modules§

client
High-level client for the MDCS SDK.
document
Document wrappers for collaborative editing.
error
Error types for the MDCS SDK.
network
Network transport abstractions for MDCS synchronization.
prelude
Prelude module for convenient imports.
presence
Presence and awareness for collaborative editing.
session
Session management for collaborative editing sessions.
sync
Synchronization primitives for the SDK.

Structs§

Cursor
A cursor position in a document.
JsonPath
A path into a JSON document.
UserId
Unique identifier for a user.
UserInfo
User information for display.

Enums§

JsonValue
A JSON value that can be stored in the CRDT.
MarkType
The type/style of a formatting mark.
UserStatus
User status.