-
Notifications
You must be signed in to change notification settings - Fork 555
Open
Description
If the map values are structs, sometimes there is a need to update a certain value inside one of the structs atomically, to ensure the updated value is consistent.
Currently the only way of doing so (other than implement an additional locking mechanism or ) is using Upsert
, with a very clunky usage, for example:
var clusters = cmap.New[ClusterData]()
...
clusters.Upsert(id, ClusterData{}, func(_ bool, cluster ClusterData, _ ClusterData) ClusterData {
cluster.TimedOut = true
return cluster
})
ringsaturn, ayushjain2809, johanix and adamtajti
Metadata
Metadata
Assignees
Labels
No labels