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

#include <state_api_impl.hpp>

Inheritance diagram for kagome::api::StateApiImpl:
Collaboration diagram for kagome::api::StateApiImpl:

Public Types

enum  Error { Error::MAX_BLOCK_RANGE_EXCEEDED = 1, Error::MAX_KEY_SET_SIZE_EXCEEDED, Error::END_BLOCK_LOWER_THAN_BEGIN_BLOCK }
 

Public Member Functions

 StateApiImpl (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, std::shared_ptr< runtime::RawExecutor > executor)
 
void setApiService (std::shared_ptr< api::ApiService > const &api_service) override
 
outcome::result< common::Buffercall (std::string_view method, common::Buffer data, const std::optional< primitives::BlockHash > &opt_at) const override
 
outcome::result< std::vector< common::Buffer > > getKeysPaged (const std::optional< common::BufferView > &prefix, uint32_t keys_amount, const std::optional< common::BufferView > &prev_key, const std::optional< primitives::BlockHash > &block_hash_opt) const override
 
outcome::result< std::optional< common::Buffer > > getStorage (const common::BufferView &key) const override
 
outcome::result< std::optional< common::Buffer > > getStorageAt (const common::BufferView &key, const primitives::BlockHash &at) const override
 
outcome::result< std::vector< StorageChangeSet > > queryStorage (gsl::span< const common::Buffer > keys, const primitives::BlockHash &from, std::optional< primitives::BlockHash > to) const override
 
outcome::result< std::vector< StorageChangeSet > > queryStorageAt (gsl::span< const common::Buffer > keys, std::optional< primitives::BlockHash > at) const override
 
outcome::result< uint32_t > subscribeStorage (const std::vector< common::Buffer > &keys) override
 
outcome::result< bool > unsubscribeStorage (const std::vector< uint32_t > &subscription_id) override
 
outcome::result< primitives::VersiongetRuntimeVersion (const std::optional< primitives::BlockHash > &at) const override
 
outcome::result< uint32_t > subscribeRuntimeVersion () override
 
outcome::result< void > unsubscribeRuntimeVersion (uint32_t subscription_id) override
 
outcome::result< std::string > getMetadata () override
 
outcome::result< std::string > getMetadata (std::string_view hex_block_hash) override
 
- Public Member Functions inherited from kagome::api::StateApi
virtual ~StateApi ()=default
 

Static Public Attributes

static constexpr size_t kMaxBlockRange = 256
 
static constexpr size_t kMaxKeySetSize = 64
 

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_
 
std::shared_ptr< runtime::RawExecutorexecutor_
 

Detailed Description

Definition at line 22 of file state_api_impl.hpp.

Member Enumeration Documentation

Enumerator
MAX_BLOCK_RANGE_EXCEEDED 
MAX_KEY_SET_SIZE_EXCEEDED 
END_BLOCK_LOWER_THAN_BEGIN_BLOCK 

Definition at line 24 of file state_api_impl.hpp.

Constructor & Destructor Documentation

kagome::api::StateApiImpl::StateApiImpl ( 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,
std::shared_ptr< runtime::RawExecutor executor 
)

Definition at line 38 of file state_api_impl.cpp.

Member Function Documentation

outcome::result< common::Buffer > kagome::api::StateApiImpl::call ( std::string_view  method,
common::Buffer  data,
const std::optional< primitives::BlockHash > &  opt_at 
) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 65 of file state_api_impl.cpp.

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

Implements kagome::api::StateApi.

Definition at line 74 of file state_api_impl.cpp.

outcome::result< std::string > kagome::api::StateApiImpl::getMetadata ( )
overridevirtual

Implements kagome::api::StateApi.

Definition at line 241 of file state_api_impl.cpp.

outcome::result< std::string > kagome::api::StateApiImpl::getMetadata ( std::string_view  hex_block_hash)
overridevirtual

Implements kagome::api::StateApi.

Definition at line 246 of file state_api_impl.cpp.

outcome::result< primitives::Version > kagome::api::StateApiImpl::getRuntimeVersion ( const std::optional< primitives::BlockHash > &  at) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 194 of file state_api_impl.cpp.

outcome::result< std::optional< common::Buffer > > kagome::api::StateApiImpl::getStorage ( const common::BufferView key) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 116 of file state_api_impl.cpp.

outcome::result< std::optional< common::Buffer > > kagome::api::StateApiImpl::getStorageAt ( const common::BufferView key,
const primitives::BlockHash at 
) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 122 of file state_api_impl.cpp.

outcome::result< std::vector< StateApiImpl::StorageChangeSet > > kagome::api::StateApiImpl::queryStorage ( gsl::span< const common::Buffer keys,
const primitives::BlockHash from,
std::optional< primitives::BlockHash to 
) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 132 of file state_api_impl.cpp.

outcome::result< std::vector< StateApiImpl::StorageChangeSet > > kagome::api::StateApiImpl::queryStorageAt ( gsl::span< const common::Buffer keys,
std::optional< primitives::BlockHash at 
) const
overridevirtual

Implements kagome::api::StateApi.

Definition at line 186 of file state_api_impl.cpp.

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

Implements kagome::api::StateApi.

Definition at line 59 of file state_api_impl.cpp.

outcome::result< uint32_t > kagome::api::StateApiImpl::subscribeRuntimeVersion ( )
overridevirtual

Implements kagome::api::StateApi.

Definition at line 221 of file state_api_impl.cpp.

outcome::result< uint32_t > kagome::api::StateApiImpl::subscribeStorage ( const std::vector< common::Buffer > &  keys)
overridevirtual

Implements kagome::api::StateApi.

Definition at line 202 of file state_api_impl.cpp.

outcome::result< void > kagome::api::StateApiImpl::unsubscribeRuntimeVersion ( uint32_t  subscription_id)
overridevirtual

Implements kagome::api::StateApi.

Definition at line 230 of file state_api_impl.cpp.

outcome::result< bool > kagome::api::StateApiImpl::unsubscribeStorage ( const std::vector< uint32_t > &  subscription_id)
overridevirtual

Implements kagome::api::StateApi.

Definition at line 212 of file state_api_impl.cpp.

Member Data Documentation

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

Definition at line 94 of file state_api_impl.hpp.

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

Definition at line 91 of file state_api_impl.hpp.

std::shared_ptr<runtime::RawExecutor> kagome::api::StateApiImpl::executor_
private

Definition at line 96 of file state_api_impl.hpp.

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

Definition at line 89 of file state_api_impl.hpp.

constexpr size_t kagome::api::StateApiImpl::kMaxBlockRange = 256
static

Definition at line 30 of file state_api_impl.hpp.

constexpr size_t kagome::api::StateApiImpl::kMaxKeySetSize = 64
static

Definition at line 31 of file state_api_impl.hpp.

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

Definition at line 95 of file state_api_impl.hpp.

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

Definition at line 92 of file state_api_impl.hpp.

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

Definition at line 90 of file state_api_impl.hpp.


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