Skip to content

sgns::storage::trie::SuperGeniusTrie

More...

#include <supergenius_trie.hpp>

Inherits from sgns::storage::face::GenericMap< base::Buffer, base::Buffer >, sgns::storage::face::ReadOnlyMap< K, V >, sgns::storage::face::Writeable< K, V >, sgns::storage::face::Iterable< K, V >, sgns::storage::face::Readable< K, V >

Inherited by sgns::storage::trie::SuperGeniusTrieImpl

Public Types

Name
using std::shared_ptr< SuperGeniusNode > NodePtr
using std::shared_ptr< BranchNode > BranchPtr

Public Functions

Name
virtual outcome::result< void > clearPrefix(const base::Buffer & prefix) =0
virtual NodePtr getRoot() const =0
virtual outcome::result< NodePtr > retrieveChild(BranchPtr parent, uint8_t idx) const =0
virtual outcome::result< NodePtr > getNode(NodePtr parent, const KeyNibbles & key_nibbles) const =0
virtual outcome::result< std::list< std::pair< BranchPtr, uint8_t > > > getPath(NodePtr parent, const KeyNibbles & key_nibbles) const =0

Additional inherited members

Public Functions inherited from sgns::storage::face::Writeable< K, V >

Name
virtual ~Writeable() =default
virtual outcome::result< void > put(const K & key, const V & value) =0
Store value by key.
virtual outcome::result< void > put(const K & key, V && value) =0
virtual outcome::result< void > remove(const K & key) =0
Remove value by key.

Public Functions inherited from sgns::storage::face::Iterable< K, V >

Name
virtual ~Iterable() =default
virtual std::unique_ptr< MapCursor< K, V > > cursor() =0
Returns new key-value iterator.

Public Functions inherited from sgns::storage::face::Readable< K, V >

Name
virtual ~Readable() =default
virtual outcome::result< V > get(const K & key) const =0
Get value by key.
virtual bool contains(const K & key) const =0
Returns true if given key-value binding exists in the storage.
virtual bool empty() const =0
Returns true if the storage is empty.

Detailed Description

class sgns::storage::trie::SuperGeniusTrie;

For specification see SuperGenius Runtime Environment Protocol Specification '2.1.2 The General Tree Structure' and further

Public Types Documentation

using NodePtr

using sgns::storage::trie::SuperGeniusTrie::NodePtr = std::shared_ptr<SuperGeniusNode>;

using BranchPtr

using sgns::storage::trie::SuperGeniusTrie::BranchPtr = std::shared_ptr<BranchNode>;

Public Functions Documentation

function clearPrefix

virtual outcome::result< void > clearPrefix(
    const base::Buffer & prefix
) =0

Reimplemented by: sgns::storage::trie::SuperGeniusTrieImpl::clearPrefix

Remove all trie entries which key begins with the supplied prefix

function getRoot

virtual NodePtr getRoot() const =0

Return: the root node of the trie

Reimplemented by: sgns::storage::trie::SuperGeniusTrieImpl::getRoot

function retrieveChild

virtual outcome::result< NodePtr > retrieveChild(
    BranchPtr parent,
    uint8_t idx
) const =0

Parameters:

  • parent Parent branch node
  • idx Child index in the branch

Return: a child node pointer of a provided parent node at the given index

Reimplemented by: sgns::storage::trie::SuperGeniusTrieImpl::retrieveChild

function getNode

virtual outcome::result< NodePtr > getNode(
    NodePtr parent,
    const KeyNibbles & key_nibbles
) const =0

Return: a node which is a descendant of

  • parent found by following
  • key_nibbles

Reimplemented by: sgns::storage::trie::SuperGeniusTrieImpl::getNode

function getPath

virtual outcome::result< std::list< std::pair< BranchPtr, uint8_t > > > getPath(
    NodePtr parent,
    const KeyNibbles & key_nibbles
) const =0

Return: a sequence of nodes in between

  • parent and the node found by following
  • key_nibbles. The parent is included, the end node isn't.

Reimplemented by: sgns::storage::trie::SuperGeniusTrieImpl::getPath


Updated on 2026-04-15 at 11:00:39 -0700