Documentation ¶
Index ¶
Constants ¶
View Source
const ( BITMAP_NODE = 0 KV_NODE = 1 Fanout = 6 //each bitmap node has 6 bits, so the max depth of tree is 64/6 = 10.666 = 11 Mask = (1 << Fanout) - 1 )
Some constants
Variables ¶
View Source
var ErrorNotFound = errors.New("not found")
Functions ¶
This section is empty.
Types ¶
type BitmapNode ¶
type BitmapNode[T any] struct { // contains filtered or unexported fields }
BitmapNode defines Hamt's bitmap node
func (*BitmapNode[T]) BitPosNum ¶
func (h *BitmapNode[T]) BitPosNum(int) uint64
BitPosNum returns the number from a bit position
func (*BitmapNode[T]) Index ¶
func (h *BitmapNode[T]) Index(bitPos uint64) int
Index returns the index of a bitPos int bitmap
type Entry ¶
type Entry interface { // Type returns the node type Type() int // BitPosNum returns number from a bit position BitPosNum(depth int) uint64 }
Entry is a tree node interface
type Hamt ¶
type Hamt[T any] struct { // contains filtered or unexported fields }
Hamt is an implementation of hash-array-mapped-trie
func (*Hamt[T]) Get ¶
Get returns the value by the passed key if the key is in the hamt, otherwise returns nil
func (*Hamt[T]) StringKeys ¶
StringKeys returns keys in Hamt
type KvNode ¶
type KvNode[T any] struct { // contains filtered or unexported fields }
KvNode is Hamt's key-value node
type KvPair ¶
type KvPair[T any] struct { // contains filtered or unexported fields }
KvPair is a list node with actually value
Click to show internal directories.
Click to hide internal directories.