pub trait ChainStore {
Show 13 methods
// Required methods
async fn load_state(
&self,
) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>;
async fn load_partial_state(
&self,
) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>;
async fn block(&self, height: u64) -> Result<Option<Vec<u8>>, ChainError>;
async fn blocks_from(&self) -> Result<u64, ChainError>;
async fn proof(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>;
async fn proofs_tip(&self) -> Result<u32, ChainError>;
async fn voters(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>;
async fn put_proof(
&self,
epoch: u32,
proof: &[u8],
) -> Result<(), ChainError>;
async fn commit_block(
&self,
write: BlockWrite<'_>,
) -> Result<(), ChainError>;
async fn prune(&self, prune: Prune) -> Result<Pruned, ChainError>;
async fn checkpoint_at_or_below(
&self,
height: u64,
) -> Result<Option<(u64, Vec<u8>)>, ChainError>;
async fn changes_above(
&self,
height: u64,
) -> Result<Vec<Change>, ChainError>;
async fn rollback(
&self,
height: u64,
voters_from: u32,
orphans: &[(u64, [u8; 32], &[u8])],
) -> Result<(), ChainError>;
}Expand description
先端の段階が使う保存の口
Required Methods§
Sourceasync fn load_state(
&self,
) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>
async fn load_state( &self, ) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>
実行の状態(木に入らないもの)、状態の行、木のノード。始めるときと、巻き戻しに失敗して読み直すときに使う
Sourceasync fn load_partial_state(
&self,
) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>
async fn load_partial_state( &self, ) -> Result<(Vec<u8>, Vec<StateRow>, Vec<StateRow>), ChainError>
ChainStore::load_state の、アカウントの行を除いたもの。アカウントを全部はメモリに持たないときに使う
async fn block(&self, height: u64) -> Result<Option<Vec<u8>>, ChainError>
Sourceasync fn blocks_from(&self) -> Result<u64, ChainError>
async fn blocks_from(&self) -> Result<u64, ChainError>
残っている一番低いブロックの高さ(刈り込んでいなければ 0)
async fn proof(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>
Sourceasync fn proofs_tip(&self) -> Result<u32, ChainError>
async fn proofs_tip(&self) -> Result<u32, ChainError>
しまった一番新しい証明のエポック(なければ 0)
async fn voters(&self, epoch: u32) -> Result<Option<Vec<u8>>, ChainError>
async fn put_proof(&self, epoch: u32, proof: &[u8]) -> Result<(), ChainError>
Sourceasync fn commit_block(&self, write: BlockWrite<'_>) -> Result<(), ChainError>
async fn commit_block(&self, write: BlockWrite<'_>) -> Result<(), ChainError>
ブロック1つ分を書いてコミットする。孤立ブロックの表にあれば外す
async fn prune(&self, prune: Prune) -> Result<Pruned, ChainError>
Sourceasync fn checkpoint_at_or_below(
&self,
height: u64,
) -> Result<Option<(u64, Vec<u8>)>, ChainError>
async fn checkpoint_at_or_below( &self, height: u64, ) -> Result<Option<(u64, Vec<u8>)>, ChainError>
height 以下で一番新しいチェックポイント(高さ、実行の状態)
Sourceasync fn changes_above(&self, height: u64) -> Result<Vec<Change>, ChainError>
async fn changes_above(&self, height: u64) -> Result<Vec<Change>, ChainError>
height より上で変わった状態の行の、height のときの値
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".