Skip to main content

DurableStore

Trait DurableStore 

Source
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§

Source

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.

Source

fn delete_marker(&self, key: &str) -> Result<()>

Forget key.

Source

fn load(&self, key: &str) -> Result<Option<Vec<u8>>>

Read the full snapshot for key. None if absent.

Source

fn keys(&self) -> Result<Vec<String>>

All keys currently held.

Provided Methods§

Source

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).

Implementors§