interfaces

package
v0.0.0-...-c555478 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrNotExist is returned when GetStr or friends can not find the
	// requested key.
	ErrNotExist = Error("ErrNotExist")

	// ErrShutdown is returned when we're exiting during a shutdown.
	ErrShutdown = Error("ErrShutdown")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	GetClient() *etcd.Client
	Set(ctx context.Context, key, value string, opts ...etcd.OpOption) error
	Get(ctx context.Context, path string, opts ...etcd.OpOption) (map[string]string, error)
	Del(ctx context.Context, path string, opts ...etcd.OpOption) (int64, error)
	Txn(ctx context.Context, ifCmps []etcd.Cmp, thenOps, elseOps []etcd.Op) (*etcd.TxnResponse, error)
	Watcher(ctx context.Context, path string, opts ...etcd.OpOption) (chan error, error)
	ComplexWatcher(ctx context.Context, path string, opts ...etcd.OpOption) (*WatcherInfo, error)
}

Client provides a simple interface specification for client requests. Both EmbdEtcd.MakeClient and client.Simple implement this.

type Error

type Error string

Error is a constant error type that implements error.

func (Error) Error

func (e Error) Error() string

Error fulfills the error interface of this type.

type WatcherData

type WatcherData struct {
	// Created is true if this event is the initial event sent on startup.
	Created bool

	// XXX: what goes here... this? or a more processed version?
	Path   string // the path we're watching
	Header pb.ResponseHeader
	Events []*etcd.Event
	Err    error
}

WatcherData is the structure of data passed to a callback from any watcher.

type WatcherInfo

type WatcherInfo struct {
	// Cancel must be called to shutdown the Watcher when we are done with
	// it. You can alternatively call cancel on the input ctx.
	Cancel func()

	// Events returns a channel of any events that occur. This happens on
	// watch startup, watch event, and watch failure. This channel closes
	// when the Watcher shuts down. If you block on these reads, then you
	// will block the entire Watcher which is usually not what you want.
	Events <-chan *WatcherData
}

WatcherInfo is what is returned from a Watcher. It contains everything you might need to get information about the running watch.

Jump to

Keyboard shortcuts

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