Documentation ¶
Overview ¶
Package tools implements types which help work with etcd which depend on the api package. TODO: move this package to an etcd specific utility package.
Index ¶
Constants ¶
View Source
const ( EtcdErrorCodeNotFound = 100 EtcdErrorCodeTestFailed = 101 EtcdErrorCodeNodeExist = 105 EtcdErrorCodeValueRequired = 200 EtcdErrorCodeWatchExpired = 401 EtcdErrorCodeUnreachable = 501 )
Variables ¶
View Source
var ( EtcdErrorNotFound = &etcd.EtcdError{ErrorCode: EtcdErrorCodeNotFound} EtcdErrorTestFailed = &etcd.EtcdError{ErrorCode: EtcdErrorCodeTestFailed} EtcdErrorNodeExist = &etcd.EtcdError{ErrorCode: EtcdErrorCodeNodeExist} EtcdErrorValueRequired = &etcd.EtcdError{ErrorCode: EtcdErrorCodeValueRequired} EtcdErrorWatchExpired = &etcd.EtcdError{ErrorCode: EtcdErrorCodeWatchExpired} EtcdErrorUnreachable = &etcd.EtcdError{ErrorCode: EtcdErrorCodeUnreachable} )
Functions ¶
This section is empty.
Types ¶
type EtcdClient ¶
type EtcdClient interface { GetCluster() []string Get(key string, sort, recursive bool) (*etcd.Response, error) Set(key, value string, ttl uint64) (*etcd.Response, error) Create(key, value string, ttl uint64) (*etcd.Response, error) CompareAndSwap(key, value string, ttl uint64, prevValue string, prevIndex uint64) (*etcd.Response, error) Delete(key string, recursive bool) (*etcd.Response, error) // I'd like to use directional channels here (e.g. <-chan) but this interface mimics // the etcd client interface which doesn't, and it doesn't seem worth it to wrap the api. Watch(prefix string, waitIndex uint64, recursive bool, receiver chan *etcd.Response, stop chan bool) (*etcd.Response, error) }
EtcdClient is an injectable interface for testing.
Click to show internal directories.
Click to hide internal directories.