package rhh
import "github.com/influxdata/influxdb/pkg/rhh"
Index ¶
- Variables
- func Dist(hash, i, capacity int64) int64
- func HashKey(key []byte) int64
- func HashUint64(key uint64) int64
- type HashMap
- func NewHashMap(opt Options) *HashMap
- func (m *HashMap) AverageProbeCount() float64
- func (m *HashMap) Cap() int64
- func (m *HashMap) Elem(i int64) (key []byte, value interface{})
- func (m *HashMap) Get(key []byte) interface{}
- func (m *HashMap) Keys() [][]byte
- func (m *HashMap) Len() int64
- func (m *HashMap) Put(key []byte, val interface{})
- func (m *HashMap) Reset()
- type Options
Variables ¶
var DefaultOptions = Options{ Capacity: 256, LoadFactor: 90, }
DefaultOptions represents a default set of options to pass to NewHashMap().
Functions ¶
func Dist ¶
Dist returns the probe distance for a hash in a slot index. NOTE: Capacity must be a power of 2.
func HashKey ¶
HashKey computes a hash of key. Hash is always non-zero.
func HashUint64 ¶
HashUint64 computes a hash of an int64. Hash is always non-zero.
Types ¶
type HashMap ¶
type HashMap struct {
// contains filtered or unexported fields
}
HashMap represents a hash map that implements Robin Hood Hashing. https://cs.uwaterloo.ca/research/tr/1986/CS-86-14.pdf
func NewHashMap ¶
func (*HashMap) AverageProbeCount ¶
AverageProbeCount returns the average number of probes for each element.
func (*HashMap) Cap ¶
Cap returns the number of key/values set in map.
func (*HashMap) Elem ¶
Elem returns the i-th key/value pair of the hash map.
func (*HashMap) Get ¶
func (*HashMap) Keys ¶
Keys returns a list of sorted keys.
func (*HashMap) Len ¶
Len returns the number of key/values set in map.
func (*HashMap) Put ¶
func (*HashMap) Reset ¶
func (m *HashMap) Reset()
Reset clears the values in the map without deallocating the space.
type Options ¶
Options represents initialization options that are passed to NewHashMap().
Source Files ¶
- Version
- v1.12.0 (latest)
- Published
- Apr 8, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 2 days ago –
Tools for package owners.