qetcd

package
v0.0.0-...-35fa672 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSchema = "default"
)

Variables

View Source
var (
	ActionDel = "del"
	ActionPut = "put"
)
View Source
var (
	ErrConf          = errors.New("conf error")
	ErrHasRegistered = errors.New("address has registed")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// etcd的地址 必须要
	EndPoints []string `toml:"endpoints" json:"endpoints"`
}

etcd的配置

type Op

type Op struct {
	// 配置文件
	C   *Config
	Id  clientv3.LeaseID
	Cli *clientv3.Client
	// contains filtered or unexported fields
}

func New

func New(c *Config) (*Op, error)

初始化

func (*Op) Close

func (o *Op) Close() error

func (*Op) DelItem

func (o *Op) DelItem(prefix, k string)

func (*Op) Get

func (o *Op) Get(ctx context.Context, prefix string) (map[string]string, error)

func (*Op) GetWatch

func (o *Op) GetWatch(prefix string) map[string]string

func (*Op) PutItem

func (o *Op) PutItem(prefix, k, v string)

func (*Op) Register

func (o *Op) Register(ctx context.Context, kvs map[string]string, ttl int64) error

去etcd注册

func (*Op) Revoke

func (o *Op) Revoke() error

func (*Op) SetStateChangeCallback

func (o *Op) SetStateChangeCallback(prefix string, stateChange StateChangeCallBackFunc)

func (*Op) Watch

func (o *Op) Watch(prefix string)

type StateChangeCallBackFunc

type StateChangeCallBackFunc func(string, string, map[string]string)

Jump to

Keyboard shortcuts

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