16 outcome::result<std::unique_ptr<TrieStorageImpl>>
18 const std::shared_ptr<PolkadotTrieFactory> &trie_factory,
19 std::shared_ptr<Codec> codec,
20 std::shared_ptr<TrieSerializer> serializer,
21 std::optional<std::shared_ptr<changes_trie::ChangesTracker>> changes) {
24 trie_factory->createEmpty([](
auto &) {
return outcome::success(); });
26 OUTCOME_TRY(serializer->storeTrie(*empty_trie));
28 std::move(codec), std::move(serializer), std::move(changes)));
31 outcome::result<std::unique_ptr<TrieStorageImpl>>
33 std::shared_ptr<Codec> codec,
34 std::shared_ptr<TrieSerializer> serializer,
35 std::optional<std::shared_ptr<changes_trie::ChangesTracker>> changes) {
37 std::move(codec), std::move(serializer), std::move(changes)));
41 std::shared_ptr<Codec> codec,
42 std::shared_ptr<TrieSerializer> serializer,
43 std::optional<std::shared_ptr<changes_trie::ChangesTracker>> changes)
44 :
codec_{std::move(codec)},
48 BOOST_ASSERT(
codec_ !=
nullptr);
54 outcome::result<std::unique_ptr<PersistentTrieBatch>>
57 "Initialize persistent trie batch with root: {}",
64 outcome::result<std::unique_ptr<EphemeralTrieBatch>>
67 logger_,
"Initialize ephemeral trie batch with root: {}", root.
toHex());
69 return std::make_unique<EphemeralTrieBatchImpl>(
codec_, std::move(trie));
Class represents arbitrary (including empty) byte buffer.
TrieStorageImpl(TrieStorageImpl const &)=delete
static outcome::result< std::unique_ptr< TrieStorageImpl > > createFromStorage(std::shared_ptr< Codec > codec, std::shared_ptr< TrieSerializer > serializer, std::optional< std::shared_ptr< changes_trie::ChangesTracker >> changes)
std::shared_ptr< TrieSerializer > serializer_
outcome::result< std::unique_ptr< EphemeralTrieBatch > > getEphemeralBatchAt(const RootHash &root) const override
std::shared_ptr< Codec > codec_
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::string toHex() const noexcept
outcome::result< std::unique_ptr< PersistentTrieBatch > > getPersistentBatchAt(const RootHash &root) override
static outcome::result< std::unique_ptr< TrieStorageImpl > > createEmpty(const std::shared_ptr< PolkadotTrieFactory > &trie_factory, std::shared_ptr< Codec > codec, std::shared_ptr< TrieSerializer > serializer, std::optional< std::shared_ptr< changes_trie::ChangesTracker >> changes)
std::optional< std::shared_ptr< changes_trie::ChangesTracker > > changes_
Logger createLogger(const std::string &tag)