etcd

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2015 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

func IsKeyNotFound added in v0.10.0

func IsKeyNotFound(err error) bool

func IsNodeExist added in v0.10.0

func IsNodeExist(err error) bool

func NewClient

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

Types

type Action added in v0.5.1

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 added in v0.5.1

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

func (*Create) HTTPRequest added in v0.5.1

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

func (*Create) String added in v0.5.1

func (c *Create) String() string

type Delete added in v0.5.1

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

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

func (*Delete) HTTPRequest added in v0.5.1

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

func (*Delete) String added in v0.5.1

func (del *Delete) String() string

type Error added in v0.5.1

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

func (Error) Error added in v0.5.1

func (e Error) Error() string

type Get added in v0.5.1

type Get struct {
	Key       string
	Sorted    bool
	Recursive bool
}

func (*Get) HTTPRequest added in v0.5.1

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

func (*Get) String added in v0.5.1

func (g *Get) String() string

type LeaseManager added in v0.10.0

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

func NewLeaseManager added in v0.10.0

func NewLeaseManager(client Client, keyPrefix string) *LeaseManager

func (*LeaseManager) AcquireLease added in v0.10.0

func (r *LeaseManager) AcquireLease(name string, machID string, ver int, period time.Duration) (lease.Lease, error)

func (*LeaseManager) GetLease added in v0.10.0

func (r *LeaseManager) GetLease(name string) (lease.Lease, error)

func (*LeaseManager) StealLease added in v0.10.0

func (r *LeaseManager) StealLease(name, machID string, ver int, period time.Duration, idx uint64) (lease.Lease, error)

type Node added in v0.5.1

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 added in v0.5.1

func (n *Node) String() string

func (Node) TTLDuration added in v0.8.2

func (n Node) TTLDuration() time.Duration

type Nodes added in v0.5.1

type Nodes []Node

type Result added in v0.5.1

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

func (*Result) String added in v0.5.1

func (r *Result) String() string

type Set added in v0.5.1

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

func (*Set) HTTPRequest added in v0.5.1

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

func (*Set) String added in v0.5.1

func (s *Set) String() string

type Update added in v0.5.1

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

func (*Update) HTTPRequest added in v0.5.1

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

func (*Update) String added in v0.5.1

func (u *Update) String() string

type Watch added in v0.5.1

type Watch struct {
	Key       string
	Recursive bool
	WaitIndex uint64
}

func (*Watch) HTTPRequest added in v0.5.1

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

func (*Watch) String added in v0.5.1

func (w *Watch) String() string

Jump to

Keyboard shortcuts

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