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") )
View Source
const ( // MemberChangePollingInterval is the polling interval to use when // watching for member changes for client operations. This is basically // the same idea in the core package named MemberChangeInterval, but // held separately for now. MemberChangePollingInterval = 1000 * time.Millisecond )
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) // WatchMembers returns a channel of changing members in the cluster. WatchMembers(context.Context) (<-chan *MembersResult, error) }
Client provides a simple interface specification for client requests. Both EmbdEtcd.MakeClient and client.Simple implement this.
type Member ¶
type Member struct { // ID is unique in the cluster for each member. ID uint64 // Name for the member which if not not started will be an empty string. Name string // PeerURLs is the list of addresses peers servers can connect to. PeerURLs etcdtypes.URLs // ClientURLs is the list of addresses that clients can connect to. If // the member is not started, then this will be a zero length list. ClientURLs etcdtypes.URLs }
Member is our internal copy of the etcd member struct as found here: https://godocs.io/github.com/coreos/etcd/etcdserver/etcdserverpb#Member but which uses native types where possible.
type MembersResult ¶
type MembersResult struct { // Members is the list of members found in this result. Members []*Member // Err represents an error. If this is not nil, don't touch the other // data in this struct. Err error }
MembersResult returns the expect result (including possibly an error) from a WatchMembers operation.
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.
Click to show internal directories.
Click to hide internal directories.