MCPcopy
hub / github.com/grafana/dskit / CAS

Method CAS

kv/client.go:118–118  ·  view source on GitHub ↗

CAS stands for Compare-And-Swap. Will call provided callback f with the current value of the key and allow callback to return a different value. Will then attempt to atomically swap the current value for the new value. If that doesn't succeed will try again - callback will be called again with new v

(ctx context.Context, key string, f func(in interface{}) (out interface{}, retry bool, err error))

Source from the content-addressed store, hash-verified

116 // If the callback returns an error and true for retry, and the max number of
117 // attempts is not exceeded, the operation will be retried.
118 CAS(ctx context.Context, key string, f func(in interface{}) (out interface{}, retry bool, err error)) error
119
120 // WatchKey calls f whenever the value stored under key changes.
121 WatchKey(ctx context.Context, key string, f func(interface{}) bool)

Calls

no outgoing calls