6 #ifndef KAGOME_STATE_API_IMPL_HPP 7 #define KAGOME_STATE_API_IMPL_HPP 25 MAX_BLOCK_RANGE_EXCEEDED = 1,
26 MAX_KEY_SET_SIZE_EXCEEDED,
27 END_BLOCK_LOWER_THAN_BEGIN_BLOCK
30 static constexpr
size_t kMaxBlockRange = 256;
31 static constexpr
size_t kMaxKeySetSize = 64;
33 StateApiImpl(std::shared_ptr<blockchain::BlockHeaderRepository> block_repo,
34 std::shared_ptr<const storage::trie::TrieStorage> trie_storage,
35 std::shared_ptr<blockchain::BlockTree> block_tree,
36 std::shared_ptr<runtime::Core> runtime_core,
37 std::shared_ptr<runtime::Metadata> metadata,
38 std::shared_ptr<runtime::RawExecutor> executor);
41 std::shared_ptr<api::ApiService>
const &api_service)
override;
43 outcome::result<common::Buffer> call(
44 std::string_view method,
46 const std::optional<primitives::BlockHash> &opt_at)
const override;
48 outcome::result<std::vector<common::Buffer>> getKeysPaged(
49 const std::optional<common::BufferView> &prefix,
51 const std::optional<common::BufferView> &prev_key,
52 const std::optional<primitives::BlockHash> &block_hash_opt)
55 outcome::result<std::optional<common::Buffer>> getStorage(
58 outcome::result<std::optional<common::Buffer>> getStorageAt(
62 outcome::result<std::vector<StorageChangeSet>> queryStorage(
63 gsl::span<const common::Buffer> keys,
65 std::optional<primitives::BlockHash> to)
const override;
67 outcome::result<std::vector<StorageChangeSet>> queryStorageAt(
68 gsl::span<const common::Buffer> keys,
69 std::optional<primitives::BlockHash> at)
const override;
71 outcome::result<uint32_t> subscribeStorage(
72 const std::vector<common::Buffer> &keys)
override;
74 outcome::result<bool> unsubscribeStorage(
75 const std::vector<uint32_t> &subscription_id)
override;
77 outcome::result<primitives::Version> getRuntimeVersion(
78 const std::optional<primitives::BlockHash> &at)
const override;
80 outcome::result<uint32_t> subscribeRuntimeVersion()
override;
81 outcome::result<void> unsubscribeRuntimeVersion(
82 uint32_t subscription_id)
override;
84 outcome::result<std::string> getMetadata()
override;
85 outcome::result<std::string> getMetadata(
86 std::string_view hex_block_hash)
override;
90 std::shared_ptr<const storage::trie::TrieStorage>
storage_;
103 #endif // KAGOME_STATE_API_IMPL_HPP Class represents arbitrary (including empty) byte buffer.
std::shared_ptr< runtime::Core > runtime_core_
OUTCOME_HPP_DECLARE_ERROR(kagome::api, StateApiImpl::Error)
std::shared_ptr< blockchain::BlockHeaderRepository > header_repo_
std::shared_ptr< blockchain::BlockTree > block_tree_
std::shared_ptr< runtime::Metadata > metadata_
std::shared_ptr< runtime::RawExecutor > executor_
std::weak_ptr< api::ApiService > api_service_
std::shared_ptr< const storage::trie::TrieStorage > storage_