Skip to main content

AsyncManifestStore

Trait AsyncManifestStore 

Source
pub trait AsyncManifestStore {
    type Error: Error + 'static;

    // Required methods
    async fn get_root(
        &self,
        name: &[u8],
    ) -> Result<Option<RootManifest>, Self::Error>;
    async fn put_root(
        &self,
        name: &[u8],
        manifest: &RootManifest,
    ) -> Result<(), Self::Error>;
    async fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>;
    async fn compare_and_swap_root(
        &self,
        name: &[u8],
        expected: Option<&RootManifest>,
        new: Option<&RootManifest>,
    ) -> Result<ManifestUpdate, Self::Error>;
}
Expand description

Async storage for named root manifests.

This mirrors ManifestStore for remote, browser, object-store, and cloud-database backends. The mutable root layer stays separate from immutable node storage so remote implementations can use their native compare-and-swap or transaction mechanism for branch/head updates.

Required Associated Types§

Source

type Error: Error + 'static

Error type for manifest operations.

Required Methods§

Source

async fn get_root( &self, name: &[u8], ) -> Result<Option<RootManifest>, Self::Error>

Load a named root manifest.

Source

async fn put_root( &self, name: &[u8], manifest: &RootManifest, ) -> Result<(), Self::Error>

Unconditionally insert or replace a named root manifest.

Source

async fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>

Delete a named root manifest. Deleting a missing name is not an error.

Source

async fn compare_and_swap_root( &self, name: &[u8], expected: Option<&RootManifest>, new: Option<&RootManifest>, ) -> Result<ManifestUpdate, Self::Error>

Atomically update a named root if the current manifest matches expected.

expected == None means the name must be absent. new == None deletes the name when the compare succeeds.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<T: AsyncManifestStore> AsyncManifestStore for Arc<T>

Source§

type Error = <T as AsyncManifestStore>::Error

Source§

async fn get_root( &self, name: &[u8], ) -> Result<Option<RootManifest>, Self::Error>

Source§

async fn put_root( &self, name: &[u8], manifest: &RootManifest, ) -> Result<(), Self::Error>

Source§

async fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>

Source§

async fn compare_and_swap_root( &self, name: &[u8], expected: Option<&RootManifest>, new: Option<&RootManifest>, ) -> Result<ManifestUpdate, Self::Error>

Implementors§