pub trait Store:
Send
+ Sync
+ Debug {
Show 18 methods
// Required methods
fn get_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_by_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn wait_new_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn wait_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn head_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn has<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn has_at<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn update_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
cids: Vec<Cid>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<SamplingMetadata>, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn mark_as_sampled<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn insert<'life0, 'async_trait, R>(
&'life0 self,
headers: R,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where R: TryInto<VerifiedExtendedHeaders> + Send + 'async_trait,
<R as TryInto<VerifiedExtendedHeaders>>::Error: Display,
Self: 'async_trait,
'life0: 'async_trait;
fn get_stored_header_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_sampled_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_pruned_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn remove_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn close<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait;
// Provided method
fn get_range<'life0, 'async_trait, R>(
&'life0 self,
range: R,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExtendedHeader>, StoreError>> + Send + 'async_trait>>
where R: RangeBounds<u64> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
An asynchronous ExtendedHeader storage.
Currently it is required that all the headers are inserted to the storage in order, starting from the genesis.
Required Methods§
Sourcefn get_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the ExtendedHeader with the highest height.
Sourcefn get_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_by_hash<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns the header of a specific hash.
Sourcefn get_by_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_by_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<ExtendedHeader, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the header of a specific height.
Sourcefn wait_new_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_new_head<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = u64> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns when new head is available in the Store.
Sourcefn wait_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn wait_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns when height is available in the Store.
Sourcefn head_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn head_height<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<u64, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the highest known height.
Sourcefn has<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn has<'life0, 'life1, 'async_trait>(
&'life0 self,
hash: &'life1 Hash,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Returns true if hash exists in the store.
Sourcefn has_at<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn has_at<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns true if height exists in the store.
Sourcefn update_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
cids: Vec<Cid>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn update_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
cids: Vec<Cid>,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sets or updates sampling metadata for the header.
In case of update, provided CID list is appended onto the existing one, as not to lose references to previously sampled blocks.
Sourcefn get_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<SamplingMetadata>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_sampling_metadata<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<Option<SamplingMetadata>, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Gets the sampling metadata for the height.
Err(StoreError::NotFound) indicates that both header and sampling metadata for the requested
height are not in the store.
Ok(None) indicates that header is in the store but sampling metadata is not set yet.
Sourcefn mark_as_sampled<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mark_as_sampled<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Mark block as sampled.
Sourcefn insert<'life0, 'async_trait, R>(
&'life0 self,
headers: R,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
R: TryInto<VerifiedExtendedHeaders> + Send + 'async_trait,
<R as TryInto<VerifiedExtendedHeaders>>::Error: Display,
Self: 'async_trait,
'life0: 'async_trait,
fn insert<'life0, 'async_trait, R>(
&'life0 self,
headers: R,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
R: TryInto<VerifiedExtendedHeaders> + Send + 'async_trait,
<R as TryInto<VerifiedExtendedHeaders>>::Error: Display,
Self: 'async_trait,
'life0: 'async_trait,
Insert a range of headers into the store.
New insertion should pass all the constraints in BlockRanges::check_insertion_constraints,
additionaly it should be ExtendedHeader::verifyed against neighbor headers.
Sourcefn get_stored_header_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stored_header_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a list of header ranges currenty held in store.
Sourcefn get_sampled_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_sampled_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a list of blocks that were sampled and their header is currenty held in store.
Sourcefn get_pruned_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_pruned_ranges<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<BlockRanges, StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns a list of headers that were pruned until now.
Sourcefn remove_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn remove_height<'life0, 'async_trait>(
&'life0 self,
height: u64,
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove header with given height from the store.
Provided Methods§
Sourcefn get_range<'life0, 'async_trait, R>(
&'life0 self,
range: R,
) -> Pin<Box<dyn Future<Output = Result<Vec<ExtendedHeader>, StoreError>> + Send + 'async_trait>>
fn get_range<'life0, 'async_trait, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = Result<Vec<ExtendedHeader>, StoreError>> + Send + 'async_trait>>
Returns the headers from the given heights range.
If start of the range is unbounded, the first returned header will be of height 1. If end of the range is unbounded, the last returned header will be the last header in the store.
§Errors
If range contains a height of a header that is not found in the store or RangeBounds
cannot be converted to a valid range.
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.