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) Load(key string) (interface{}, bool)
- func (sm *StrMap) LoadOrStore(key string, value interface{}) (actual interface{}, loaded bool)
- func (sm *StrMap) Range(f func(key string, value interface{}) bool)
- func (sm *StrMap) Store(key string, value interface{})
- type UUID
- type UUIDMap
- func (sm *UUIDMap) AsyncRange(f func(key UUID, value interface{}) bool)
- func (sm *UUIDMap) ConcRange(f func(key UUID, value interface{}) bool)
- func (sm *UUIDMap) Delete(key UUID)
- func (sm *UUIDMap) Load(key UUID) (interface{}, bool)
- func (sm *UUIDMap) LoadOrStore(key UUID, value interface{}) (actual interface{}, loaded bool)
- func (sm *UUIDMap) Range(f func(key UUID, value interface{}) bool)
- func (sm *UUIDMap) Store(key UUID, value interface{})
- type Uint64Map
- func (sm *Uint64Map) AsyncRange(f func(key uint64, value interface{}) bool)
- func (sm *Uint64Map) ConcRange(f func(key uint64, value interface{}) bool)
- func (sm *Uint64Map) Delete(key uint64)
- func (sm *Uint64Map) Load(key uint64) (interface{}, bool)
- func (sm *Uint64Map) LoadOrStore(key uint64, value interface{}) (actual interface{}, loaded bool)
- func (sm *Uint64Map) Range(f func(key uint64, value interface{}) bool)
- func (sm *Uint64Map) Store(key uint64, 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
}
Implementation: This is a sharded map so that the cost of locking is distributed with the data, instead of a single lock. The optimal number of shards will probably depend on the number of system cores but we provide a general default.
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) LoadOrStore ¶
LoadOrStore ...
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.
type UUIDMap ¶
type UUIDMap struct {
// contains filtered or unexported fields
}
Implementation: This is a sharded map so that the cost of locking is distributed with the data, instead of a single lock. The optimal number of shards will probably depend on the number of system cores but we provide a general default.
func (*UUIDMap) AsyncRange ¶
AsyncRange is exactly like ConcRange, but doesn't wait until all shards are done. Since each shard is locked with an RWLock, it might be safe to use, but concurrent reads elsewhere might get the pre-range values, so don't use this one unless you don't care about that.
func (*UUIDMap) 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 (*UUIDMap) LoadOrStore ¶
LoadOrStore ...
func (*UUIDMap) 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.
type Uint64Map ¶
type Uint64Map struct {
// contains filtered or unexported fields
}
Implementation: This is a sharded map so that the cost of locking is distributed with the data, instead of a single lock. The optimal number of shards will probably depend on the number of system cores but we provide a general default.
func (*Uint64Map) AsyncRange ¶
AsyncRange is exactly like ConcRange, but doesn't wait until all shards are done. Since each shard is locked with an RWLock, it might be safe to use, but concurrent reads elsewhere might get the pre-range values, so don't use this one unless you don't care about that.
func (*Uint64Map) 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 (*Uint64Map) LoadOrStore ¶
LoadOrStore ...
func (*Uint64Map) 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.