Trait AvailabilityDataSource

Source
pub trait AvailabilityDataSource<Types: NodeType>
where Header<Types>: QueryableHeader<Types>, Payload<Types>: QueryablePayload<Types>,
{
Show 29 methods // Required methods fn get_leaf<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<LeafQueryData<Types>>> + Send + 'async_trait>> where ID: Into<LeafId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_header<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<Header<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_block<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<BlockQueryData<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_payload<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<PayloadQueryData<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_payload_metadata<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<PayloadMetadata<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<VidCommonQueryData<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_metadata<'life0, 'async_trait, ID>( &'life0 self, id: ID, ) -> Pin<Box<dyn Future<Output = Fetch<VidCommonMetadata<Types>>> + Send + 'async_trait>> where ID: Into<BlockId<Types>> + Send + Sync + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_leaf_range<'life0, 'async_trait, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<LeafQueryData<Types>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_header_range<'life0, 'async_trait, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<Header<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonMetadata<Types>>> + Send + 'async_trait>> where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait; fn get_leaf_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<LeafQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_block_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<BlockQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payload_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<PayloadQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_payload_metadata_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<PayloadMetadata<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_vid_common_metadata_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonMetadata<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_transaction<'life0, 'async_trait>( &'life0 self, hash: TransactionHash<Types>, ) -> Pin<Box<dyn Future<Output = Fetch<TransactionQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; fn get_state_cert<'life0, 'async_trait>( &'life0 self, epoch: u64, ) -> Pin<Box<dyn Future<Output = Fetch<StateCertQueryData<Types>>> + Send + 'async_trait>> where Self: 'async_trait, 'life0: 'async_trait; // Provided methods fn subscribe_blocks<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, BlockQueryData<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_payloads<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, PayloadQueryData<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_payload_metadata<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, PayloadMetadata<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_leaves<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, LeafQueryData<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_headers<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, Header<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_vid_common<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, VidCommonQueryData<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... } fn subscribe_vid_common_metadata<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, VidCommonMetadata<Types>>> + Send + 'async_trait>> where Self: Sync + 'async_trait, 'life0: 'async_trait { ... }
}
Expand description

An interface for querying a HotShot blockchain.

This interface provides expressive queries over all the data which is made available by HotShot consensus. The data exposed by this interface consists entirely of normative data: data which every correct HotShot node or light client will agree on, and which is guaranteed by consensus to be immutable. This immutability has an interesting consequence: all of the methods exposed by this trait are pure: given equivalent inputs, the same method will always return equivalent outputs1.

This purity property has a further consequence: none of the methods defined here can fail! Even if you query for a block at a position past the end of the current chain – a block which does not exist yet – the query will not fail. It will return an in-progress Fetch which, when it finally does resolve, resolves to the unique block at that position in the chain. All subsequent queries for the same position will eventually resolve to the same block.

In other words, the abstraction is that of an infinitely long chain which exists statically, in its entirety, at all times. In reality, of course, this chain is being produced incrementally and has a finite length at any given time. But all this means is that some queries may take a long time to resolve while others may resolve immediately.


  1. The data returned by these methods are wrapped in Fetch, which does not implement [PartialEq]. So to speak of equivalent outputs, we need to define an equivalence relation on Fetch<T>. The relation we will use is defined when T: PartialEq, and defines two fetches f1 and f2 as equivalent when f1.await == f2.await. That is, depending on when you call a certain method, you may or may not get a response immediately. But whenever you do get the data you requested, it is unique for that combination of inputs. 

Required Methods§

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

fn get_header_range<'life0, 'async_trait, R>( &'life0 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<Header<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<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 self, range: R, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonMetadata<Types>>> + Send + 'async_trait>>
where R: RangeBounds<usize> + Send + 'static + 'async_trait, Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_leaf_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<LeafQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_block_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<BlockQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<PayloadQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_payload_metadata_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<PayloadMetadata<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_vid_common_metadata_range_rev<'life0, 'async_trait>( &'life0 self, start: Bound<usize>, end: usize, ) -> Pin<Box<dyn Future<Output = FetchStream<VidCommonMetadata<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn get_transaction<'life0, 'async_trait>( &'life0 self, hash: TransactionHash<Types>, ) -> Pin<Box<dyn Future<Output = Fetch<TransactionQueryData<Types>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the transaction with the given hash.

Source

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

Provided Methods§

Source

fn subscribe_blocks<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, BlockQueryData<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_payloads<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, PayloadQueryData<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_payload_metadata<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, PayloadMetadata<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_leaves<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, LeafQueryData<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_headers<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, Header<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_vid_common<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, VidCommonQueryData<Types>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait, 'life0: 'async_trait,

Source

fn subscribe_vid_common_metadata<'life0, 'async_trait>( &'life0 self, from: usize, ) -> Pin<Box<dyn Future<Output = BoxStream<'static, VidCommonMetadata<Types>>> + Send + 'async_trait>>
where Self: Sync + '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<D, U, Types> AvailabilityDataSource<Types> for ExtensibleDataSource<D, U>
where D: AvailabilityDataSource<Types> + Send + Sync, U: Send + Sync, Types: NodeType, Header<Types>: QueryableHeader<Types>, Payload<Types>: QueryablePayload<Types>,

Source§

impl<Types, S, P> AvailabilityDataSource<Types> for FetchingDataSource<Types, S, P>
where Types: NodeType, Header<Types>: QueryableHeader<Types>, Payload<Types>: QueryablePayload<Types>, S: VersionedDataSource + 'static, for<'a> S::Transaction<'a>: UpdateAvailabilityStorage<Types>, for<'a> S::ReadOnly<'a>: AvailabilityStorage<Types> + NodeStorage<Types> + PrunedHeightStorage, P: AvailabilityProvider<Types>,