pub trait LogStore:
Send
+ Sync
+ 'static
+ Debug {
type Error: ErrorExt + Send + Sync + 'static;
// Required methods
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn append_batch<'life0, 'async_trait>(
&'life0 self,
entries: Vec<Entry>,
) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
id: EntryId,
index: Option<WalIndex>,
) -> Pin<Box<dyn Future<Output = Result<SendableEntryStream<'static, Entry, Self::Error>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn create_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn list_namespaces<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Provider>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn obsolete<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
entry_id: EntryId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn entry(
&self,
data: &mut Vec<u8>,
entry_id: EntryId,
region_id: RegionId,
provider: &Provider,
) -> Result<Entry, Self::Error>;
}
Expand description
LogStore
serves as a Write-Ahead-Log for storage engine.
Required Associated Types§
Required Methods§
sourcefn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stops components of the logstore.
sourcefn append_batch<'life0, 'async_trait>(
&'life0 self,
entries: Vec<Entry>,
) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append_batch<'life0, 'async_trait>(
&'life0 self,
entries: Vec<Entry>,
) -> Pin<Box<dyn Future<Output = Result<AppendBatchResponse, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Appends a batch of entries and returns a response containing a map where the key is a region id while the value is the id of the last successfully written entry of the region.
sourcefn read<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
id: EntryId,
index: Option<WalIndex>,
) -> Pin<Box<dyn Future<Output = Result<SendableEntryStream<'static, Entry, Self::Error>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn read<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
id: EntryId,
index: Option<WalIndex>,
) -> Pin<Box<dyn Future<Output = Result<SendableEntryStream<'static, Entry, Self::Error>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new EntryStream
to asynchronously generates Entry
with ids
starting from id
.
sourcefn create_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Creates a new Namespace
from the given ref.
sourcefn delete_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_namespace<'life0, 'life1, 'async_trait>(
&'life0 self,
ns: &'life1 Provider,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Deletes an existing Namespace
specified by the given ref.
sourcefn list_namespaces<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Provider>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_namespaces<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<Provider>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Lists all existing namespaces.
sourcefn obsolete<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
entry_id: EntryId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn obsolete<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
entry_id: EntryId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Marks all entries with ids <=entry_id
of the given namespace
as obsolete,
so that the log store can safely delete those entries. This method does not guarantee
that the obsolete entries are deleted immediately.