Kagome
Polkadot Runtime Engine in C++17
|
Namespaces | |
prefix | |
Classes | |
class | BlockHeaderRepository |
class | BlockHeaderRepositoryImpl |
class | BlockStorage |
class | BlockStorageImpl |
class | BlockTree |
class | BlockTreeImpl |
class | CachedTree |
class | DigestTracker |
class | DigestTrackerImpl |
class | JustificationStoragePolicy |
class | JustificationStoragePolicyImpl |
struct | TreeMeta |
class | TreeNode |
Typedefs | |
using | Buffer = common::Buffer |
using | Prefix = prefix::Prefix |
using | DatabaseError = kagome::storage::DatabaseError |
using | ReadableBufferStorage = storage::face::ReadableStorage< common::BufferView, common::Buffer > |
Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0
Copyright Soramitsu Co., Ltd. All Rights Reserved. SPDX-License-Identifier: Apache-2.0 Auxiliary functions to simplify usage of persistant map based storage as a Blockchain storage
Definition at line 17 of file block_storage_impl.cpp.
using kagome::blockchain::DatabaseError = typedef kagome::storage::DatabaseError |
Definition at line 30 of file block_tree_impl.cpp.
Definition at line 18 of file block_storage_impl.cpp.
using kagome::blockchain::ReadableBufferStorage = typedef storage::face::ReadableStorage<common::BufferView, common::Buffer> |
Definition at line 18 of file common.hpp.
|
strong |
Status of a block
Enumerator | |
---|---|
InChain | |
Unknown |
Definition at line 22 of file block_header_repository.hpp.
|
strong |
Enumerator | |
---|---|
BLOCK_EXISTS | |
HEADER_NOT_FOUND | |
GENESIS_BLOCK_ALREADY_EXISTS | |
GENESIS_BLOCK_NOT_FOUND | |
FINALIZED_BLOCK_NOT_FOUND | |
BLOCK_TREE_LEAVES_NOT_FOUND |
Definition at line 13 of file block_storage_error.hpp.
|
strong |
Errors of the block tree are here, so that other modules can use them, for example, to compare a received error with those
Definition at line 16 of file block_tree_error.hpp.
|
strong |
Errors that might occur during work with storage
Enumerator | |
---|---|
INVALID_KEY |
Definition at line 43 of file storage_util.hpp.
outcome::result< std::optional< common::Buffer > > kagome::blockchain::getWithPrefix | ( | const storage::BufferStorage & | storage, |
prefix::Prefix | prefix, | ||
const primitives::BlockId & | block_id | ||
) |
Get an entry from the database
storage | - to get the entry from |
prefix | - key space in the storage to which the entry belongs |
block_id | - id of the block to get entry for |
Definition at line 59 of file storage_util.cpp.
outcome::result< bool > kagome::blockchain::hasWithPrefix | ( | const storage::BufferStorage & | storage, |
prefix::Prefix | prefix, | ||
const primitives::BlockId & | block_id | ||
) |
Chech if an entry from the database
storage | - to get the entry from |
prefix | - key space in the storage to which the entry belongs |
block_id | - id of the block to get entry for |
Definition at line 51 of file storage_util.cpp.
outcome::result< std::optional< common::Buffer > > kagome::blockchain::idToLookupKey | ( | const ReadableBufferStorage & | map, |
const primitives::BlockId & | id | ||
) |
Convert a block ID into a key, which is a first part of a key, by which the columns are stored in the database
Definition at line 15 of file common.cpp.
outcome::result< primitives::BlockNumber > kagome::blockchain::lookupKeyToNumber | ( | const common::BufferView & | key | ) |
Convert lookup key to a block number
Definition at line 85 of file storage_util.cpp.
common::Buffer kagome::blockchain::numberAndHashToLookupKey | ( | primitives::BlockNumber | number, |
const common::Hash256 & | hash | ||
) |
Convert number and hash into long lookup key for blocks that are not in the canonical chain.
Definition at line 78 of file storage_util.cpp.
common::Buffer kagome::blockchain::numberToIndexKey | ( | primitives::BlockNumber | n | ) |
Convert block number into short lookup key (LE representation) for blocks that are in the canonical chain.
In the current database schema, this kind of key is only used for lookups into an index, NOT for storing header data or others.
Definition at line 68 of file storage_util.cpp.
common::Buffer kagome::blockchain::prependPrefix | ( | common::BufferView | key, |
prefix::Prefix | key_column | ||
) |
Concatenate
key_column | with |
key |
Definition at line 94 of file storage_util.cpp.
outcome::result< void > kagome::blockchain::putNumberToIndexKey | ( | storage::BufferStorage & | map, |
const primitives::BlockInfo & | block | ||
) |
Definition at line 28 of file storage_util.cpp.
outcome::result<void> kagome::blockchain::putWithPrefix | ( | storage::BufferStorage & | map, |
prefix::Prefix | prefix, | ||
BlockNumber | num, | ||
Hash256 | block_hash, | ||
const common::Buffer & | value | ||
) |
Definition at line 36 of file storage_util.cpp.
outcome::result<void> kagome::blockchain::putWithPrefix | ( | storage::BufferStorage & | map, |
prefix::Prefix | prefix, | ||
primitives::BlockNumber | num, | ||
common::Hash256 | block_hash, | ||
const common::Buffer & | value | ||
) |
Put an entry to key space
prefix | and corresponding lookup keys to ID_TO_LOOKUP_KEY space |
map | to put the entry to |
prefix | keyspace for the entry value |
num | block number that could be used to retrieve the value |
block_hash | block hash that could be used to retrieve the value |
value | data to be put to the storage |
storage::trie::RootHash kagome::blockchain::trieRoot | ( | const std::vector< std::pair< common::Buffer, common::Buffer >> & | key_vals | ) |
Instantiate empty merkle trie, insert
key_vals | pairs and |
Definition at line 32 of file common.cpp.