Expand description
§dstate
Framework-agnostic distributed state replication for Rust actor systems.
dstate provides traits and replication logic for managing state that is
replicated across nodes in a cluster. State changes are projected into
public views, synchronized via configurable strategies, and persisted
through a pluggable storage interface.
§Core Traits
DistributedState— Simple state where the entire value is the public viewDeltaDistributedState— State with separate view/delta projectionsActorRuntime— Actor spawning, timers, and processing groupsStatePersistence— Async save/load for crash recoveryClock— Time abstraction for deterministic testing
§Adapter Crates
Use dstate with a concrete actor framework via an adapter:
dstate-ractor— ractor adapterdstate-kameo— kameo adapter
Re-exports§
pub use engine::DistributedStateEngine;pub use engine::EngineAction;pub use engine::EngineHealth;pub use engine::EngineQueryResult;pub use engine::HealthStatus;pub use engine::MutateResult;pub use engine::DeltaMutateResult;pub use engine::SyncMetrics;pub use engine::WireMessage;
Modules§
- engine
- Public API for driving the dstate replication protocol.
- test_
support
Structs§
- Actor
Send Error - Error returned by
ActorRef::send(). - Batched
Change Feed - A batched collection of change notifications broadcast by the aggregator. No target node is specified because this message is broadcast to all nodes in the cluster.
- Change
Feed Config - Configuration for the change feed aggregator.
- Change
Notification - A notification that a state has changed on a node (used by the change feed).
- Cluster
Error - Error returned by
ClusterEventsoperations. - Generation
- Logical version of a state, used for ordering and staleness detection.
- Group
Error - Error returned by processing group operations.
- NodeId
- Unique identifier for a node in the cluster.
- State
Config - Per-state-type configuration.
- State
Object - The local node’s authoritative copy of a distributed state.
- State
Registry - Registry of all distributed state types on this node.
- State
View Object - A peer node’s replicated view of a distributed state.
- Subscription
Id - Opaque handle returned by
ClusterEvents::subscribe, used to cancel a subscription viaClusterEvents::unsubscribe. - Sync
Strategy - Synchronization strategy composed from independent options.
- System
Clock - Production clock delegating to
std::time.
Enums§
- Cluster
Event - Events emitted by the cluster membership system.
- Deserialize
Error - Errors from deserializing state/view/delta data.
- Mutation
Error - Errors from mutation operations.
- Persist
Error - Errors from persistence operations.
- Push
Mode - Push mode for synchronization.
- Query
Error - Errors from query operations.
- Registry
Error - Errors from state registration.
- Sync
Message - Wire-level synchronization messages exchanged between nodes.
- Sync
Urgency - Urgency hint returned by
DeltaDistributedState::sync_urgency(). - Version
Mismatch Policy - Policy for handling wire version mismatches on inbound sync messages.
Traits§
- Actor
Ref - A handle to a running actor that can receive messages of type
M. - Actor
Runtime - The top-level actor runtime abstraction. One instance per node.
- AnyState
Shard - Type-erased interface for a registered state shard.
- Clock
- Abstraction over time sources, enabling deterministic testing.
- Cluster
Events - Subscription to cluster membership events.
- Delta
Distributed State - A distributed state type with separate State/View/Delta projections.
- Distributed
State - A distributed state type whose full state is the public view (no projection).
- State
Persistence - Async trait for persisting state to durable storage.
- Timer
Handle - A handle to a scheduled timer that can be cancelled.