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 obsolete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
) -> 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: Vec<u8>,
entry_id: EntryId,
region_id: RegionId,
provider: &Provider,
) -> Result<Entry, Self::Error>;
fn latest_entry_id(
&self,
provider: &Provider,
) -> Result<EntryId, Self::Error>;
// Provided method
fn wait_durable<'life0, 'life1, 'async_trait>(
&'life0 self,
_provider: &'life1 Provider,
_entry_id: EntryId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}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.
Sourcefn obsolete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn obsolete_all<'life0, 'life1, 'async_trait>(
&'life0 self,
provider: &'life1 Provider,
region_id: RegionId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Marks all entries of a region as obsolete and removes its dedicated namespace when supported by the backend.
Provided Methods§
Sourcefn wait_durable<'life0, 'life1, 'async_trait>(
&'life0 self,
_provider: &'life1 Provider,
_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 wait_durable<'life0, 'life1, 'async_trait>(
&'life0 self,
_provider: &'life1 Provider,
_entry_id: EntryId,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Waits until every entry of the provider’s region with an id at or below
entry_id has the persistence this log store guarantees for an
acknowledged append, so that a caller can persist entry_id as a
replay watermark.
The default returns at once and keeps each log store’s own
acknowledgement guarantee, whatever it is: Raft Engine with
sync_write = false, for example, acknowledges an append before its
periodic sync. A log store that acknowledges an append before its
entries have that persistence overrides this method.