node

package
v2.2.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EmptyHash = sha256.New().Sum(nil)

Functions

func DecodeValueOnly

func DecodeValueOnly(buf []byte) ([]byte, error)

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

Node represents a node in a Tree.

func Decode

func Decode(pool Pool, nodeKey NodeKey, buf []byte) (*Node, error)

Decode constructs a *Node from an encoded byte slice.

func NewNode

func NewNode(key, value []byte, version int64, height int8) *Node

func (*Node) CheckValid

func (node *Node) CheckValid()

func (*Node) DeepCopy

func (node *Node) DeepCopy(nodepool Pool) *Node

func (*Node) Dirty

func (node *Node) Dirty() bool

func (*Node) Encode

func (node *Node) Encode() ([]byte, error)

func (*Node) EncodeWithBuffer

func (node *Node) EncodeWithBuffer(buf *bytes.Buffer) error

func (*Node) Evict

func (node *Node) Evict() bool

func (*Node) EvictChildren

func (node *Node) EvictChildren()

func (*Node) Hash

func (node *Node) Hash() []byte

func (*Node) HashSelf

func (node *Node) HashSelf() []byte

Computes the hash of the node without computing its descendants. Must be called on nodes which have descendant node hashes already computed.

func (*Node) HashWith

func (node *Node) HashWith(h hash.Hash, buf *bytes.Buffer) []byte

func (*Node) IsLeaf

func (node *Node) IsLeaf() bool

func (*Node) Key

func (node *Node) Key() []byte

func (*Node) LeftNode

func (node *Node) LeftNode() *Node

func (*Node) LeftNodeKey

func (node *Node) LeftNodeKey() NodeKey

func (*Node) NodeKey

func (node *Node) NodeKey() NodeKey

func (*Node) PoolID

func (node *Node) PoolID() uint64

func (*Node) Reset

func (node *Node) Reset()

func (*Node) RightNode

func (node *Node) RightNode() *Node

func (*Node) RightNodeKey

func (node *Node) RightNodeKey() NodeKey

func (*Node) SetDirty

func (node *Node) SetDirty(dirty bool)

func (*Node) SetHash

func (node *Node) SetHash(hash []byte)

func (*Node) SetKey

func (node *Node) SetKey(key []byte)

func (*Node) SetLeft

func (node *Node) SetLeft(leftNode *Node)

func (*Node) SetLeftNodeKey

func (node *Node) SetLeftNodeKey(key NodeKey)

func (*Node) SetNodeKey

func (node *Node) SetNodeKey(nk NodeKey)

func (*Node) SetPoolID

func (node *Node) SetPoolID(id uint64)

func (*Node) SetRight

func (node *Node) SetRight(rightNode *Node)

func (*Node) SetRightNodeKey

func (node *Node) SetRightNodeKey(key NodeKey)

func (*Node) SetSize

func (node *Node) SetSize(size int64)

func (*Node) SetSource

func (node *Node) SetSource(src Source)

func (*Node) SetSubTreeHeight

func (node *Node) SetSubTreeHeight(height int8)

func (*Node) SetValue

func (node *Node) SetValue(value []byte)

func (*Node) ShadowCopy

func (node *Node) ShadowCopy(nodepool Pool) *Node

func (*Node) Size

func (node *Node) Size() int64

func (*Node) SizeBytes

func (node *Node) SizeBytes() uint64

func (*Node) Source

func (node *Node) Source() Source

func (*Node) String

func (node *Node) String() string

func (*Node) SubTreeHeight

func (node *Node) SubTreeHeight() int8

func (*Node) Value

func (node *Node) Value() []byte

func (*Node) Version

func (node *Node) Version() int64

type NodeKey

type NodeKey [12]byte

NodeKey represents a key of node in the DB.

func NewNodeKey

func NewNodeKey(version int64, sequence uint32) NodeKey

func (NodeKey) IsEmpty

func (nk NodeKey) IsEmpty() bool

func (NodeKey) Sequence

func (nk NodeKey) Sequence() uint32

func (NodeKey) String

func (nk NodeKey) String() string

String returns a string representation of the node key.

func (NodeKey) Version

func (nk NodeKey) Version() int64

type Pool

type Pool interface {
	Get() *Node
}

type SnapshotNode

type SnapshotNode struct {
	Key     []byte
	Value   []byte
	Version int64
	Height  int8
}

type Source

type Source int
const (
	PoolNode Source = iota
	ManualNode
)

Jump to

Keyboard shortcuts

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