client

package
v0.5.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2014 License: Apache-2.0 Imports: 11 Imported by: 176

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTimeout            = context.DeadlineExceeded
	DefaultRequestTimeout = 5 * time.Second
)
View Source
var (
	ErrUnavailable = errors.New("client: no available etcd endpoints")
	ErrNoLeader    = errors.New("client: no leader")
	ErrKeyNoExist  = errors.New("client: key does not exist")
	ErrKeyExists   = errors.New("client: key already exists")
)
View Source
var (
	DefaultV2KeysPrefix = "/v2/keys"
)

Functions

This section is empty.

Types

type HTTPKeysAPI

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

func (*HTTPKeysAPI) Create

func (k *HTTPKeysAPI) Create(key, val string, ttl time.Duration) (*Response, error)

func (*HTTPKeysAPI) Get

func (k *HTTPKeysAPI) Get(key string) (*Response, error)

func (*HTTPKeysAPI) RecursiveWatch

func (k *HTTPKeysAPI) RecursiveWatch(key string, idx uint64) Watcher

func (*HTTPKeysAPI) Watch

func (k *HTTPKeysAPI) Watch(key string, idx uint64) Watcher

type KeysAPI

type KeysAPI interface {
	Create(key, value string, ttl time.Duration) (*Response, error)
	Get(key string) (*Response, error)
	Watch(key string, idx uint64) Watcher
	RecursiveWatch(key string, idx uint64) Watcher
}

func NewDiscoveryKeysAPI

func NewDiscoveryKeysAPI(tr *http.Transport, ep string, to time.Duration) (KeysAPI, error)

func NewKeysAPI

func NewKeysAPI(tr *http.Transport, ep string, to time.Duration) (KeysAPI, error)

type Node

type Node struct {
	Key           string `json:"key"`
	Value         string `json:"value"`
	Nodes         Nodes  `json:"nodes"`
	ModifiedIndex uint64 `json:"modifiedIndex"`
	CreatedIndex  uint64 `json:"createdIndex"`
}

func (*Node) String

func (n *Node) String() string

type Nodes

type Nodes []*Node

type Response

type Response struct {
	Action   string `json:"action"`
	Node     *Node  `json:"node"`
	PrevNode *Node  `json:"prevNode"`
}

type Watcher

type Watcher interface {
	Next() (*Response, error)
}

Directories

Path Synopsis
module
pkg module

Jump to

Keyboard shortcuts

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