Documentation ¶
Overview ¶
Package hmap implements a non-resizable concurrency-aware hash map.
Index ¶
- type Map
- func (m *Map) Delete(key interface{})
- func (m *Map) Load(key interface{}) (value interface{}, ok bool)
- func (m *Map) Range(f func(key, value interface{}) bool)
- func (m *Map) StatBuckets() (capacity, largest uint)
- func (m *Map) StatEntries() (mapSize, deleted uint)
- func (m *Map) Store(key, value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map is a non-resizable hash map. A single update operation and multiple read operations can be executed concurrently on the map, while multiple update operations cannot. In other words, only update operations need an external synchronization.
Store and Delete are update operations and Load and Range are read operations. StatBuckets and StatEntries are considered to be write operations, while they do not modify the map.
func NewMap ¶
NewMap returns an empty hash map that maintain the given number of buckets. The function hasher is used to hash keys.
func (*Map) Delete ¶
func (m *Map) Delete(key interface{})
Delete logically removes the given key and its associated value.
func (*Map) Load ¶
Load returns the value associated with the given key and true if the key exists. Otherwise, it returns nil and false.
func (*Map) Range ¶
Range iteratively applies the given function to each key-value pair until the function returns false.
func (*Map) StatBuckets ¶
StatBuckets returns the number of buckets and the number of keys in the largest bucket.
func (*Map) StatEntries ¶
StatEntries returns the number of keys physically existing in the map and the number of logically deleted keys.