etcd

package
v0.0.0-...-edd91d0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

View Source
const PathNano = "/qnano"
View Source
const PathNodeQueue = "/qqueue"

Variables

View Source
var (
	ErrKeyExists      = errors.New("key already exists")
	ErrWaitMismatch   = errors.New("unexpected wait result")
	ErrTooManyClients = errors.New("too many clients")
	ErrNoWatcher      = errors.New("no watcher channel")
)

Functions

func WaitEvents

func WaitEvents(c *clientv3.Client, key string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

WaitEvents waits on a key until it observes the given events and returns the final one.

func WaitPrefixEvents

func WaitPrefixEvents(c *clientv3.Client, prefix string, rev int64, evs []mvccpb.Event_EventType) (*clientv3.Event, error)

Types

type EphemeralKV

type EphemeralKV struct{ RemoteKV }

EphemeralKV is a new key associated with a session lease

type EtcdDiscovery

type EtcdDiscovery struct {
}

type EtcdGateway

type EtcdGateway struct {
	memory.MemGateway
	// contains filtered or unexported fields
}

func (*EtcdGateway) Broadcast

func (o *EtcdGateway) Broadcast(message *qtiny.Message, discovery qtiny.Discovery) error

func (*EtcdGateway) GetMeta

func (o *EtcdGateway) GetMeta() map[string]interface{}

func (*EtcdGateway) GetType

func (o *EtcdGateway) GetType() string

func (*EtcdGateway) Init

func (o *EtcdGateway) Init(config map[string]interface{}) error

func (*EtcdGateway) Multicast

func (o *EtcdGateway) Multicast(message *qtiny.Message, discovery qtiny.Discovery) error

func (*EtcdGateway) Post

func (o *EtcdGateway) Post(message *qtiny.Message, discovery qtiny.Discovery) error

func (*EtcdGateway) Start

func (o *EtcdGateway) Start(config map[string]interface{}) error

func (*EtcdGateway) Stop

func (o *EtcdGateway) Stop(config map[string]interface{}) error

func (*EtcdGateway) String

func (o *EtcdGateway) String() string

type EtcdWatcher

type EtcdWatcher struct {
	Id            string
	Endpoints     []string
	HeartbeatPath string

	SessionTimeout    time.Duration
	ReconnectInterval time.Duration

	Logger *log.Logger
	// contains filtered or unexported fields
}

func (*EtcdWatcher) AddConnectCallback

func (o *EtcdWatcher) AddConnectCallback(callback EtcdWatcherCallback)

func (*EtcdWatcher) Compact

func (o *EtcdWatcher) Compact(recv int64, timeout time.Duration, opts ...clientv3.CompactOption) (*clientv3.CompactResponse, error)

func (*EtcdWatcher) Create

func (o *EtcdWatcher) Create(path string, data string, timeout time.Duration) (bool, error)

func (*EtcdWatcher) Delete

func (o *EtcdWatcher) Delete(path string, timeout time.Duration, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

func (*EtcdWatcher) Get

func (o *EtcdWatcher) Get(path string, timeout time.Duration, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

func (*EtcdWatcher) GetConn

func (o *EtcdWatcher) GetConn() *clientv3.Client

func (*EtcdWatcher) GetContextWithTimeout

func (o *EtcdWatcher) GetContextWithTimeout(parent context.Context, timeout time.Duration) context.Context

func (*EtcdWatcher) IsConnected

func (o *EtcdWatcher) IsConnected() bool

func (*EtcdWatcher) Put

func (o *EtcdWatcher) Put(path string, val string, timeout time.Duration, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

func (*EtcdWatcher) PutWithTTL

func (o *EtcdWatcher) PutWithTTL(path string, val string, ttl int64, timeout time.Duration, opts ...clientv3.OpOption) (*clientv3.PutResponse, *clientv3.LeaseGrantResponse, error)

func (*EtcdWatcher) Start

func (o *EtcdWatcher) Start(config map[string]interface{}) error

func (*EtcdWatcher) Stop

func (o *EtcdWatcher) Stop(map[string]interface{}) error

func (*EtcdWatcher) WaitForConnected

func (o *EtcdWatcher) WaitForConnected() <-chan bool

func (*EtcdWatcher) Watch

func (o *EtcdWatcher) Watch(path string, timeout time.Duration, opts ...clientv3.OpOption) clientv3.WatchChan

func (*EtcdWatcher) Watch2

func (o *EtcdWatcher) Watch2(wtype WatchType, path string, data interface{}, routine WatchRoutine)

type EtcdWatcherCallback

type EtcdWatcherCallback func(event EtcdWatcherEvent, watcher *EtcdWatcher, err error)

type EtcdWatcherEvent

type EtcdWatcherEvent int
const (
	EtcdWatcherEventConnected    EtcdWatcherEvent = 1
	EtcdWatcherEventDisconnected EtcdWatcherEvent = 2
)

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

Queue implements a multi-reader, multi-writer distributed queue.

func (*Queue) Dequeue

func (q *Queue) Dequeue() (string, error)

Dequeue returns Enqueue()'d elements in FIFO order. If the queue is empty, Dequeue blocks until elements are available.

func (*Queue) Enqueue

func (q *Queue) Enqueue(val string) error

type RemoteKV

type RemoteKV struct {
	// contains filtered or unexported fields
}

RemoteKV is a key/revision pair created by the client and stored on etcd

func (*RemoteKV) Delete

func (rk *RemoteKV) Delete() error

func (*RemoteKV) Key

func (rk *RemoteKV) Key() string

func (*RemoteKV) Put

func (rk *RemoteKV) Put(val string) error

func (*RemoteKV) Revision

func (rk *RemoteKV) Revision() int64

func (*RemoteKV) Value

func (rk *RemoteKV) Value() string

type WatchBox

type WatchBox struct {
	Path   string
	Logger *log.Logger
	Data   interface{}
	// contains filtered or unexported fields
}

func (*WatchBox) GetPath

func (o *WatchBox) GetPath() string

func (*WatchBox) GetType

func (o *WatchBox) GetType() WatchType

type WatchRoutine

type WatchRoutine func(event *zk.Event, stat *zk.Stat, data interface{}, box *WatchBox, watcher *EtcdWatcher, err error) bool

type WatchType

type WatchType int
const (
	WatchTypeExist    WatchType = 1
	WatchTypeGet      WatchType = 2
	WatchTypeChildren WatchType = 3
)

Jump to

Keyboard shortcuts

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