Skip to main content

RootStore

Trait RootStore 

Source
pub trait RootStore: Send + Sync {
    // Required methods
    fn get_root(&self, name: &str) -> Result<Option<Vec<u8>>, StoreError>;
    fn cas_root(
        &self,
        name: &str,
        expected: Option<&[u8]>,
        new: &[u8],
    ) -> Result<(), StoreError>;
    fn delete_root(&self, name: &str) -> Result<(), StoreError>;
    fn list_roots(&self, prefix: &str) -> Result<Vec<String>, StoreError>;
}
Expand description

Named root pointer storage with compare-and-swap fencing.

Required Methods§

Source

fn get_root(&self, name: &str) -> Result<Option<Vec<u8>>, StoreError>

Reads a root pointer.

§Errors

Returns an error if the backend cannot read the root.

Source

fn cas_root( &self, name: &str, expected: Option<&[u8]>, new: &[u8], ) -> Result<(), StoreError>

Publishes a root only if the stored pointer equals expected.

§Errors

Returns an error if the fence does not match or the backend cannot publish.

Source

fn delete_root(&self, name: &str) -> Result<(), StoreError>

Removes a root pointer. Missing roots are ignored.

§Errors

Returns an error if the backend cannot delete the root.

Source

fn list_roots(&self, prefix: &str) -> Result<Vec<String>, StoreError>

Lists root names beginning with prefix, in sorted order.

§Errors

Returns an error if the backend cannot enumerate roots.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§