You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tailscale/syncs
Joe Tsai d209b032ab
syncs: add Map.WithLock to allow mutations to the underlying map (#8101)
Some operations cannot be implemented with the prior API:
* Iterating over the map and deleting keys
* Iterating over the map and replacing items
* Calling APIs that expect a native Go map

Add a Map.WithLock method that acquires a write-lock on the map
and then calls a user-provided closure with the underlying Go map.
This allows users to interact with the Map as a regular Go map,
but with the gaurantees that it is concurrent safe.

Updates tailscale/corp#9115

Signed-off-by: Joe Tsai <joetsai@digital-static.net>
2 months ago
..
locked.go all: update copyright and license headers 2 years ago
locked_test.go all: update copyright and license headers 2 years ago
pool.go syncs: add generic Pool (#12759) 2 months ago
pool_test.go syncs: add generic Pool (#12759) 2 months ago
shardedmap.go syncs: add ShardedMap.Mutate 1 year ago
shardedmap_test.go syncs: add ShardedMap.Mutate 1 year ago
syncs.go syncs: add Map.WithLock to allow mutations to the underlying map (#8101) 2 months ago
syncs_test.go syncs: add Map.WithLock to allow mutations to the underlying map (#8101) 2 months ago