Skip to content

sgns::storage::trie::TrieStorage

More...

#include <trie_storage.hpp>

Inherits from IComponent

Inherited by sgns::storage::trie::TrieStorageImpl

Public Functions

Name
~TrieStorage() override =default
virtual outcome::result< std::unique_ptr< PersistentTrieBatch > > getPersistentBatch() =0
virtual outcome::result< std::unique_ptr< EphemeralTrieBatch > > getEphemeralBatch() const =0
virtual outcome::result< std::unique_ptr< PersistentTrieBatch > > getPersistentBatchAt(const base::Hash256 & root) =0
virtual outcome::result< std::unique_ptr< EphemeralTrieBatch > > getEphemeralBatchAt(const base::Hash256 & root) const =0
virtual base::Buffer getRootHash() const =0

Additional inherited members

Public Functions inherited from IComponent

Name
virtual ~IComponent() =default
virtual std::string GetName() =0

Detailed Description

class sgns::storage::trie::TrieStorage;

Grants access to the storage in two ways:

  • persistent batch that will written back to the storage after commit() call
  • ephemeral batch, all changes to which are left in memory and thus the main storage is never changed by it

Public Functions Documentation

function ~TrieStorage

~TrieStorage() override =default

function getPersistentBatch

virtual outcome::result< std::unique_ptr< PersistentTrieBatch > > getPersistentBatch() =0

Reimplemented by: sgns::storage::trie::TrieStorageImpl::getPersistentBatch

function getEphemeralBatch

virtual outcome::result< std::unique_ptr< EphemeralTrieBatch > > getEphemeralBatch() const =0

Reimplemented by: sgns::storage::trie::TrieStorageImpl::getEphemeralBatch

function getPersistentBatchAt

virtual outcome::result< std::unique_ptr< PersistentTrieBatch > > getPersistentBatchAt(
    const base::Hash256 & root
) =0

Warning: if the batch is committed, the trie will still switch to its state, creating a 'fork'

Reimplemented by: sgns::storage::trie::TrieStorageImpl::getPersistentBatchAt

Initializes a batch at the provided state

function getEphemeralBatchAt

virtual outcome::result< std::unique_ptr< EphemeralTrieBatch > > getEphemeralBatchAt(
    const base::Hash256 & root
) const =0

Reimplemented by: sgns::storage::trie::TrieStorageImpl::getEphemeralBatchAt

function getRootHash

virtual base::Buffer getRootHash() const =0

Reimplemented by: sgns::storage::trie::TrieStorageImpl::getRootHash

Root hash of the latest committed trie


Updated on 2026-03-04 at 13:10:44 -0800