Documentation ¶
Index ¶
- Constants
- type ConcurrentMap
- func (m ConcurrentMap) Clear()
- func (m *ConcurrentMap) Count() int
- func (m *ConcurrentMap) Get(key string) (*types.Item, bool)
- func (m *ConcurrentMap) GetShard(key string) *ConcurrentMapShard
- func (m *ConcurrentMap) Has(key string) bool
- func (m ConcurrentMap) IterBuffered() <-chan Tuple
- func (m *ConcurrentMap) Pop(key string) (*types.Item, bool)
- func (m *ConcurrentMap) Remove(key string)
- func (m *ConcurrentMap) Set(key string, value *types.Item)
- type ConcurrentMapShard
- type Tuple
Constants ¶
View Source
const ( // ShardCount is the number of shards used by the map. ShardCount = 32 // ShardCount32 is the number of shards used by the map pre-casted to uint32 to avoid performance issues. ShardCount32 uint32 = uint32(ShardCount) )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConcurrentMap ¶
type ConcurrentMap struct {
// contains filtered or unexported fields
}
ConcurrentMap is a "thread" safe map of type string:*types.Item. To avoid lock bottlenecks this map is divided into several (ShardCount) map shards.
func (*ConcurrentMap) Count ¶
func (m *ConcurrentMap) Count() int
Count returns the number of items in the map.
func (*ConcurrentMap) Get ¶
func (m *ConcurrentMap) Get(key string) (*types.Item, bool)
Get retrieves an element from map under given key.
func (*ConcurrentMap) GetShard ¶
func (m *ConcurrentMap) GetShard(key string) *ConcurrentMapShard
GetShard returns shard under given key.
func (*ConcurrentMap) Has ¶
func (m *ConcurrentMap) Has(key string) bool
Has checks if key is present in the map.
func (ConcurrentMap) IterBuffered ¶
func (m ConcurrentMap) IterBuffered() <-chan Tuple
IterBuffered returns a buffered iterator which could be used in a for range loop.
func (*ConcurrentMap) Pop ¶
func (m *ConcurrentMap) Pop(key string) (*types.Item, bool)
Pop removes an element from the map and returns it.
func (*ConcurrentMap) Remove ¶
func (m *ConcurrentMap) Remove(key string)
Remove removes the value under the specified key.
type ConcurrentMapShard ¶
ConcurrentMapShard is a "thread" safe string to `*types.Item` map shard.
Click to show internal directories.
Click to hide internal directories.