watcher

package
v0.0.0-...-dd72184 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Watch

func Watch(ctx context.Context, cli *clientv3.Client, prefix string, target Watchable)

Watch a prefix on etcd and synchronize its contents with target. The function will return when the context is canceled, otherwise it will continuously attempt to re-establish the underlying Watcher on error.

Types

type NotifyWatchable

type NotifyWatchable interface {
	Watchable
	Notify() <-chan struct{}
}

A NotifyWatchable is a Watchable with a channel to receive updates whenever the data changes.

func NewNotifyWatchable

func NewNotifyWatchable(ctx context.Context, w Watchable) NotifyWatchable

NewNotifyWatchable returns a NotifyWatchable wrapping another Watchable.

type ReadyWatchable

type ReadyWatchable interface {
	Watchable
	WaitForInit() <-chan struct{}
}

A ReadyWatchable is a Watchable that exposes a method to let you know when it has the initial complete view of the data.

func NewReadyWatchable

func NewReadyWatchable(w Watchable) ReadyWatchable

NewReadyWatchable wraps a Watchable with a WaitForInit method.

type Watchable

type Watchable interface {
	Reset(map[string]string)
	Set(string, string)
	Delete(string)
}

A Watchable exposes an interface to allow synchronization with the remote etcd contents.

Jump to

Keyboard shortcuts

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