Skip to content

sgns::storage::changes_trie::ChangesTracker

More...

#include <changes_tracker.hpp>

Inherits from IComponent

Inherited by sgns::storage::changes_trie::StorageChangesTrackerImpl

Public Types

Name
using std::function< outcome::result< base::Buffer >()> GetExtrinsicIndexDelegate

Public Functions

Name
~ChangesTracker() override =default
virtual void setExtrinsicIdxGetter(GetExtrinsicIndexDelegate f) =0
virtual outcome::result< void > onBlockChange(primitives::BlockHash new_parent_hash, primitives::BlockNumber new_parent_number) =0
virtual outcome::result< void > onPut(const base::Buffer & key, const base::Buffer & value, bool new_entry) =0
virtual outcome::result< void > onRemove(const base::Buffer & key) =0
virtual outcome::result< base::Hash256 > constructChangesTrie(const primitives::BlockHash & parent, const ChangesTrieConfig & conf) =0

Additional inherited members

Public Functions inherited from IComponent

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

Detailed Description

class sgns::storage::changes_trie::ChangesTracker;

Stores the information about changes to the storage in accordance with the supplied config. Used to build the changes trie. onChange() must be called every time a persistent change to the node storage is made.

Public Types Documentation

using GetExtrinsicIndexDelegate

using sgns::storage::changes_trie::ChangesTracker::GetExtrinsicIndexDelegate = 
std::function<outcome::result<base::Buffer>()>;

Public Functions Documentation

function ~ChangesTracker

~ChangesTracker() override =default

function setExtrinsicIdxGetter

virtual void setExtrinsicIdxGetter(
    GetExtrinsicIndexDelegate f
) =0

Parameters:

  • f is a functor that returns the current extrinsic index

Reimplemented by: sgns::storage::changes_trie::StorageChangesTrackerImpl::setExtrinsicIdxGetter

function onBlockChange

virtual outcome::result< void > onBlockChange(
    primitives::BlockHash new_parent_hash,
    primitives::BlockNumber new_parent_number
) =0

Reimplemented by: sgns::storage::changes_trie::StorageChangesTrackerImpl::onBlockChange

Supposed to be called when the processed block changes

function onPut

virtual outcome::result< void > onPut(
    const base::Buffer & key,
    const base::Buffer & value,
    bool new_entry
) =0

Reimplemented by: sgns::storage::changes_trie::StorageChangesTrackerImpl::onPut

Supposed to be called when an entry is put into the tracked storage

  • new_entry states whether the entry is new, or just an update of a present value

function onRemove

virtual outcome::result< void > onRemove(
    const base::Buffer & key
) =0

Reimplemented by: sgns::storage::changes_trie::StorageChangesTrackerImpl::onRemove

Supposed to be called when an entry is removed from the tracked storage

function constructChangesTrie

virtual outcome::result< base::Hash256 > constructChangesTrie(
    const primitives::BlockHash & parent,
    const ChangesTrieConfig & conf
) =0

Reimplemented by: sgns::storage::changes_trie::StorageChangesTrackerImpl::constructChangesTrie

Sinks accumulated changes for the latest registered block to the changes trie and returns its root hash


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