etcd

package
v0.0.0-...-9af805d Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2016 License: GPL-2.0 Imports: 10 Imported by: 0

README

This replica of the original code from github.com/coreos/etcd/contrib/recipes

Documentation

Index

Constants

This section is empty.

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

This section is empty.

Types

type EphemeralKV

type EphemeralKV struct{ RemoteKV }

EphemeralKV is a new key associated with a session lease

func NewEphemeralKV

func NewEphemeralKV(client *v3.Client, key, val string) (*EphemeralKV, error)

NewEphemeralKV creates a new key/value pair associated with a session lease

func NewUniqueEphemeralKV

func NewUniqueEphemeralKV(client *v3.Client, prefix, val string) (ek *EphemeralKV, err error)

NewUniqueEphemeralKV creates a new unique key/value pair associated with a session lease

func NewUniqueEphemeralKey

func NewUniqueEphemeralKey(client *v3.Client, prefix string) (*EphemeralKV, error)

NewUniqueEphemeralKey creates a new unique valueless key associated with a session lease

type EtcdClient

type EtcdClient struct {
	*v3.Client
}

func NewEtcdClient

func NewEtcdClient(cfg *config.Config) (*EtcdClient, error)

NewEtcdClient creates an etcd client based on the provided config.

func (*EtcdClient) GetClient

func (c *EtcdClient) GetClient() *v3.Client

func (*EtcdClient) TestEtcdClient

func (c *EtcdClient) TestEtcdClient() error

TestEtcdClient verifies a client is functional. It will attempt to connect to the etcd server and block until the server responds at least once, or return an error if the server never responded.

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 GetRemoteKV

func GetRemoteKV(kv v3.KV, key string) (*RemoteKV, error)

func NewKV

func NewKV(kv v3.KV, key, val string, leaseID v3.LeaseID) (*RemoteKV, error)

func NewKey

func NewKey(kv v3.KV, key string, leaseID v3.LeaseID) (*RemoteKV, error)

func NewSequentialKV

func NewSequentialKV(kv v3.KV, prefix, val string) (*RemoteKV, error)

NewSequentialKV allocates a new sequential key-value pair at <prefix>/nnnnn

func NewUniqueKV

func NewUniqueKV(kv v3.KV, prefix string, val string, leaseID v3.LeaseID) (*RemoteKV, error)

func NewUniqueKey

func NewUniqueKey(kv v3.KV, prefix string) (*RemoteKV, error)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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