6 #ifndef KAGOME_STORAGE_TRIE_IMPL_PERSISTENT_TRIE_BATCH 7 #define KAGOME_STORAGE_TRIE_IMPL_PERSISTENT_TRIE_BATCH 26 static std::unique_ptr<PersistentTrieBatchImpl>
create(
27 std::shared_ptr<Codec> codec,
28 std::shared_ptr<TrieSerializer> serializer,
29 std::optional<std::shared_ptr<changes_trie::ChangesTracker>> changes,
30 std::shared_ptr<PolkadotTrie> trie);
33 outcome::result<RootHash>
commit()
override;
34 std::unique_ptr<TopperTrieBatch>
batchOnTop()
override;
36 outcome::result<BufferConstRef>
get(
const BufferView &key)
const override;
37 outcome::result<std::optional<BufferConstRef>>
tryGet(
39 std::unique_ptr<PolkadotTrieCursor>
trieCursor()
override;
41 bool empty()
const override;
42 outcome::result<std::tuple<bool, uint32_t>>
clearPrefix(
44 std::optional<uint64_t> limit = std::nullopt)
override;
46 const Buffer &value)
override;
48 outcome::result<void>
remove(
const BufferView &key)
override;
52 std::shared_ptr<Codec> codec,
53 std::shared_ptr<TrieSerializer> serializer,
54 std::optional<std::shared_ptr<changes_trie::ChangesTracker>> changes,
55 std::shared_ptr<PolkadotTrie> trie);
59 std::optional<std::shared_ptr<changes_trie::ChangesTracker>>
changes_;
60 std::shared_ptr<PolkadotTrie>
trie_;
70 #endif // KAGOME_STORAGE_TRIE_IMPL_PERSISTENT_TRIE_BATCH Class represents arbitrary (including empty) byte buffer.
PersistentTrieBatchImpl(std::shared_ptr< Codec > codec, std::shared_ptr< TrieSerializer > serializer, std::optional< std::shared_ptr< changes_trie::ChangesTracker >> changes, std::shared_ptr< PolkadotTrie > trie)
std::unique_ptr< TopperTrieBatch > batchOnTop() override
std::shared_ptr< TrieSerializer > serializer_
bool empty() const override
Returns true if the storage is empty.
static std::unique_ptr< PersistentTrieBatchImpl > create(std::shared_ptr< Codec > codec, std::shared_ptr< TrieSerializer > serializer, std::optional< std::shared_ptr< changes_trie::ChangesTracker >> changes, std::shared_ptr< PolkadotTrie > trie)
std::shared_ptr< PolkadotTrie > trie_
outcome::result< RootHash > commit() override
std::unique_ptr< PolkadotTrieCursor > trieCursor() override
outcome::result< std::tuple< bool, uint32_t > > clearPrefix(const BufferView &prefix, std::optional< uint64_t > limit=std::nullopt) override
outcome::result< void > put(const BufferView &key, const Buffer &value) override
Store value by key.
std::shared_ptr< soralog::Logger > Logger
outcome::result< std::optional< BufferConstRef > > tryGet(const BufferView &key) const override
Get value by key.
std::shared_ptr< Codec > codec_
~PersistentTrieBatchImpl() override=default
outcome::result< bool > contains(const BufferView &key) const override
Checks if given key-value binding exists in the storage.
OUTCOME_HPP_DECLARE_ERROR(kagome::storage::trie, PersistentTrieBatchImpl::Error)
Logger createLogger(const std::string &tag)
std::optional< std::shared_ptr< changes_trie::ChangesTracker > > changes_