This section is empty.


View Source
var (
	ErrTimeout          = context.DeadlineExceeded
	ErrCanceled         = context.Canceled
	ErrNoEndpoints      = errors.New("no endpoints available")
	ErrTooManyRedirects = errors.New("too many redirects")

	DefaultRequestTimeout = 5 * time.Second
	DefaultMaxRedirects   = 10
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"


This section is empty.


type CancelableTransport

type CancelableTransport interface {
	CancelRequest(req *http.Request)

    CancelableTransport mimics http.Transport to provide an interface which can be substituted for testing (since the RoundTripper interface alone does not require the CancelRequest method)

    type HTTPAction

    type HTTPAction interface {
    	HTTPRequest(url.URL) *http.Request

    type HTTPClient

    type HTTPClient interface {
    	Do(context.Context, HTTPAction) (*http.Response, []byte, error)

    type KeysAPI

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

    func NewDiscoveryKeysAPI

    func NewDiscoveryKeysAPI(c HTTPClient) KeysAPI

    func NewKeysAPI

    func NewKeysAPI(c HTTPClient) KeysAPI

    type MembersAPI

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

    func NewMembersAPI

    func NewMembersAPI(c HTTPClient) MembersAPI

    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"`
    	Index    uint64

    type SyncableHTTPClient

    type SyncableHTTPClient interface {
    	Sync(context.Context) error
    	Endpoints() []string

    func NewHTTPClient

    func NewHTTPClient(tr CancelableTransport, eps []string) (SyncableHTTPClient, error)

    type Watcher

    type Watcher interface {
    	Next(context.Context) (*Response, error)


    Path Synopsis