Expand description
SyncedStore — device-owned state synchronization across the mesh.
Each device owns exactly one slice of type T per store. Writes update
the local slice and broadcast the change. Remote slices are received and
cached automatically via a background sync task.
§Quick start
ⓘ
use std::sync::Arc;
use truffle_core::synced_store::SyncedStore;
let node = Arc::new(node);
let store: Arc<SyncedStore<MyState>> = SyncedStore::new(node, "my-state");
store.set(MyState { value: 42 }).await;
let my_data = store.local();
let all_data = store.all().await;Re-exports§
pub use backend::FileBackend;pub use backend::MemoryBackend;pub use backend::StoreBackend;pub use types::Slice;pub use types::StoreEvent;pub use types::SyncMessage;
Modules§
- backend
- Persistence backends for SyncedStore.
- sync
- Background sync task for SyncedStore.
- types
- Types for the SyncedStore subsystem.
Structs§
- Synced
Store - A synchronized key-value store with device-owned slices.