Documentation ¶
Index ¶
- Constants
- Variables
- func AddNibblesTerminator(nibbles []uint8) []uint8
- func CreateBranch(value []uint8, hasChildren []bool) []uint8
- func CreateEmpty() []uint8
- func CreateExtension(key []uint8) []uint8
- func CreateLeaf(key []uint8, value []uint8) []uint8
- func CreateSubstream(value []uint8) []uint8
- func CreateValue(value []uint8) []uint8
- func Decode(input []uint8) interface{}
- func DecodeNibbles(value []uint8) []uint8
- func DecodeNodeHeader(input interface{}) (int, interface{})
- func DecodeNodeHeaderUint8Slice(input []uint8) (int, interface{})
- func DecodeNodeHeaderUint8Slices(input []interface{}) (int, interface{})
- func Encode(input []interface{}) []uint8
- func EncodeNibbles(nibbles []uint8) []uint8
- func EndBranch() []uint8
- func ExtractKey(key []uint8) []uint8
- func ExtractNodeKey(node [][]uint8) []uint8
- func FromNibbles(input []uint8) []uint8
- func FuseNibbles(nibbles []uint8, isLeaf bool) []uint8
- func Hashing(value []byte) []byte
- func Includes(haystack []uint8, needle uint8) bool
- func IsNibblesTerminated(nibbles []uint8) bool
- func RemoveNibblesTerminator(nibbles []uint8) []uint8
- func SharedPrefixLength(first []uint8, second []uint8) int
- func ToNibbles(input []uint8) []uint8
- type BranchHeader
- type ExtensionHeader
- type LeafHeader
- type NodeHeader
- type Null
Constants ¶
const BRANCH_NODE_NO_VALUE = 254
BRANCH_NODE_NO_VALUE ...
const BRANCH_NODE_WITH_VALUE = 255
BRANCH_NODE_WITH_VALUE ...
const BranchValueIndex = 16
BranchValueIndex ...
const EMPTY_TRIE = 0
EMPTY_TRIE ...
const EXTENSION_NODE_BIG = 253
EXTENSION_NODE_BIG ...
const EXTENSION_NODE_OFFSET = 128
EXTENSION_NODE_OFFSET ...
const EXTENSION_NODE_SMALL_MAX = EXTENSION_NODE_BIG - 1
EXTENSION_NODE_SMALL_MAX ...
const EXTENSION_NODE_THRESHOLD = EXTENSION_NODE_BIG - EXTENSION_NODE_OFFSET // 125
EXTENSION_NODE_THRESHOLD ...
const LEAF_NODE_BIG = 127
LEAF_NODE_BIG ...
const LEAF_NODE_OFFSET = 1
LEAF_NODE_OFFSET ...
const LEAF_NODE_SMALL_MAX = LEAF_NODE_BIG - 1
LEAF_NODE_SMALL_MAX ...
const LEAF_NODE_THRESHOLD = LEAF_NODE_BIG - LEAF_NODE_OFFSET
LEAF_NODE_THRESHOLD ...
const NODE_TYPE_BRANCH = 1
NODE_TYPE_BRANCH ...
const NODE_TYPE_EXT = 2
NODE_TYPE_EXT ...
const NODE_TYPE_LEAF = 3
NODE_TYPE_LEAF ...
const NODE_TYPE_NULL = 0
NODE_TYPE_NULL ...
const Type = "Substrate"
Type ...
Variables ¶
var ( // HPFlag2 ... HPFlag2 uint8 = 2 // HPFlag0 ... HPFlag0 uint8 // NibbleTerminator ... NibbleTerminator uint8 = 16 // NeedsTerminator ... NeedsTerminator = []uint8{HPFlag2, HPFlag2 + 1} // IsOddLength ... IsOddLength = []uint8{HPFlag0 + 1, HPFlag2 + 1} )
var ( // ExtensionNodeBig ... ExtensionNodeBig = 253 // ExtensionNodeOffset ... ExtensionNodeOffset = 128 // LeafNodeBig ... LeafNodeBig = 127 // LeafNodeOffset ... LeafNodeOffset = 1 // MaxFuseLength ... MaxFuseLength = 255 + 126 )
var ErrTypeAssertion = errors.New("Cannot assert type")
ErrTypeAssertion ...
var ErrUnreachableCode = errors.New("Unreachable code")
ErrUnreachableCode ...
Functions ¶
func AddNibblesTerminator ¶
AddNibblesTerminator ...
func DecodeNodeHeader ¶
func DecodeNodeHeader(input interface{}) (int, interface{})
DecodeNodeHeader ...
func DecodeNodeHeaderUint8Slice ¶
DecodeNodeHeaderUint8Slice ...
func DecodeNodeHeaderUint8Slices ¶
func DecodeNodeHeaderUint8Slices(input []interface{}) (int, interface{})
DecodeNodeHeaderUint8Slices ...
func FromNibbles ¶
FromNibbles converts the uint8 slice input from nibbles. Calculate and return a uint8 slice that's made from a list of nibbles.
func RemoveNibblesTerminator ¶
RemoveNibblesTerminator ...
func SharedPrefixLength ¶
SharedPrefixLength returns the shared prefix length. Calculates the minimum distance that both uint8 slices share.
Types ¶
type BranchHeader ¶
type BranchHeader struct {
// contains filtered or unexported fields
}
BranchHeader ...
type ExtensionHeader ¶
type ExtensionHeader struct {
// contains filtered or unexported fields
}
ExtensionHeader ...
func NewExtensionHeader ¶
func NewExtensionHeader(value int) *ExtensionHeader
NewExtensionHeader ...
type LeafHeader ¶
type LeafHeader struct {
// contains filtered or unexported fields
}
LeafHeader ...
type NodeHeader ¶
type NodeHeader struct {
// contains filtered or unexported fields
}
NodeHeader ...