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§
Sourcefn read_version(
&self,
name: &str,
version: u64,
) -> Result<Option<Vec<u8>>, LogError>
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.
Sourcefn cas_version(
&self,
name: &str,
version: u64,
expected: Option<&[u8]>,
new: &[u8],
) -> Result<(), LogError>
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".