pub trait LocalOperationStore<LogId, Extensions>: Clone {
type Error: Display + Debug;
// Required methods
async fn insert_operation(
&mut self,
hash: Hash,
header: &Header<Extensions>,
body: Option<&Body>,
header_bytes: &[u8],
log_id: &LogId,
) -> Result<bool, Self::Error>;
async fn get_operation(
&self,
hash: Hash,
) -> Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>;
async fn get_raw_operation(
&self,
hash: Hash,
) -> Result<Option<RawOperation>, Self::Error>;
async fn has_operation(&self, hash: Hash) -> Result<bool, Self::Error>;
async fn delete_operation(
&mut self,
hash: Hash,
) -> Result<bool, Self::Error>;
async fn delete_payload(&mut self, hash: Hash) -> Result<bool, Self::Error>;
}Expand description
Interface for storing, deleting and querying operations.
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§
Sourceasync fn insert_operation(
&mut self,
hash: Hash,
header: &Header<Extensions>,
body: Option<&Body>,
header_bytes: &[u8],
log_id: &LogId,
) -> Result<bool, Self::Error>
async fn insert_operation( &mut self, hash: Hash, header: &Header<Extensions>, body: Option<&Body>, header_bytes: &[u8], log_id: &LogId, ) -> Result<bool, Self::Error>
Insert an operation.
Returns true when the insert occurred, or false when the operation already existed and
no insertion occurred.
Sourceasync fn get_operation(
&self,
hash: Hash,
) -> Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>
async fn get_operation( &self, hash: Hash, ) -> Result<Option<(Header<Extensions>, Option<Body>)>, Self::Error>
Get an operation.
Sourceasync fn get_raw_operation(
&self,
hash: Hash,
) -> Result<Option<RawOperation>, Self::Error>
async fn get_raw_operation( &self, hash: Hash, ) -> Result<Option<RawOperation>, Self::Error>
Get the “raw” header and body bytes of an operation.
Sourceasync fn has_operation(&self, hash: Hash) -> Result<bool, Self::Error>
async fn has_operation(&self, hash: Hash) -> Result<bool, Self::Error>
Query the existence of an operation.
Returns true if the operation was found in the store and false if not.
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.