Kagome
Polkadot Runtime Engine in C++17
kagome::api::ChildStateApiImpl Class Referencefinal

#include <child_state_api_impl.hpp>

Inheritance diagram for kagome::api::ChildStateApiImpl:
Collaboration diagram for kagome::api::ChildStateApiImpl:

Public Member Functions

 ChildStateApiImpl (std::shared_ptr< blockchain::BlockHeaderRepository > block_repo, std::shared_ptr< const storage::trie::TrieStorage > trie_storage, std::shared_ptr< blockchain::BlockTree > block_tree, std::shared_ptr< runtime::Core > runtime_core, std::shared_ptr< runtime::Metadata > metadata)
 
void setApiService (const std::shared_ptr< api::ApiService > &api_service) override
 
outcome::result< std::vector< common::Buffer > > getKeys (const common::Buffer &child_storage_key, const std::optional< common::Buffer > &prefix_opt, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 Warning: This method is UNSAFE. Returns the keys from the specified child storage. The keys can also be filtered based on a prefix. More...
 
outcome::result< std::vector< common::Buffer > > getKeysPaged (const common::Buffer &child_storage_key, const std::optional< common::Buffer > &prefix_opt, uint32_t keys_amount, const std::optional< common::Buffer > &prev_key_opt, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 Warning: This method is UNSAFE. Returns the keys from the specified child storage. Paginated version of getKeys. The keys can also be filtered based on a prefix. More...
 
outcome::result< std::optional< common::Buffer > > getStorage (const common::Buffer &child_storage_key, const common::Buffer &key, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 Returns a child storage entry. More...
 
outcome::result< std::optional< primitives::BlockHash > > getStorageHash (const common::Buffer &child_storage_key, const common::Buffer &key, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 Returns the hash of a child storage entry. More...
 
outcome::result< std::optional< uint64_t > > getStorageSize (const common::Buffer &child_storage_key, const common::Buffer &key, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 Returns the size of a child storage entry. More...
 
- Public Member Functions inherited from kagome::api::ChildStateApi
virtual ~ChildStateApi ()=default
 

Private Attributes

std::shared_ptr< blockchain::BlockHeaderRepositoryheader_repo_
 
std::shared_ptr< const storage::trie::TrieStoragestorage_
 
std::shared_ptr< blockchain::BlockTreeblock_tree_
 
std::shared_ptr< runtime::Coreruntime_core_
 
std::weak_ptr< api::ApiServiceapi_service_
 
std::shared_ptr< runtime::Metadatametadata_
 

Detailed Description

Definition at line 18 of file child_state_api_impl.hpp.

Constructor & Destructor Documentation

kagome::api::ChildStateApiImpl::ChildStateApiImpl ( std::shared_ptr< blockchain::BlockHeaderRepository block_repo,
std::shared_ptr< const storage::trie::TrieStorage trie_storage,
std::shared_ptr< blockchain::BlockTree block_tree,
std::shared_ptr< runtime::Core runtime_core,
std::shared_ptr< runtime::Metadata metadata 
)

Definition at line 18 of file child_state_api_impl.cpp.

Member Function Documentation

outcome::result< std::vector< common::Buffer > > kagome::api::ChildStateApiImpl::getKeys ( const common::Buffer child_storage_key,
const std::optional< common::Buffer > &  prefix,
const std::optional< primitives::BlockHash > &  block_hash_opt 
) const
overridevirtual

Warning: This method is UNSAFE. Returns the keys from the specified child storage. The keys can also be filtered based on a prefix.

Parameters
child_storage_keyThe child storage key.
prefixThe prefix of the child storage keys to be filtered for. Leave empty ("") to return all child storage keys.
block_hash_opt(OPTIONAL) The block hash indicating the state. NULL implies the current state.
Returns
(OPTIONAL) Storage keys (Array)

Implements kagome::api::ChildStateApi.

Definition at line 42 of file child_state_api_impl.cpp.

outcome::result< std::vector< common::Buffer > > kagome::api::ChildStateApiImpl::getKeysPaged ( const common::Buffer child_storage_key,
const std::optional< common::Buffer > &  prefix,
uint32_t  keys_amount,
const std::optional< common::Buffer > &  prev_key_opt,
const std::optional< primitives::BlockHash > &  block_hash_opt 
) const
overridevirtual

Warning: This method is UNSAFE. Returns the keys from the specified child storage. Paginated version of getKeys. The keys can also be filtered based on a prefix.

Parameters
child_storage_keyThe child storage key.
prefixThe prefix of the child storage keys to be filtered for.
keys_amountResult page limit
prev_key_optLast reported key
block_hash_opt(OPTIONAL) The block hash indicating the state. NULL implies the current state.
Returns
(OPTIONAL) Storage keys (Array, up to keys_amount of size)

Implements kagome::api::ChildStateApi.

Definition at line 78 of file child_state_api_impl.cpp.

outcome::result< std::optional< common::Buffer > > kagome::api::ChildStateApiImpl::getStorage ( const common::Buffer child_storage_key,
const common::Buffer key,
const std::optional< primitives::BlockHash > &  block_hash_opt 
) const
overridevirtual

Returns a child storage entry.

Parameters
child_storage_keyThe child storage key.
keyThe key within the child storage.
block_hash_opt(OPTIONAL) The block hash indicating the state. NULL implies the current state.
Returns
(OPTIONAL) Storage data, if found.

Implements kagome::api::ChildStateApi.

Definition at line 126 of file child_state_api_impl.cpp.

outcome::result< std::optional< primitives::BlockHash > > kagome::api::ChildStateApiImpl::getStorageHash ( const common::Buffer child_storage_key,
const common::Buffer key,
const std::optional< primitives::BlockHash > &  block_hash_opt 
) const
overridevirtual

Returns the hash of a child storage entry.

Parameters
child_storage_keyThe child storage key.
keyThe key within the child storage.
block_hash_opt(OPTIONAL) The block hash indicating the state. NULL implies the current state.
Returns
(OPTIONAL) The hash of the child storage entry, if found.

Implements kagome::api::ChildStateApi.

Definition at line 145 of file child_state_api_impl.cpp.

outcome::result< std::optional< uint64_t > > kagome::api::ChildStateApiImpl::getStorageSize ( const common::Buffer child_storage_key,
const common::Buffer key,
const std::optional< primitives::BlockHash > &  block_hash_opt 
) const
overridevirtual

Returns the size of a child storage entry.

Parameters
child_storage_keyThe child storage key.
keyThe key within the child storage.
block_hash_opt(OPTIONAL) The block hash indicating the state. NULL implies the current state.
Returns
(OPTIONAL) The size of the storage entry in bytes, if found.

Implements kagome::api::ChildStateApi.

Definition at line 158 of file child_state_api_impl.cpp.

void kagome::api::ChildStateApiImpl::setApiService ( const std::shared_ptr< api::ApiService > &  api_service)
overridevirtual

Implements kagome::api::ChildStateApi.

Definition at line 36 of file child_state_api_impl.cpp.

Member Data Documentation

std::weak_ptr<api::ApiService> kagome::api::ChildStateApiImpl::api_service_
private

Definition at line 68 of file child_state_api_impl.hpp.

std::shared_ptr<blockchain::BlockTree> kagome::api::ChildStateApiImpl::block_tree_
private

Definition at line 65 of file child_state_api_impl.hpp.

std::shared_ptr<blockchain::BlockHeaderRepository> kagome::api::ChildStateApiImpl::header_repo_
private

Definition at line 63 of file child_state_api_impl.hpp.

std::shared_ptr<runtime::Metadata> kagome::api::ChildStateApiImpl::metadata_
private

Definition at line 69 of file child_state_api_impl.hpp.

std::shared_ptr<runtime::Core> kagome::api::ChildStateApiImpl::runtime_core_
private

Definition at line 66 of file child_state_api_impl.hpp.

std::shared_ptr<const storage::trie::TrieStorage> kagome::api::ChildStateApiImpl::storage_
private

Definition at line 64 of file child_state_api_impl.hpp.


The documentation for this class was generated from the following files: