Documentation ¶
Index ¶
- func Election(ctx context.Context, key, val string, fn MutexHandler, ...) error
- func Get(ctx context.Context, key string) (string, error)
- func GetClientv3() (*clientv3.Client, error)
- func GetRoot() string
- func GetWithFirstCreate(ctx context.Context, key string) (string, error)
- func InitEtcdConifg(opt *EtcdConfig) error
- func LinkKey(key string) string
- func Mutex(key string, f MutexHandler, sopts ...concurrency.SessionOption) error
- func MutexLoopHandler(key string, fn MutexHandler, sopts ...concurrency.SessionOption) error
- func Set(ctx context.Context, key, val string) error
- func WatchDirNode(ctx context.Context, path string, action WatchDirNodeFunc) error
- func WatchNode(ctx context.Context, path string, action WatchNodeFunc) error
- type ConvertFunc
- type ElectSignal
- type EtcdClientv3Handler
- type EtcdConfig
- type MutexHandler
- type Option
- type WatchDirNodeFunc
- type WatchNodeFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Election ¶
func Election(ctx context.Context, key, val string, fn MutexHandler, sopts ...concurrency.SessionOption) error
NewElection NewElection
func GetClientv3 ¶
func Mutex ¶
func Mutex(key string, f MutexHandler, sopts ...concurrency.SessionOption) error
Mutex Mutex
func MutexLoopHandler ¶
func MutexLoopHandler(key string, fn MutexHandler, sopts ...concurrency.SessionOption) error
func WatchDirNode ¶
func WatchDirNode(ctx context.Context, path string, action WatchDirNodeFunc) error
Types ¶
type ConvertFunc ¶
type ConvertFunc func(data interface{}) error
type ElectSignal ¶
type ElectSignal struct {
// contains filtered or unexported fields
}
func NewElectSignal ¶
func NewElectSignal(num int) *ElectSignal
func (*ElectSignal) GetSignal ¶
func (c *ElectSignal) GetSignal() bool
func (*ElectSignal) Release ¶
func (c *ElectSignal) Release() bool
type EtcdClientv3Handler ¶
EtcdConfig EtcdConfig
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 MutexHandler ¶
type MutexHandler func() error
type Option ¶
type Option struct { Key string Convert ConvertFunc }
type WatchDirNodeFunc ¶
type WatchNodeFunc ¶
Click to show internal directories.
Click to hide internal directories.