Trait lumina_node::store::Store
source · pub trait Store: Send + Sync + Debug {
// 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 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 append_single_unchecked<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
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 { ... }
fn append_unchecked<'life0, 'async_trait>(
&'life0 self,
headers: Vec<ExtendedHeader>
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn append_single<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn append<'life0, 'async_trait>(
&'life0 self,
headers: Vec<ExtendedHeader>
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>
where 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 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 append_single_unchecked<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append_single_unchecked<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append single header maintaining continuity from the genesis to the head.
Note
This method does not validate or verify that header is indeed correct.
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.
sourcefn append_unchecked<'life0, 'async_trait>(
&'life0 self,
headers: Vec<ExtendedHeader>
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append_unchecked<'life0, 'async_trait>(
&'life0 self,
headers: Vec<ExtendedHeader>
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append a range of headers maintaining continuity from the genesis to the head.
Note
This method does not validate or verify that headers are indeed correct.
sourcefn append_single<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn append_single<'life0, 'async_trait>(
&'life0 self,
header: ExtendedHeader
) -> Pin<Box<dyn Future<Output = Result<(), StoreError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Append single header maintaining continuity from the genesis to the head.