bt

package
v0.0.0-...-b6e904f Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBasicTree

func NewBasicTree(rootRound int64, rootID string, rootValue []byte) (*BasicTree, *Node, error)

Types

type BasicTree

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

Tree holds elements of a single tree. Element's key should be unique.

func (*BasicTree) Insert

func (t *BasicTree) Insert(n Node) (*Node, error)

Insert inserts a node into the tree, parent of the node shoule be indicated.

func (*BasicTree) LookUp

func (t *BasicTree) LookUp(key string) (*Node, error)

LookUp finds the specific node holds the key.

func (*BasicTree) Reset

func (t *BasicTree) Reset(newRoot *Node) error

Reset sets the input as a new root.

type Node

type Node struct {
	Round     int64
	ID        string
	Value     []byte
	ParentKey string

	Parent *Node
	Sons   []*Node
}

Node is a single element within the tree

Jump to

Keyboard shortcuts

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