MCPcopy Create free account
hub / github.com/cloud-native-go/examples / Set

Method Set

ch04/sharding.go:81–87  ·  view source on GitHub ↗
(key K, value V)

Source from the content-addressed store, hash-verified

79}
80
81func (m ShardedMap[K, V]) Set(key K, value V) {
82 shard := m.getShard(key)
83 shard.Lock()
84 defer shard.Unlock()
85
86 shard.items[key] = value
87}
88
89// Keys returns a list of all keys in the sharded map.
90func (m ShardedMap[K, V]) Keys() []K {

Callers 3

TestShardingSetAndGetFunction · 0.80
TestShardingKeysFunction · 0.80
TestShardingDeleteFunction · 0.80

Calls 1

getShardMethod · 0.95

Tested by 3

TestShardingSetAndGetFunction · 0.64
TestShardingKeysFunction · 0.64
TestShardingDeleteFunction · 0.64