Skip to main content

NativeLogStorage

Trait NativeLogStorage 

Source
pub trait NativeLogStorage: Send + Sync {
    // Required methods
    fn read_version(
        &self,
        name: &str,
        version: u64,
    ) -> Result<Option<Vec<u8>>, LogError>;
    fn cas_version(
        &self,
        name: &str,
        version: u64,
        expected: Option<&[u8]>,
        new: &[u8],
    ) -> Result<(), LogError>;
    fn versions(&self, name: &str) -> Result<Vec<u64>, LogError>;
    fn delete_versions(&self, name: &str) -> Result<(), LogError>;
}
Expand description

Synchronous byte store for versioned transaction-log objects.

Implementations usually adapt the same native storage system used for blobs and roots. Each object is one lease-version log for one database.

Required Methods§

Source

fn read_version( &self, name: &str, version: u64, ) -> Result<Option<Vec<u8>>, LogError>

Reads the encoded bytes for name and version.

§Errors

Returns an error when the native backend cannot read the version object or when backend data cannot be represented as log bytes.

Source

fn cas_version( &self, name: &str, version: u64, expected: Option<&[u8]>, new: &[u8], ) -> Result<(), LogError>

Compare-and-swap writes encoded bytes for name and version.

§Errors

Returns an error when the compare-and-swap fails, the native backend cannot publish the version object, or the backend reports invalid data.

Source

fn versions(&self, name: &str) -> Result<Vec<u64>, LogError>

Lists versions present for name, sorted ascending.

§Errors

Returns an error when the native backend cannot enumerate version objects or returns an invalid version identifier.

Source

fn delete_versions(&self, name: &str) -> Result<(), LogError>

Deletes all versions for name.

§Errors

Returns an error when the native backend cannot remove a version object.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§