Kagome
Polkadot Runtime Engine in C++17
|
#include <block_storage_impl.hpp>
Public Member Functions | |
~BlockStorageImpl () override=default | |
outcome::result< std::vector< primitives::BlockHash > > | getBlockTreeLeaves () const override |
outcome::result< void > | setBlockTreeLeaves (std::vector< primitives::BlockHash > leaves) override |
outcome::result< bool > | hasBlockHeader (const primitives::BlockId &id) const override |
Check if header existing by provided block {. More... | |
outcome::result< std::optional< primitives::BlockHeader > > | getBlockHeader (const primitives::BlockId &id) const override |
outcome::result< std::optional< primitives::BlockBody > > | getBlockBody (const primitives::BlockId &id) const override |
outcome::result< std::optional< primitives::BlockData > > | getBlockData (const primitives::BlockId &id) const override |
outcome::result< std::optional< primitives::Justification > > | getJustification (const primitives::BlockId &block) const override |
outcome::result< void > | putNumberToIndexKey (const primitives::BlockInfo &block) override |
outcome::result< primitives::BlockHash > | putBlockHeader (const primitives::BlockHeader &header) override |
outcome::result< void > | putBlockData (primitives::BlockNumber block_number, const primitives::BlockData &block_data) override |
outcome::result< void > | removeBlockData (primitives::BlockNumber block_number, const primitives::BlockDataFlags &remove_flags) override |
outcome::result< primitives::BlockHash > | putBlock (const primitives::Block &block) override |
outcome::result< void > | putJustification (const primitives::Justification &j, const primitives::BlockHash &hash, primitives::BlockNumber number) override |
outcome::result< void > | removeJustification (const primitives::BlockHash &hash, primitives::BlockNumber number) override |
outcome::result< void > | removeBlock (const primitives::BlockInfo &block) override |
outcome::result< primitives::BlockInfo > | getLastFinalized () const override |
Public Member Functions inherited from kagome::blockchain::BlockStorage | |
virtual | ~BlockStorage ()=default |
Static Public Member Functions | |
static outcome::result< std::shared_ptr< BlockStorageImpl > > | create (storage::trie::RootHash state_root, const std::shared_ptr< storage::BufferStorage > &storage, const std::shared_ptr< crypto::Hasher > &hasher) |
Private Member Functions | |
BlockStorageImpl (std::shared_ptr< storage::BufferStorage > storage, std::shared_ptr< crypto::Hasher > hasher) | |
Private Attributes | |
std::shared_ptr< storage::BufferStorage > | storage_ |
std::shared_ptr< crypto::Hasher > | hasher_ |
log::Logger | logger_ |
std::optional< std::vector< primitives::BlockHash > > | block_tree_leaves_ |
Definition at line 18 of file block_storage_impl.hpp.
|
overridedefault |
|
private |
Definition at line 20 of file block_storage_impl.cpp.
|
static |
Creates block storage. Iff block storage is empty, then initializes with a genesis block which is created automatically from merkle trie root
state_root | merkle root of genesis state |
storage | underlying storage (must be empty) |
hasher | a hasher instance |
Definition at line 30 of file block_storage_impl.cpp.
|
overridevirtual |
Tries to get block body by {
id} |
Implements kagome::blockchain::BlockStorage.
Definition at line 80 of file block_storage_impl.cpp.
|
overridevirtual |
Tries to get block data by {
id} |
Implements kagome::blockchain::BlockStorage.
Definition at line 89 of file block_storage_impl.cpp.
|
overridevirtual |
Tries to get block header by {
id} |
Implements kagome::blockchain::BlockStorage.
Definition at line 67 of file block_storage_impl.cpp.
|
overridevirtual |
Obtains leaves of block tree
Implements kagome::blockchain::BlockStorage.
Definition at line 298 of file block_storage_impl.cpp.
|
overridevirtual |
Tries to get justification of block finality by {
id} |
Implements kagome::blockchain::BlockStorage.
Definition at line 102 of file block_storage_impl.cpp.
|
overridevirtual |
Get the last finalized block
Implements kagome::blockchain::BlockStorage.
Definition at line 334 of file block_storage_impl.cpp.
|
overridevirtual |
Check if header existing by provided block {.
id} |
Implements kagome::blockchain::BlockStorage.
Definition at line 61 of file block_storage_impl.cpp.
|
overridevirtual |
Saves {
block} | to block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 206 of file block_storage_impl.cpp.
|
overridevirtual |
Saves {
data} | of block with { |
number} | to block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 129 of file block_storage_impl.cpp.
|
overridevirtual |
Saves block header {
header} | to block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 117 of file block_storage_impl.cpp.
|
overridevirtual |
Saves {
justification} | of block with { |
number} | and { |
hash} | to block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 224 of file block_storage_impl.cpp.
|
overridevirtual |
Saves number-to-block_lookup_key for {
block} | to block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 111 of file block_storage_impl.cpp.
|
overridevirtual |
Removes all data of block {
block} | from block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 243 of file block_storage_impl.cpp.
|
overridevirtual |
Removes data parts from storage
Implements kagome::blockchain::BlockStorage.
Definition at line 166 of file block_storage_impl.cpp.
|
overridevirtual |
Removes {
justification} | of block with { |
number} | and { |
hash} | from block storage |
Implements kagome::blockchain::BlockStorage.
Definition at line 234 of file block_storage_impl.cpp.
|
overridevirtual |
Saves provided block tree {
leaves} |
Implements kagome::blockchain::BlockStorage.
Definition at line 318 of file block_storage_impl.cpp.
|
mutableprivate |
Definition at line 87 of file block_storage_impl.hpp.
|
private |
Definition at line 83 of file block_storage_impl.hpp.
|
private |
Definition at line 84 of file block_storage_impl.hpp.
|
private |
Definition at line 82 of file block_storage_impl.hpp.