offheap

package module
v0.0.0-...-3af038e Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2015 License: MIT Imports: 4 Imported by: 0

README

go-inthash

go version of basic hash map, open addressing with linear probing. uint64 keys. Inspired by http://preshing.com/20130107/this-hash-table-is-faster-than-a-judy-array/

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Verbose bool

Functions

func HashEqualsMap

func HashEqualsMap(h *HashTable, m map[uint64]int) bool

compare for correctness checking

func StringHashEqualsMap

func StringHashEqualsMap(h *HashTable, m map[string]int) bool

func Upper_power_of_two

func Upper_power_of_two(v uint64) uint64

func VDump

func VDump(i interface{})

func VPrintf

func VPrintf(format string, a ...interface{})

Types

type Cell

type Cell struct {
	HashedKey uint64
	ByteKey   []byte
	Value     interface{}
}

type HashTable

type HashTable struct {
	Cells      []Cell
	ArraySize  uint64
	Population uint64
	ZeroUsed   bool
	ZeroCell   Cell
}

func NewHashTable

func NewHashTable(initialSize uint64) *HashTable

func (*HashTable) Clear

func (t *HashTable) Clear()

func (*HashTable) Compact

func (t *HashTable) Compact()

func (*HashTable) DeleteBK

func (t *HashTable) DeleteBK(bytekey []byte) bool

func (*HashTable) DeleteCell

func (t *HashTable) DeleteCell(cell *Cell)

func (*HashTable) DeleteKey

func (t *HashTable) DeleteKey(key uint64)

func (*HashTable) DeleteStringKey

func (t *HashTable) DeleteStringKey(strkey string) bool

func (*HashTable) DestroyHashTable

func (t *HashTable) DestroyHashTable()

func (*HashTable) DumpStringKey

func (t *HashTable) DumpStringKey()

func (*HashTable) Insert

func (t *HashTable) Insert(key uint64) (*Cell, bool)

2nd return value is false if already existed (and thus took no action)

func (*HashTable) InsertBK

func (t *HashTable) InsertBK(bytekey []byte, value interface{}) bool

func (*HashTable) InsertIntValue

func (t *HashTable) InsertIntValue(key uint64, value int) bool

func (*HashTable) InsertStringKey

func (t *HashTable) InsertStringKey(strkey string, value interface{}) bool

func (*HashTable) Lookup

func (t *HashTable) Lookup(key uint64) *Cell

return nil if not found

func (*HashTable) LookupBK

func (t *HashTable) LookupBK(bytekey []byte) (interface{}, bool)

func (*HashTable) LookupStringKey

func (t *HashTable) LookupStringKey(strkey string) (interface{}, bool)

func (*HashTable) Repopulate

func (t *HashTable) Repopulate(desiredSize uint64)

type Iterator

type Iterator struct {
	Tab *HashTable
	Pos int64
	Cur *Cell // nil when done
}

func NewIterator

func NewIterator(tab *HashTable) *Iterator

func (*Iterator) Next

func (it *Iterator) Next() *Cell

Jump to

Keyboard shortcuts

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