openaddr

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2022 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultLoadFactor = 0.90 // load factor must exceed 50%
	DefaultMapSize    = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type HashMap

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

HashMap represents a closed hashing hashtable implementation

func NewHashMap

func NewHashMap(size uint) *HashMap

NewHashMap returns a new HashMap instantiated with the specified size or the DefaultMapSize, whichever is larger

func (*HashMap) Close

func (m *HashMap) Close()

Close closes and frees the current hashmap. Calling any method on the HashMap after this will most likely result in a panic

func (*HashMap) Del

func (m *HashMap) Del(key string) ([]byte, bool)

Del removes a value for a given key and returns the deleted value, or false Del can be considered the exported version of the delete call

func (*HashMap) Get

func (m *HashMap) Get(key string) ([]byte, bool)

Get returns a value for a given key, or returns false if none could be found Get can be considered the exported version of the lookup call

func (*HashMap) GetHighestDIB

func (m *HashMap) GetHighestDIB() uint8

GetHighestDIB returns the highest distance to initial bucket value in the table

func (*HashMap) Len

func (m *HashMap) Len() int

Len returns the number of entries currently in the HashMap

func (*HashMap) PercentFull

func (m *HashMap) PercentFull() float64

PercentFull returns the current load factor of the HashMap

func (*HashMap) Range

func (m *HashMap) Range(it Iterator)

Range takes an Iterator and ranges the HashMap as long as long as the iterator function continues to be true. Range is not safe to perform an insert or remove operation while ranging!

func (*HashMap) Set

func (m *HashMap) Set(key string, value []byte) ([]byte, bool)

Set inserts a key value entry and returns the previous value or false Set can be considered the exported version of the insert call

type HashMapGP added in v1.7.0

type HashMapGP struct {
	// contains filtered or unexported fields
}

HashMapGP represents a closed hashing hashtable implementation

func NewHashMapGP added in v1.7.0

func NewHashMapGP(size uint) *HashMapGP

NewHashMapGP returns a new HashMapGP instantiated with the specified size or the DefaultMapSize, whichever is larger

func (*HashMapGP) Close added in v1.7.0

func (m *HashMapGP) Close()

Close closes and frees the current hashmap. Calling any method on the HashMapGP after this will most likely result in a panic

func (*HashMapGP) Del added in v1.7.0

func (m *HashMapGP) Del(key string) (interface{}, bool)

Del removes a value for a given key and returns the deleted value, or false Del can be considered the exported version of the delete call

func (*HashMapGP) Get added in v1.7.0

func (m *HashMapGP) Get(key string) (interface{}, bool)

Get returns a value for a given key, or returns false if none could be found Get can be considered the exported version of the lookup call

func (*HashMapGP) GetHighestDIB added in v1.7.0

func (m *HashMapGP) GetHighestDIB() uint8

GetHighestDIB returns the highest distance to initial bucketGP value in the table

func (*HashMapGP) Len added in v1.7.0

func (m *HashMapGP) Len() int

Len returns the number of entries currently in the HashMapGP

func (*HashMapGP) PercentFull added in v1.7.0

func (m *HashMapGP) PercentFull() float64

PercentFull returns the current load factor of the HashMapGP

func (*HashMapGP) Range added in v1.7.0

func (m *HashMapGP) Range(it IteratorGP)

Range takes an Iterator and ranges the HashMapGP as long as long as the iterator function continues to be true. Range is not safe to perform an insert or remove operation while ranging!

func (*HashMapGP) Set added in v1.7.0

func (m *HashMapGP) Set(key string, value interface{}) (interface{}, bool)

Set inserts a key value entryGP and returns the previous value or false Set can be considered the exported version of the insert call

type HashMapU64

type HashMapU64 struct {
	// contains filtered or unexported fields
}

HashMapU64 represents a closed hashing hashtable implementation

func NewHashMapU64

func NewHashMapU64(size uint) *HashMapU64

NewHashMapU64 returns a new HashMapU64 instantiated with the specified size or the DefaultMapSize, whichever is larger

func (*HashMapU64) Close

func (m *HashMapU64) Close()

Close closes and frees the current hashmap. Calling any method on the HashMapU64 after this will most likely result in a panic

func (*HashMapU64) Del

func (m *HashMapU64) Del(key uint64) (uint64, bool)

Del removes a value for a given key and returns the deleted value, or false Del can be considered the exported version of the delete call

func (*HashMapU64) Get

func (m *HashMapU64) Get(key uint64) (uint64, bool)

Get returns a value for a given key, or returns false if none could be found Get can be considered the exported version of the lookup call

func (*HashMapU64) GetHighestDIB

func (m *HashMapU64) GetHighestDIB() uint8

GetHighestDIB returns the highest distance to initial bucketU64 value in the table

func (*HashMapU64) Len

func (m *HashMapU64) Len() int

Len returns the number of entries currently in the HashMapU64

func (*HashMapU64) PercentFull

func (m *HashMapU64) PercentFull() float64

PercentFull returns the current load factor of the HashMapU64

func (*HashMapU64) Range

func (m *HashMapU64) Range(it IteratorU64)

Range takes an Iterator and ranges the HashMapU64 as long as long as the iterator function continues to be true. Range is not safe to perform an insert or remove operation while ranging!

func (*HashMapU64) Set

func (m *HashMapU64) Set(key uint64, value uint64) (uint64, bool)

Set inserts a key value entryU64 and returns the previous value or false Set can be considered the exported version of the insert call

type Iterator

type Iterator func(key string, value []byte) bool

Iterator is an iterator function type

type IteratorGP added in v1.7.0

type IteratorGP func(key string, value interface{}) bool

IteratorGP is an iterator function type

type IteratorU64

type IteratorU64 func(key uint64, value uint64) bool

IteratorU64 is an iterator function type

type ShardedHashMap

type ShardedHashMap struct {
	// contains filtered or unexported fields
}

func NewShardedHashMap

func NewShardedHashMap(size uint) *ShardedHashMap

NewShardedHashMap returns a new hashMap instantiated with the specified size or the defaultMapSize, whichever is larger

func (*ShardedHashMap) Add

func (s *ShardedHashMap) Add(key string, val []byte) ([]byte, bool)

func (*ShardedHashMap) Close

func (s *ShardedHashMap) Close()

func (*ShardedHashMap) Del

func (s *ShardedHashMap) Del(key string) ([]byte, bool)

func (*ShardedHashMap) Get

func (s *ShardedHashMap) Get(key string) ([]byte, bool)

func (*ShardedHashMap) GetBit

func (s *ShardedHashMap) GetBit(key string, idx uint) (uint, bool)

func (*ShardedHashMap) GetUint

func (s *ShardedHashMap) GetUint(key string) (uint64, bool)

func (*ShardedHashMap) Len

func (s *ShardedHashMap) Len() int

func (*ShardedHashMap) Range

func (s *ShardedHashMap) Range(it Iterator)

func (*ShardedHashMap) Set

func (s *ShardedHashMap) Set(key string, val []byte) ([]byte, bool)

func (*ShardedHashMap) SetBit

func (s *ShardedHashMap) SetBit(key string, idx uint, bit uint) bool

func (*ShardedHashMap) SetUint

func (s *ShardedHashMap) SetUint(key string, num uint64) (uint64, bool)

func (*ShardedHashMap) Stats

func (s *ShardedHashMap) Stats()

Jump to

Keyboard shortcuts

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