Documentation ¶
Index ¶
- Constants
- type Cuckoo
- type Option
- type Options
- type PackedTable
- func (p *PackedTable) Delete(i uint32, tag uint32) bool
- func (p *PackedTable) Find(i uint32, tag uint32) bool
- func (p *PackedTable) Info() string
- func (p *PackedTable) Init(numBucket, tagsPerBucket, bitsPerItem uint32)
- func (p *PackedTable) Insert(i uint32, tag uint32, kickout bool) (oldTag uint32, ok bool)
- func (p *PackedTable) SizeInTags() uint32
- func (p *PackedTable) String() string
- type PermEncoding
- type Table
Constants ¶
View Source
const (
N_ENTS = 3876
)
View Source
const (
SingleTable = "single-table"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cuckoo ¶
type Cuckoo struct {
// contains filtered or unexported fields
}
func (*Cuckoo) BitsPerItem ¶
func (*Cuckoo) Contain ¶
f = fingerprint(x); i1 = hash(x); i2 = i1 ⊕ hash(f); if bucket[i1] or bucket[i2] has f then
return True;
return False;
func (*Cuckoo) Insert ¶
f = fingerprint(x); i1 = hash(x); i2 = i1 ⊕ hash(f); if bucket[i1] or bucket[i2] has an empty entry then
add f to that bucket; return Done;
// must relocate existing items; i = randomly pick i1 or i2; for n = 0; n < MaxNumKicks; n++ do
randomly select an entry e from bucket[i]; swap f and the fingerprint stored in entry e; i = i ⊕ hash(f); if bucket[i] has an empty entry then add f to bucket[i]; return Done;
// Hashtable is considered full; return Failure;
func (*Cuckoo) LoadFactor ¶
type Option ¶
type Option func(options *Options)
func WithBitsPerItem ¶
WithBitsPerItem per item has bits count
func WithNumKeys ¶
func WithTagsPerBucket ¶
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
Options cuckoo options
type PackedTable ¶
type PackedTable struct {
// contains filtered or unexported fields
}
semi sort table Using Permutation encoding to save 1 bit per tag
func (*PackedTable) Info ¶
func (p *PackedTable) Info() string
func (*PackedTable) Init ¶
func (p *PackedTable) Init(numBucket, tagsPerBucket, bitsPerItem uint32)
Init init packed table
func (*PackedTable) SizeInTags ¶
func (p *PackedTable) SizeInTags() uint32
func (*PackedTable) String ¶
func (p *PackedTable) String() string
type PermEncoding ¶
type PermEncoding struct {
// contains filtered or unexported fields
}
func NewPermEncoding ¶
func NewPermEncoding() *PermEncoding
func (*PermEncoding) DecItem ¶
func (p *PermEncoding) DecItem(codeword uint16) uint16
func (*PermEncoding) Decode ¶
func (p *PermEncoding) Decode(codeword uint16) [4]uint8
func (*PermEncoding) Encode ¶
func (p *PermEncoding) Encode(lowBits [4]uint8) uint16
Click to show internal directories.
Click to hide internal directories.