etcd

package
v0.14.2 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorKeyNotFound       = 100
	ErrorNodeExist         = 105
	ErrorEventIndexCleared = 401
)

Variables

This section is empty.

Functions

func NewClient

func NewClient(endpoints []string, transport *http.Transport, actionTimeout time.Duration) (*client, error)

Types

type Action

type Action interface {
	fmt.Stringer
	HTTPRequest() (*http.Request, error)
}

type Client

type Client interface {
	Do(Action) (*Result, error)
	Wait(Action, <-chan struct{}) (*Result, error)
}

type Create

type Create struct {
	Key   string
	Value string
	TTL   time.Duration
}

func (*Create) HTTPRequest

func (c *Create) HTTPRequest() (*http.Request, error)

func (*Create) String

func (c *Create) String() string

type Delete

type Delete struct {
	Key           string
	Recursive     bool
	PreviousValue string
	PreviousIndex uint64
}

TODO(bcwaldon): Should Delete be separate from CompareAndDelete?

func (*Delete) HTTPRequest

func (del *Delete) HTTPRequest() (*http.Request, error)

func (*Delete) String

func (del *Delete) String() string

type Error

type Error struct {
	ErrorCode int    `json:"errorCode"`
	Message   string `json:"message"`
	Cause     string `json:"cause"`
	Index     uint64 `json:"index"`
}

func (Error) Error

func (e Error) Error() string

type Get

type Get struct {
	Key       string
	Sorted    bool
	Recursive bool
}

func (*Get) HTTPRequest

func (g *Get) HTTPRequest() (*http.Request, error)

func (*Get) String

func (g *Get) String() string

type Node

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

func (*Node) String

func (n *Node) String() string

func (Node) TTLDuration

func (n Node) TTLDuration() time.Duration

type Nodes

type Nodes []Node

type Result

type Result struct {
	Action   string `json:"action"`
	Node     *Node  `json:"node"`
	PrevNode *Node  `json:"prevNode"`
	Raw      []byte `json:"-"`
}

func (*Result) String

func (r *Result) String() string

type Set

type Set struct {
	Key           string
	Value         string
	TTL           time.Duration
	PreviousIndex uint64
	PreviousValue string
}

func (*Set) HTTPRequest

func (s *Set) HTTPRequest() (*http.Request, error)

func (*Set) String

func (s *Set) String() string

type Update

type Update struct {
	Key   string
	Value string
	TTL   time.Duration
}

func (*Update) HTTPRequest

func (u *Update) HTTPRequest() (*http.Request, error)

func (*Update) String

func (u *Update) String() string

type Watch

type Watch struct {
	Key       string
	Recursive bool
	WaitIndex uint64
}

func (*Watch) HTTPRequest

func (w *Watch) HTTPRequest() (*http.Request, error)

func (*Watch) String

func (w *Watch) String() string

Jump to

Keyboard shortcuts

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