Trait AvailabilityStorage

Source
pub trait AvailabilityStorage<Types>: Send + Sync
where Types: NodeType, Header<Types>: QueryableHeader<Types>, Payload<Types>: QueryablePayload<Types>,
{
Show 17 methods // Required methods fn get_leaf<'life0, 'async_trait>( &'life0 mut self, id: LeafId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<LeafQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_block<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<BlockQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_header<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<Header<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payload<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<PayloadQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payload_metadata<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<PayloadMetadata<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<VidCommonQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_metadata<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<VidCommonMetadata<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_leaf_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<LeafQueryData<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_block_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<BlockQueryData<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_payload_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<PayloadQueryData<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_payload_metadata_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<PayloadMetadata<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<VidCommonQueryData<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_metadata_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<VidCommonMetadata<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_block_with_transaction<'life0, 'async_trait>( &'life0 mut self, hash: TransactionHash<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<BlockQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn first_available_leaf<'life0, 'async_trait>( &'life0 mut self, from: u64, ) -> Pin<Box<dyn Future<Output = QueryResult<LeafQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_state_cert<'life0, 'async_trait>( &'life0 mut self, epoch: u64, ) -> Pin<Box<dyn Future<Output = QueryResult<StateCertQueryDataV2<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided method fn get_header_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<Header<Types>>>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

Persistent storage for a HotShot blockchain.

This trait defines the interface which must be provided by the storage layer in order to implement an availability data source. It is very similar to AvailabilityDataSource with every occurrence of Fetch replaced by QueryResult. This is not a coincidence. The purpose of the storage layer is to provide all of the functionality of the data source layer, but independent of an external fetcher for missing data. Thus, when the storage layer encounters missing, corrupt, or inaccessible data, it simply gives up and replaces the missing data with Err, rather than creating an asynchronous fetch request to retrieve the missing data.

Rust gives us ways to abstract and deduplicate these two similar APIs, but they do not lead to a better interface.

Required Methods§

Source

fn get_leaf<'life0, 'async_trait>( &'life0 mut self, id: LeafId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<LeafQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_block<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<BlockQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_header<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<Header<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<PayloadQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload_metadata<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<PayloadMetadata<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<VidCommonQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common_metadata<'life0, 'async_trait>( &'life0 mut self, id: BlockId<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<VidCommonMetadata<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_leaf_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<LeafQueryData<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_block_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<BlockQueryData<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<PayloadQueryData<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload_metadata_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<PayloadMetadata<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<VidCommonQueryData<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common_metadata_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<VidCommonMetadata<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_block_with_transaction<'life0, 'async_trait>( &'life0 mut self, hash: TransactionHash<Types>, ) -> Pin<Box<dyn Future<Output = QueryResult<BlockQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn first_available_leaf<'life0, 'async_trait>( &'life0 mut self, from: u64, ) -> Pin<Box<dyn Future<Output = QueryResult<LeafQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Get the first leaf which is available in the database with height >= from.

Source

fn get_state_cert<'life0, 'async_trait>( &'life0 mut self, epoch: u64, ) -> Pin<Box<dyn Future<Output = QueryResult<StateCertQueryDataV2<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn get_header_range<'life0, 'async_trait, R>( &'life0 mut self, range: R, ) -> Pin<Box<dyn Future<Output = QueryResult<Vec<QueryResult<Header<Types>>>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

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.

Implementors§

Source§

impl<Mode, Types> AvailabilityStorage<Types> for hotshot_query_service::data_source::storage::sql::Transaction<Mode>
where Types: NodeType, Mode: TransactionMode, Payload<Types>: QueryablePayload<Types>, Header<Types>: QueryableHeader<Types>,

Source§

impl<Types, T> AvailabilityStorage<Types> for hotshot_query_service::data_source::storage::fs::Transaction<T>
where Types: NodeType, Payload<Types>: QueryablePayload<Types>, Header<Types>: QueryableHeader<Types>, T: Revert + Deref<Target = FileSystemStorageInner<Types>> + Send + Sync,