Documentation ¶
Index ¶
- type StrMap
- func (sm *StrMap) AsyncRange(f func(key string, value interface{}) bool)
- func (sm *StrMap) ConcRange(f func(key string, value interface{}) bool)
- func (sm *StrMap) Delete(key string)
- func (sm *StrMap) Get(key string) (interface{}, bool)
- func (sm *StrMap) GetOrSet(key string, value interface{}) (actual interface{}, loaded bool)
- func (sm *StrMap) Len() int
- func (sm *StrMap) Range(f func(key string, value interface{}) bool)
- func (sm *StrMap) Set(key string, value interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StrMap ¶
type StrMap struct {
// contains filtered or unexported fields
}
func (*StrMap) AsyncRange ¶
AsyncRange is exactly like ConcRange, but doesn't wait until all shards are done. This is usually ok, although calls that appear to happen "sequentially" on the same goroutine might get the before or after AsyncRange values, which might be surprising behaviour. When that's not desirable, use ConcRange.
func (*StrMap) ConcRange ¶
ConcRange ranges concurrently over all the shards, calling f sequentially over each shard's key and value. If f returns false, range stops the iteration on that shard (but the other shards continue until completion).
No key will be visited more than once, but if any value is inserted concurrently, Range may or may not visit it. Similarly, if a value is modified concurrently, Range may visit the previous or newest version of said value.
func (*StrMap) Range ¶
Range is modeled after sync.Map.Range. It calls f sequentially for each key and value present in each of the shards in the map. If f returns false, range stops the iteration.
No key will be visited more than once, but if any value is inserted concurrently, Range may or may not visit it. Similarly, if a value is modified concurrently, Range may visit the previous or newest version of said value.