xetcd

package
v0.0.0-...-80fcaa9 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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 Get

func Get(ctx context.Context, key string) (string, error)

func GetClientv3

func GetClientv3() (*clientv3.Client, error)

func GetRoot

func GetRoot() string

func GetWithFirstCreate

func GetWithFirstCreate(ctx context.Context, key string) (string, error)

func InitEtcdConifg

func InitEtcdConifg(opt *EtcdConfig) error

NewEtcdClientV3 NewEtcdClientV3

func LinkKey

func LinkKey(key string) string

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 Set

func Set(ctx context.Context, key, val string) error

func WatchDirNode

func WatchDirNode(ctx context.Context, path string, action WatchDirNodeFunc) error

func WatchNode

func WatchNode(ctx context.Context, path string, action WatchNodeFunc) 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

type EtcdClientv3Handler func() (*clientv3.Client, error)

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 WatchDirNodeFunc func(key, val string) error

type WatchNodeFunc

type WatchNodeFunc func(val string) error

Jump to

Keyboard shortcuts

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