etcd

package
v1.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompareAndUpdate

func CompareAndUpdate(ctx context.Context, client *clientv3.Client, key, value string) error

CompareAndUpdate conditionally sets an etcd key value pair if the value differs from what is current.

func NewStream

func NewStream(logger kitlog.Logger, client etcdGetter, opt StreamOptions) (<-chan *mvccpb.KeyValue, <-chan struct{})

NewStream accepts an etcd client with which we watch for changes to our selected keys and push them down the output channel. The advantages to using this interface over what etcd already provides is the polling interval, which ensures on boot that we receive the initial value, along with at polling intervals.

Types

type StreamOptions

type StreamOptions struct {
	Ctx                context.Context
	Keys               []string
	PollInterval       time.Duration
	WatchRetryInterval time.Duration
	GetTimeout         time.Duration
}

StreamOptions should be passed to NewStream to construct a new streaming channel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL