Documentation ¶
Index ¶
- func BindYaml(path string, bind interface{}) error
- func GetDirNode(ctx context.Context, client *clientv3.Client, path string) (map[string]string, error)
- func GetNode(ctx context.Context, client *clientv3.Client, key string) (string, error)
- func NewElection(cli *XClientV3, key, val string, f func() error, ...) error
- func NewEtcdClientV3(opt *EtcdConfig) (*clientv3.Client, error)
- func NewMutex(cli *XClientV3, key string, f func() error, sopts ...concurrency.SessionOption) error
- func Watch(client *clientv3.Client, root string, op ...Option) error
- func WatchDirNode(ctx context.Context, client *clientv3.Client, path string, ...) error
- func WatchNode(ctx context.Context, client *clientv3.Client, path string, ...) error
- type ConvertFunc
- type EtcdConfig
- type MapConvert
- type ObjectConvert
- type Option
- type StrConvert
- type WatchDirNodeFunc
- type WatchNodeFunc
- type XClientV3
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDirNode ¶
func NewElection ¶
func NewElection(cli *XClientV3, key, val string, f func() error, sopts ...concurrency.SessionOption) error
NewElection NewElection
func NewEtcdClientV3 ¶
func NewEtcdClientV3(opt *EtcdConfig) (*clientv3.Client, error)
NewEtcdClientV3 NewEtcdClientV3
func NewMutex ¶
func NewMutex(cli *XClientV3, key string, f func() error, sopts ...concurrency.SessionOption) error
NewMutex NewMutex
func WatchDirNode ¶
Types ¶
type ConvertFunc ¶
type ConvertFunc func(data interface{}) error
func ObjectTo ¶
func ObjectTo(out interface{}) ConvertFunc
func StringTo ¶
func StringTo(action StrConvert) ConvertFunc
type EtcdConfig ¶
type EtcdConfig struct { Peers []string `yaml:"Peers" json:"Peers"` TimeoutSeconds int64 `yaml:"TimeoutSeconds" json:"TimeoutSeconds"` Root string `yaml:"Root" json:"Root"` UserName string `yaml:"Username" json:"Username"` Password string `yaml:"Password" json:"Password"` Cert string `yaml:"Cert" json:"Cert"` Key string `yaml:"Key" json:"Key"` CA string `yaml:"CA" json:"CA"` }
EtcdConfig EtcdConfig
type MapConvert ¶
type ObjectConvert ¶
type ObjectConvert func(data map[string]interface{})
type Option ¶
type Option struct { Key string Convert ConvertFunc }
type StrConvert ¶
type StrConvert func(data string)
type WatchDirNodeFunc ¶
type WatchNodeFunc ¶
type XClientV3 ¶
func NewEtcdCli ¶
func NewEtcdCli(opt *EtcdConfig) (*XClientV3, error)
func (*XClientV3) WatchDirNode ¶
func (h *XClientV3) WatchDirNode(key string, action WatchDirNodeFunc) error
Click to show internal directories.
Click to hide internal directories.