client

package
v0.5.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2014 License: Apache-2.0 Imports: 14 Imported by: 0

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"
)
View Source
var (
	DefaultV2MembersPrefix = "/v2/members"
)

Functions

This section is empty.

Types

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, eps []string, to time.Duration) (KeysAPI, error)

func NewKeysAPI

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

type MembersAPI

type MembersAPI interface {
	List() ([]httptypes.Member, error)
	Add(peerURL string) (*httptypes.Member, error)
	Remove(mID string) error
}

func NewMembersAPI

func NewMembersAPI(tr *http.Transport, eps []string, to time.Duration) (MembersAPI, 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)
}

Jump to

Keyboard shortcuts

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