pub trait LogStore<LogId, Extensions>: Send {
type Error: Display + Debug;
// Required methods
fn get_log(
&self,
public_key: &PublicKey,
log_id: &LogId,
from: Option<u64>,
) -> impl Future<Output = Result<Option<Vec<(Header<Extensions>, Option<Body>)>>, Self::Error>> + Send;
fn get_raw_log(
&self,
public_key: &PublicKey,
log_id: &LogId,
from: Option<u64>,
) -> impl Future<Output = Result<Option<Vec<RawOperation>>, Self::Error>> + Send;
fn get_log_heights(
&self,
log_id: &LogId,
) -> impl Future<Output = Result<Vec<(PublicKey, u64)>, Self::Error>> + Send;
fn latest_operation(
&self,
public_key: &PublicKey,
log_id: &LogId,
) -> impl Future<Output = Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>> + Send;
fn delete_operations(
&mut self,
public_key: &PublicKey,
log_id: &LogId,
before: u64,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
fn delete_payloads(
&mut self,
public_key: &PublicKey,
log_id: &LogId,
from: u64,
to: u64,
) -> impl Future<Output = Result<bool, Self::Error>> + Send;
}Expand description
Interface for storing, deleting and querying logs.
Two variants of the trait are provided: one which is thread-safe (implementing Sync) and one
which is purely intended for single-threaded execution contexts.
Required Associated Types§
Required Methods§
Sourcefn get_log(
&self,
public_key: &PublicKey,
log_id: &LogId,
from: Option<u64>,
) -> impl Future<Output = Result<Option<Vec<(Header<Extensions>, Option<Body>)>>, Self::Error>> + Send
fn get_log( &self, public_key: &PublicKey, log_id: &LogId, from: Option<u64>, ) -> impl Future<Output = Result<Option<Vec<(Header<Extensions>, Option<Body>)>>, Self::Error>> + Send
Get operations from an authors’ log ordered by sequence number.
The from value will be used as the starting index for log retrieval, if supplied,
otherwise all operations will be returned.
Returns None when either the author or a log with the requested id was not found.
Sourcefn get_raw_log(
&self,
public_key: &PublicKey,
log_id: &LogId,
from: Option<u64>,
) -> impl Future<Output = Result<Option<Vec<RawOperation>>, Self::Error>> + Send
fn get_raw_log( &self, public_key: &PublicKey, log_id: &LogId, from: Option<u64>, ) -> impl Future<Output = Result<Option<Vec<RawOperation>>, Self::Error>> + Send
Get “raw” header and body bytes from an authors’ log ordered by sequence number.
The from value will be used as the starting index for log retrieval, if supplied,
otherwise all operations will be returned.
Returns None when either the author or a log with the requested id was not found.
Sourcefn get_log_heights(
&self,
log_id: &LogId,
) -> impl Future<Output = Result<Vec<(PublicKey, u64)>, Self::Error>> + Send
fn get_log_heights( &self, log_id: &LogId, ) -> impl Future<Output = Result<Vec<(PublicKey, u64)>, Self::Error>> + Send
Get the log heights of all logs, by any author, which are stored under the passed log id.
Sourcefn latest_operation(
&self,
public_key: &PublicKey,
log_id: &LogId,
) -> impl Future<Output = Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>> + Send
fn latest_operation( &self, public_key: &PublicKey, log_id: &LogId, ) -> impl Future<Output = Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>> + Send
Get only the latest operation from an authors’ log.
Returns None when the author or a log with the requested id was not found.
Sourcefn delete_operations(
&mut self,
public_key: &PublicKey,
log_id: &LogId,
before: u64,
) -> impl Future<Output = Result<bool, Self::Error>> + Send
fn delete_operations( &mut self, public_key: &PublicKey, log_id: &LogId, before: u64, ) -> impl Future<Output = Result<bool, Self::Error>> + Send
Delete all operations in a log before the given sequence number.
Returns true when any operations were deleted, returns false when the author or log
could not be found, or no operations were deleted.
Sourcefn delete_payloads(
&mut self,
public_key: &PublicKey,
log_id: &LogId,
from: u64,
to: u64,
) -> impl Future<Output = Result<bool, Self::Error>> + Send
fn delete_payloads( &mut self, public_key: &PublicKey, log_id: &LogId, from: u64, to: u64, ) -> impl Future<Output = Result<bool, Self::Error>> + Send
Delete a range of operation payloads in an authors’ log.
The range of deleted payloads includes it’s lower bound from but excludes the upper bound
to.
Returns true when operations within the requested range were deleted, or false when the
author or log could not be found, or no operations were deleted.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.