MCPcopy Index your code
hub / github.com/aceld/zinx / RLockFuncWithKey

Method RLockFuncWithKey

zutils/shard_lock_map.go:255–260  ·  view source on GitHub ↗

RLockFuncWithKey executes a function with read lock on the shard containing the key. WARNING: Do not perform write operations on the container within f to avoid deadlocks.

(key string, f func(shardData map[string]interface{}))

Source from the content-addressed store, hash-verified

253// RLockFuncWithKey executes a function with read lock on the shard containing the key.
254// WARNING: Do not perform write operations on the container within f to avoid deadlocks.
255func (slm ShardLockMaps) RLockFuncWithKey(key string, f func(shardData map[string]interface{})) {
256 shard := slm.GetShard(key)
257 shard.RLock()
258 defer shard.RUnlock()
259 f(shard.items)
260}
261
262// LockFunc executes a function with write lock on all shards.
263// WARNING: Do not perform operations on the container within f to avoid deadlocks.

Callers 1

TestRLockFuncWithKeyFunction · 0.95

Calls 1

GetShardMethod · 0.95

Tested by 1

TestRLockFuncWithKeyFunction · 0.76