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§
Required Methods§
Sourceasync fn get_root(
&self,
name: &[u8],
) -> Result<Option<RootManifest>, Self::Error>
async fn get_root( &self, name: &[u8], ) -> Result<Option<RootManifest>, Self::Error>
Load a named root manifest.
Sourceasync fn put_root(
&self,
name: &[u8],
manifest: &RootManifest,
) -> Result<(), Self::Error>
async fn put_root( &self, name: &[u8], manifest: &RootManifest, ) -> Result<(), Self::Error>
Unconditionally insert or replace a named root manifest.
Sourceasync fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
async fn delete_root(&self, name: &[u8]) -> Result<(), Self::Error>
Delete a named root manifest. Deleting a missing name is not an error.
Sourceasync fn compare_and_swap_root(
&self,
name: &[u8],
expected: Option<&RootManifest>,
new: Option<&RootManifest>,
) -> Result<ManifestUpdate, Self::Error>
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".