trie

package
v0.9.20 Latest Latest
Warning

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

Go to latest
Published: May 12, 2015 License: LGPL-2.1-or-later Imports: 9 Imported by: 56

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginsWith

func BeginsWith(a, b []byte) bool

func CompactDecode

func CompactDecode(str string) []byte

func CompactEncode

func CompactEncode(hexSlice []byte) string

func CompactHexDecode

func CompactHexDecode(str string) []byte

func CompareIntSlice

func CompareIntSlice(a, b []int) bool

Helper function for comparing slices

func DecodeCompact

func DecodeCompact(key []byte) string

func HasTerm

func HasTerm(s []byte) bool

func MatchingNibbleLength

func MatchingNibbleLength(a, b []byte) int

Returns the amount of nibbles that match each other from 0 ...

func RemTerm

func RemTerm(s []byte) []byte

Types

type Backend added in v0.8.5

type Backend interface {
	Get([]byte) ([]byte, error)
	Put([]byte, []byte)
}

type Cache

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

func NewCache

func NewCache(backend Backend) *Cache

func (*Cache) Copy added in v0.8.5

func (self *Cache) Copy() *Cache

func (*Cache) Flush added in v0.8.5

func (self *Cache) Flush()

func (*Cache) Get

func (self *Cache) Get(key []byte) []byte

func (*Cache) Put

func (self *Cache) Put(key []byte, data []byte)

func (*Cache) Reset added in v0.8.5

func (self *Cache) Reset()

type FullNode added in v0.8.5

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

func NewFullNode added in v0.8.5

func NewFullNode(t *Trie) *FullNode

func (*FullNode) Branches added in v0.8.5

func (self *FullNode) Branches() []Node

func (*FullNode) Copy added in v0.8.5

func (self *FullNode) Copy(t *Trie) Node

func (*FullNode) Dirty added in v0.8.5

func (self *FullNode) Dirty() bool

func (*FullNode) Hash added in v0.8.5

func (self *FullNode) Hash() interface{}

func (*FullNode) Len added in v0.8.5

func (self *FullNode) Len() (amount int)

Returns the length of non-nil nodes

func (*FullNode) RlpData added in v0.8.5

func (self *FullNode) RlpData() interface{}

func (*FullNode) String added in v0.8.5

func (self *FullNode) String() string

func (*FullNode) Value added in v0.8.5

func (self *FullNode) Value() Node

type HashNode added in v0.8.5

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

func NewHash added in v0.8.5

func NewHash(key []byte, trie *Trie) *HashNode

func (*HashNode) Copy added in v0.8.5

func (self *HashNode) Copy(t *Trie) Node

func (*HashNode) Dirty added in v0.8.5

func (self *HashNode) Dirty() bool

func (*HashNode) Hash added in v0.8.5

func (self *HashNode) Hash() interface{}

func (*HashNode) RlpData added in v0.8.5

func (self *HashNode) RlpData() interface{}

func (*HashNode) Value added in v0.8.5

func (self *HashNode) Value() Node

These methods will never be called but we have to satisfy Node interface

type Iterator

type Iterator struct {
	Key   []byte
	Value []byte
	// contains filtered or unexported fields
}

func NewIterator

func NewIterator(trie *Trie) *Iterator

func (*Iterator) Next

func (self *Iterator) Next() bool

type Node

type Node interface {
	Value() Node
	Copy(*Trie) Node // All nodes, for now, return them self
	Dirty() bool

	Hash() interface{}
	RlpData() interface{}
	// contains filtered or unexported methods
}

type SecureTrie added in v0.9.20

type SecureTrie struct {
	*Trie
}

func NewSecure added in v0.9.20

func NewSecure(root []byte, backend Backend) *SecureTrie

func (*SecureTrie) Copy added in v0.9.20

func (self *SecureTrie) Copy() *SecureTrie

func (*SecureTrie) Delete added in v0.9.20

func (self *SecureTrie) Delete(key []byte) Node

func (*SecureTrie) DeleteString added in v0.9.20

func (self *SecureTrie) DeleteString(key string) Node

func (*SecureTrie) Get added in v0.9.20

func (self *SecureTrie) Get(key []byte) []byte

func (*SecureTrie) GetKey added in v0.9.20

func (self *SecureTrie) GetKey(shaKey []byte) []byte

func (*SecureTrie) GetString added in v0.9.20

func (self *SecureTrie) GetString(key string) []byte

func (*SecureTrie) Update added in v0.9.20

func (self *SecureTrie) Update(key, value []byte) Node

func (*SecureTrie) UpdateString added in v0.9.20

func (self *SecureTrie) UpdateString(key, value string) Node

type ShortNode added in v0.8.5

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

func NewShortNode added in v0.8.5

func NewShortNode(t *Trie, key []byte, value Node) *ShortNode

func (*ShortNode) Copy added in v0.8.5

func (self *ShortNode) Copy(t *Trie) Node

func (*ShortNode) Dirty added in v0.8.5

func (self *ShortNode) Dirty() bool

func (*ShortNode) Hash added in v0.8.5

func (self *ShortNode) Hash() interface{}

func (*ShortNode) Key added in v0.8.5

func (self *ShortNode) Key() []byte

func (*ShortNode) RlpData added in v0.8.5

func (self *ShortNode) RlpData() interface{}

func (*ShortNode) String added in v0.8.5

func (self *ShortNode) String() string

func (*ShortNode) Value added in v0.8.5

func (self *ShortNode) Value() Node

type Trie

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

func New

func New(root []byte, backend Backend) *Trie

func ParanoiaCheck

func ParanoiaCheck(t1 *Trie, backend Backend) (bool, *Trie)

func (*Trie) Commit added in v0.8.5

func (self *Trie) Commit()

func (*Trie) Copy

func (self *Trie) Copy() *Trie

func (*Trie) Delete

func (self *Trie) Delete(key []byte) Node

func (*Trie) DeleteString added in v0.8.5

func (self *Trie) DeleteString(key string) Node

func (*Trie) Get

func (self *Trie) Get(key []byte) []byte

func (*Trie) GetString added in v0.8.5

func (self *Trie) GetString(key string) []byte

func (*Trie) Hash added in v0.8.5

func (self *Trie) Hash() []byte

func (*Trie) Iterator

func (self *Trie) Iterator() *Iterator

func (*Trie) PrintRoot added in v0.8.5

func (self *Trie) PrintRoot()

func (*Trie) Reset added in v0.8.5

func (self *Trie) Reset()

Reset should only be called if the trie has been hashed

func (*Trie) Root

func (self *Trie) Root() []byte

Legacy support

func (*Trie) Update

func (self *Trie) Update(key, value []byte) Node

func (*Trie) UpdateString added in v0.8.5

func (self *Trie) UpdateString(key, value string) Node

type ValueNode added in v0.8.5

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

func (*ValueNode) Copy added in v0.8.5

func (self *ValueNode) Copy(t *Trie) Node

func (*ValueNode) Dirty added in v0.8.5

func (self *ValueNode) Dirty() bool

func (*ValueNode) Hash added in v0.8.5

func (self *ValueNode) Hash() interface{}

func (*ValueNode) RlpData added in v0.8.5

func (self *ValueNode) RlpData() interface{}

func (*ValueNode) String added in v0.8.5

func (self *ValueNode) String() string

Value node

func (*ValueNode) Val added in v0.8.5

func (self *ValueNode) Val() []byte

func (*ValueNode) Value added in v0.8.5

func (self *ValueNode) Value() Node

Jump to

Keyboard shortcuts

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