node

package
v0.0.0-...-0a037ed Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyNodeRaw     = []byte{}
	EmptyNodeHash, _ = hex.DecodeString("56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421")
)

Functions

func Hash

func Hash(node Node) []byte

func IsEmptyNode

func IsEmptyNode(node Node) bool

func Serialize

func Serialize(node Node) []byte

Types

type BranchNode

type BranchNode struct {
	Branches [16]Node
	Value    []byte
}

func NewBranchNode

func NewBranchNode() *BranchNode

func (BranchNode) HasValue

func (b BranchNode) HasValue() bool

func (BranchNode) Hash

func (b BranchNode) Hash() []byte

func (BranchNode) Raw

func (b BranchNode) Raw() []interface{}

func (*BranchNode) RemoveBranch

func (b *BranchNode) RemoveBranch(nibble nibble.Nibble)

func (*BranchNode) RemoveValue

func (b *BranchNode) RemoveValue()

func (BranchNode) Serialize

func (b BranchNode) Serialize() []byte

func (*BranchNode) SetBranch

func (b *BranchNode) SetBranch(nibble nibble.Nibble, node Node)

func (*BranchNode) SetValue

func (b *BranchNode) SetValue(value []byte)

type ExtensionNode

type ExtensionNode struct {
	Path []nibble.Nibble
	Next Node
}

func NewExtensionNode

func NewExtensionNode(nibbles []nibble.Nibble, next Node) *ExtensionNode

func (ExtensionNode) Hash

func (e ExtensionNode) Hash() []byte

func (ExtensionNode) Raw

func (e ExtensionNode) Raw() []interface{}

func (ExtensionNode) Serialize

func (e ExtensionNode) Serialize() []byte

type LeafNode

type LeafNode struct {
	Path  []nibble.Nibble
	Value []byte
}

func NewLeafNodeFromBytes

func NewLeafNodeFromBytes(key, value []byte) *LeafNode

func NewLeafNodeFromKeyValue

func NewLeafNodeFromKeyValue(key, value string) *LeafNode

func NewLeafNodeFromNibbleBytes

func NewLeafNodeFromNibbleBytes(nibbles []byte, value []byte) (*LeafNode, error)

func NewLeafNodeFromNibbles

func NewLeafNodeFromNibbles(nibbles []nibble.Nibble, value []byte) *LeafNode

func (LeafNode) Hash

func (l LeafNode) Hash() []byte

func (LeafNode) Raw

func (l LeafNode) Raw() []interface{}

func (LeafNode) Serialize

func (l LeafNode) Serialize() []byte

type Node

type Node interface {
	Hash() []byte // common.Hash
	Raw() []interface{}
}

Jump to

Keyboard shortcuts

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