pub trait StateNodeAdapter:
Send
+ Sync
+ 'static {
Show 17 methods
// Required methods
fn load_last_applied_mc_block_id(&self) -> Result<BlockId>;
fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
ref_by_mc_seqno: u32,
block_id: &'life1 BlockId,
hint: LoadStateHint,
) -> Pin<Box<dyn Future<Output = Result<ShardStateStuff>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn begin_store_next_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
prev_block_id: &'life1 BlockId,
block_id: &'life2 BlockId,
meta: NewBlockMeta,
merkle_update: &'life3 MerkleUpdate,
state: ShardStateStuff,
hint: StoreStateHint,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn InitiatedStoreState>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait;
fn load_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_block_by_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BlockHandle,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn load_block_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockHandle>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_ref_by_mc_seqno<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockSeqno>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn accept_block(&self, block: Arc<BlockStuffForSync>) -> Result<()>;
fn fill_shard_blocks_cache(
&self,
ref_by_mc_seqno: u32,
block: BlockStuff,
) -> Result<()>;
fn wait_for_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn wait_for_block_next<'life0, 'life1, 'async_trait>(
&'life0 self,
prev_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn handle_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
mc_block_id: &'life1 BlockId,
state: &'life2 ShardStateStuff,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn load_diff<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<QueueDiffStuff>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_sync_context(&self, sync_context: CollatorSyncContext);
fn load_init_block_id(&self) -> Option<BlockId>;
fn zerostate_id(&self) -> &ZerostateId;
fn shard_split_depth(&self) -> u8;
}Required Methods§
Sourcefn load_last_applied_mc_block_id(&self) -> Result<BlockId>
fn load_last_applied_mc_block_id(&self) -> Result<BlockId>
Return id of last master block that was applied to node local state
Sourcefn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
ref_by_mc_seqno: u32,
block_id: &'life1 BlockId,
hint: LoadStateHint,
) -> Pin<Box<dyn Future<Output = Result<ShardStateStuff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_state<'life0, 'life1, 'async_trait>(
&'life0 self,
ref_by_mc_seqno: u32,
block_id: &'life1 BlockId,
hint: LoadStateHint,
) -> Pin<Box<dyn Future<Output = Result<ShardStateStuff>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return master or shard state on specified block from node local state
Sourcefn begin_store_next_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
prev_block_id: &'life1 BlockId,
block_id: &'life2 BlockId,
meta: NewBlockMeta,
merkle_update: &'life3 MerkleUpdate,
state: ShardStateStuff,
hint: StoreStateHint,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn InitiatedStoreState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn begin_store_next_state<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
prev_block_id: &'life1 BlockId,
block_id: &'life2 BlockId,
meta: NewBlockMeta,
merkle_update: &'life3 MerkleUpdate,
state: ShardStateStuff,
hint: StoreStateHint,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn InitiatedStoreState>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Store shard state root in the storage.
Returns true when state was updated in storage.
Sourcefn load_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return block by its id from node local state
Sourcefn load_block_by_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BlockHandle,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_block_by_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
handle: &'life1 BlockHandle,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return block by its handle from node local state
Sourcefn load_block_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_block_handle<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockHandle>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return block handle by its id from node local state
Sourcefn get_ref_by_mc_seqno<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockSeqno>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_ref_by_mc_seqno<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<BlockSeqno>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return ref_by_mc_seqno from block handle by its id from node local state
Sourcefn accept_block(&self, block: Arc<BlockStuffForSync>) -> Result<()>
fn accept_block(&self, block: Arc<BlockStuffForSync>) -> Result<()>
Accept block:
- (TODO) Broadcast block to blockchain network
- Provide block to the block strider
Sourcefn fill_shard_blocks_cache(
&self,
ref_by_mc_seqno: u32,
block: BlockStuff,
) -> Result<()>
fn fill_shard_blocks_cache( &self, ref_by_mc_seqno: u32, block: BlockStuff, ) -> Result<()>
Fill the shard blocks cache is used for building new states by applying Merkle updates
Sourcefn wait_for_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn wait_for_block<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Waits for the specified block to be received and returns it
Sourcefn wait_for_block_next<'life0, 'life1, 'async_trait>(
&'life0 self,
prev_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn wait_for_block_next<'life0, 'life1, 'async_trait>(
&'life0 self,
prev_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Option<Result<BlockStuffAug>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Waits for the specified block by prev_id to be received and returns it
Sourcefn handle_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
mc_block_id: &'life1 BlockId,
state: &'life2 ShardStateStuff,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn handle_state<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
mc_block_id: &'life1 BlockId,
state: &'life2 ShardStateStuff,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Handle state after block was applied
Sourcefn load_diff<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<QueueDiffStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_diff<'life0, 'life1, 'async_trait>(
&'life0 self,
block_id: &'life1 BlockId,
) -> Pin<Box<dyn Future<Output = Result<Option<QueueDiffStuff>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Load queue diff
Sourcefn set_sync_context(&self, sync_context: CollatorSyncContext)
fn set_sync_context(&self, sync_context: CollatorSyncContext)
Handle sync context update