pub trait DurableStore:
Send
+ Sync
+ 'static {
// Required methods
fn persist(&self, key: &str, blob: &[u8]) -> Result<()>;
fn delete_marker(&self, key: &str) -> Result<()>;
fn load(&self, key: &str) -> Result<Option<Vec<u8>>>;
fn keys(&self) -> Result<Vec<String>>;
// Provided method
fn persist_marker(&self, key: &str) -> Result<()> { ... }
}Expand description
Abstraction over a durable backing store. Methods are sync so they can be called from anywhere (including the replicator actor task); implementations should keep work small or punt to a worker thread.
Required Methods§
Sourcefn persist(&self, key: &str, blob: &[u8]) -> Result<()>
fn persist(&self, key: &str, blob: &[u8]) -> Result<()>
Note that key was written. blob is the serialized CRDT
snapshot — opaque to the store. Implementations may de-duplicate.
Sourcefn delete_marker(&self, key: &str) -> Result<()>
fn delete_marker(&self, key: &str) -> Result<()>
Forget key.
Provided Methods§
Sourcefn persist_marker(&self, key: &str) -> Result<()>
fn persist_marker(&self, key: &str) -> Result<()>
Convenience: persist a key without a blob (replicator-actor
uses this when the value is type-erased; the user typically
provides a full persist via a typed adapter).