Documentation ¶
Index ¶
- type EtcdClient
- type OnChangeCallback
- type SimpleEtcdClient
- func (etcdClient *SimpleEtcdClient) Del(key string) error
- func (etcdClient *SimpleEtcdClient) DelDir(key string) error
- func (etcdClient *SimpleEtcdClient) Get(key string) (string, error)
- func (etcdClient *SimpleEtcdClient) Ls(directory string) ([]string, error)
- func (etcdClient *SimpleEtcdClient) LsRecursive(directory string) ([]string, error)
- func (etcdClient *SimpleEtcdClient) MkDir(directory string) error
- func (etcdClient *SimpleEtcdClient) Set(key, value string) error
- func (etcdClient *SimpleEtcdClient) UpdateDirWithTTL(key string, ttl time.Duration) error
- func (etcdClient *SimpleEtcdClient) WatchRecursive(directory string, onChange OnChangeCallback) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EtcdClient ¶
type EtcdClient interface { // Del deletes a key from Etcd Del(key string) error // DelDir deletes a dir from Etcd DelDir(key string) error // Get gets a value in Etcd Get(key string) (string, error) // Set sets a value in Etcd Set(key, value string) error // UpdateDirWithTTL updates a directory with a ttl value UpdateDirWithTTL(key string, ttl time.Duration) error // Ls returns all the keys available in the directory Ls(directory string) ([]string, error) // LsRecursive returns all the keys available in the directory, recursively LsRecursive(directory string) ([]string, error) // MkDir creates an empty etcd directory MkDir(directory string) error // WatchRecursive watches a directory and calls the callback everytime something changes. // The callback is called with the key of the thing that changed along with the value // that the thing was changed to. // This method only returns if there is an error WatchRecursive(directory string, onChangeCallback OnChangeCallback) error }
EtcdClient interface lets your Get/Set from Etcd
type OnChangeCallback ¶
type OnChangeCallback func(key, newValue string)
OnChangeCallback is used for passing callbacks to WatchRecursive
type SimpleEtcdClient ¶
type SimpleEtcdClient struct {
// contains filtered or unexported fields
}
SimpleEtcdClient implements EtcdClient
func (*SimpleEtcdClient) Del ¶
func (etcdClient *SimpleEtcdClient) Del(key string) error
Del deletes a key from Etcd
func (*SimpleEtcdClient) DelDir ¶
func (etcdClient *SimpleEtcdClient) DelDir(key string) error
DelDir deletes a dir from Etcd
func (*SimpleEtcdClient) Get ¶
func (etcdClient *SimpleEtcdClient) Get(key string) (string, error)
Get gets a value in Etcd
func (*SimpleEtcdClient) Ls ¶
func (etcdClient *SimpleEtcdClient) Ls(directory string) ([]string, error)
Ls returns all the keys available in the directory
func (*SimpleEtcdClient) LsRecursive ¶
func (etcdClient *SimpleEtcdClient) LsRecursive(directory string) ([]string, error)
LsRecursive returns all the keys available in the directory, recursively
func (*SimpleEtcdClient) MkDir ¶
func (etcdClient *SimpleEtcdClient) MkDir(directory string) error
MkDir creates an empty etcd directory
func (*SimpleEtcdClient) Set ¶
func (etcdClient *SimpleEtcdClient) Set(key, value string) error
Set sets a value in Etcd
func (*SimpleEtcdClient) UpdateDirWithTTL ¶
func (etcdClient *SimpleEtcdClient) UpdateDirWithTTL(key string, ttl time.Duration) error
UpdateDirWithTTL updates a directory with a ttl value
func (*SimpleEtcdClient) WatchRecursive ¶
func (etcdClient *SimpleEtcdClient) WatchRecursive(directory string, onChange OnChangeCallback) error
WatchRecursive watches a directory and calls the callback everytime something changes. The callback is called with the key of the thing that changed along with the value that the thing was changed to. This method only returns if there is an error