Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecoderNoop ¶
Types ¶
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
func Range ¶
Range creates a Value that is backed a range of etcd key/value pairs from 'key' passed to NewValue to 'end' passed to Range.
The key range semantics (ie. lexicographic ordering) are the same as in etcd ranges, so for example to retrieve all keys prefixed by `foo/` key should be `foo/` and end should be `foo0`.
For any update in the given range, the decoder will be called and its result will trigger the return of a Get() call. The decoder should return a type that lets the user distinguish which of the multiple objects in the range got updated, as the Get() call returns no additional information about the location of the retrieved object by itself.
The order of values retrieved by Get() is currently fully arbitrary and must not be relied on. It's possible that in the future the order of updates and the blocking behaviour of Get will be formalized, but this is not yet the case. Instead, the data returned should be treated as eventually consistent with the etcd state.
For some uses, it might be necessary to first retrieve all the objects contained within the range before starting to block on updates - in this case, the BacklogOnly option should be used when calling Get.
type StringAt ¶
func DecoderStringAt ¶
type ThinClient ¶
ThinClient is a small wrapper interface to combine clientv3.KV and clientv3.Watcher.
type Value ¶
type Value[T any] struct { // contains filtered or unexported fields }
Value is an 'Event Value' backed in an etcd cluster, accessed over an etcd client. This is a stateless handle and can be copied and shared across goroutines.
func NewValue ¶
func NewValue[T any](etcd ThinClient, key string, decoder func(key, value []byte) (T, error), options ...*Option) *Value[T]
NewValue creates a new Value for a given key(s) in an etcd client. The given decoder will be used to convert bytes retrieved from etcd into the interface{} value retrieved by Get by this value's watcher.