trienode

package
v0.0.0-...-6addec0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	Hash common.Hash // Node hash, empty for deleted node
	Blob []byte      // Encoded node blob, nil for the deleted node
}

Node is a wrapper which contains the encoded blob of the trie node and its unique hash identifier. It is general enough that can be used to represent trie nodes corresponding to different trie implementations.

func New

func New(hash common.Hash, blob []byte) *Node

New constructs a node with provided node information.

func (*Node) IsDeleted

func (n *Node) IsDeleted() bool

IsDeleted returns the indicator if the node is marked as deleted.

func (*Node) Size

func (n *Node) Size() int

Size returns the total memory size used by this node.

type WithPrev

type WithPrev struct {
	*Node
	Prev []byte // Encoded original value, nil means it's non-existent
}

WithPrev wraps the Node with the previous node value attached.

func NewWithPrev

func NewWithPrev(hash common.Hash, blob []byte, prev []byte) *WithPrev

NewWithPrev constructs a node with provided node information.

func (*WithPrev) Size

func (n *WithPrev) Size() int

Size returns the total memory size used by this node. It overloads the function in Node by counting the size of previous value as well.

func (*WithPrev) Unwrap

func (n *WithPrev) Unwrap() *Node

Unwrap returns the internal Node object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL