caching

package
v0.2.0-rc Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	FieldMap_N     = int64(unsafe.Offsetof(HashMap{}.N))
	FieldMap_b     = int64(unsafe.Offsetof(HashMap{}.b))
	FieldEntrySize = int64(unsafe.Sizeof(Entry{}))
)

Variables

View Source
var (
	V_strhash = rt.UnpackEface(strhash)
	S_strhash = *(*uintptr)(V_strhash.Value)
)

Functions

func DJBHash32

func DJBHash32(k string) uint32

func DJBHash64

func DJBHash64(k string) uint64

func StrHash

func StrHash(s string) uint64

Types

type Entry

type Entry struct {
	Hash uint32
	Key  string
	Val  unsafe.Pointer
}

type HashMap

type HashMap struct {
	N uint32
	// contains filtered or unexported fields
}

func NewHashMap

func NewHashMap(n int, loadFactor int) *HashMap

func (*HashMap) At

func (self *HashMap) At(p uint32) *Entry

func (*HashMap) Get

func (self *HashMap) Get(name string) unsafe.Pointer

Get searches FieldMap by name. JIT generated assembly does NOT call this function, rather it implements its own version directly in assembly. So we must ensure this function stays in sync with the JIT generated one.

func (*HashMap) Set

func (self *HashMap) Set(name string, val unsafe.Pointer)

WARN: this function is not idempotent, set same key twice will cause incorrect result.

func (*HashMap) Size

func (self *HashMap) Size() int

type Pair

type Pair struct {
	Val unsafe.Pointer
	Key string
}

type TrieNode

type TrieNode struct {
	Leaves *[]Pair
	Index  []TrieNode
}

type TrieTree

type TrieTree struct {
	Count     int
	Positions []int
	Empty     unsafe.Pointer
	TrieNode
}

func (*TrieTree) Get

func (fn *TrieTree) Get(k string) unsafe.Pointer

func (*TrieTree) Set

func (fn *TrieTree) Set(k string, field unsafe.Pointer) bool

func (*TrieTree) Size

func (fn *TrieTree) Size() int

Jump to

Keyboard shortcuts

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