pub trait Indexer:
Send
+ Sync
+ 'static {
type ChainTipChangeStream: Stream<Item = Result<BlockHashAndHeight, Status>> + Send + 'static;
type NonFinalizedStateChangeStream: Stream<Item = Result<BlockAndHash, Status>> + Send + 'static;
type MempoolChangeStream: Stream<Item = Result<MempoolChangeMessage, Status>> + Send + 'static;
// Required methods
fn chain_tip_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::ChainTipChangeStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn non_finalized_state_change<'life0, 'async_trait>(
&'life0 self,
request: Request<NonFinalizedStateChangeRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::NonFinalizedStateChangeStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn mempool_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::MempoolChangeStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_block<'life0, 'async_trait>(
&'life0 self,
request: Request<BlockRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<BlockAndHash>, Status>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Generated trait containing gRPC methods that should be implemented for use with IndexerServer.
Required Associated Types§
Sourcetype ChainTipChangeStream: Stream<Item = Result<BlockHashAndHeight, Status>> + Send + 'static
type ChainTipChangeStream: Stream<Item = Result<BlockHashAndHeight, Status>> + Send + 'static
Server streaming response type for the ChainTipChange method.
Sourcetype NonFinalizedStateChangeStream: Stream<Item = Result<BlockAndHash, Status>> + Send + 'static
type NonFinalizedStateChangeStream: Stream<Item = Result<BlockAndHash, Status>> + Send + 'static
Server streaming response type for the NonFinalizedStateChange method.
Sourcetype MempoolChangeStream: Stream<Item = Result<MempoolChangeMessage, Status>> + Send + 'static
type MempoolChangeStream: Stream<Item = Result<MempoolChangeMessage, Status>> + Send + 'static
Server streaming response type for the MempoolChange method.
Required Methods§
Sourcefn chain_tip_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::ChainTipChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn chain_tip_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::ChainTipChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notifies listeners of chain tip changes
Sourcefn non_finalized_state_change<'life0, 'async_trait>(
&'life0 self,
request: Request<NonFinalizedStateChangeRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::NonFinalizedStateChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn non_finalized_state_change<'life0, 'async_trait>(
&'life0 self,
request: Request<NonFinalizedStateChangeRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::NonFinalizedStateChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notifies listeners of new blocks in the non-finalized state.
Callers may provide the hashes of the chain tips they already have so the server only streams blocks after those tips. An empty request streams every block currently in the non-finalized state.
Sourcefn mempool_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::MempoolChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn mempool_change<'life0, 'async_trait>(
&'life0 self,
request: Request<Empty>,
) -> Pin<Box<dyn Future<Output = Result<Response<Self::MempoolChangeStream>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Notifies listeners of mempool changes
Sourcefn get_block<'life0, 'async_trait>(
&'life0 self,
request: Request<BlockRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<BlockAndHash>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block<'life0, 'async_trait>(
&'life0 self,
request: Request<BlockRequest>,
) -> Pin<Box<dyn Future<Output = Result<Response<BlockAndHash>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns the block with the given hash or height from the best chain.
Used by a syncer to fetch finalized blocks that bridge the gap between its local finalized tip and the start of the streamed non-finalized chain.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".