Expand description
Document actor implementation for managing automerge documents.
Document actors are passive state machines that manage individual documents. They handle loading documents from storage, saving them when needed, and managing their lifecycle.
§Architecture
- State machines: Actors process messages and return results
- Sans-IO: All I/O operations are returned as tasks for the caller to execute
- Simple lifecycle: Initialize → Load → Ready → Terminate
§Usage
// Create an actor
let actor = DocumentActor::new(document_id);
// Initialize it
let result = actor.handle_message(now, SamodToActorMessage::Initialize)?;
// Execute I/O tasks
for io_task in result.io_tasks {
let io_result = execute_io(io_task)?;
actor.handle_io_complete(now, io_result)?;
}Re-exports§
pub use document_actor::DocumentActor;pub use errors::DocumentError;
Modules§
Structs§
- Compaction
Hash - The SHA-256 hash of a set of change hashes, used to uniquely identify a compacted document
- DocActor
Result - Result of processing a message or I/O completion.
- Document
Actor Id - Spawn
Args - Sync
Message Stat - Statistics about a single sync message processed by the document actor.
- With
DocResult - Result of a document operation that includes both the closure result and any side effects.
Enums§
- Sync
Direction - Direction of a sync message.