pub trait NativeLogStorage: Send + Sync {
// Required methods
fn read_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn cas_chunk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
expected: Option<&'life2 [u8]>,
new: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn list_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Asynchronous byte store for chunked transaction-log objects.
Implementations usually adapt the same native storage system used for blobs
and roots. A database’s log for one lease version is a sequence of chunk
objects (name, version, chunk), each a run of framed records; a writer
appends to the highest chunk and rolls to the next once it fills, so no
single object grows without bound. Chunk 0 of a version is the whole-log
object earlier releases wrote, so existing logs read back as their chunk 0.
Required Methods§
Sourcefn read_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Reads the encoded bytes for one (name, version, chunk) object.
§Errors
Returns an error when the native backend cannot read the chunk object or when backend data cannot be represented as log bytes.
Sourcefn cas_chunk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
expected: Option<&'life2 [u8]>,
new: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn cas_chunk<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
name: &'life1 str,
version: u64,
chunk: u64,
expected: Option<&'life2 [u8]>,
new: &'life3 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Compare-and-swap writes encoded bytes for one (name, version, chunk)
object.
§Errors
Returns an error when the compare-and-swap fails, the native backend cannot publish the chunk object, or the backend reports invalid data.
Sourcefn list_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_chunks<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<(u64, u64)>, LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists every (version, chunk) pair present for name.
§Errors
Returns an error when the native backend cannot enumerate log objects or returns an invalid identifier.
Sourcefn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), LogError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes every chunk of every version for name.
§Errors
Returns an error when the native backend cannot remove a chunk object.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".