etcdv3

package
v0.0.0-...-d6ac821 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*clientv3.Client
	// contains filtered or unexported fields
}

Client ...

func (*Client) DelPrefix

func (client *Client) DelPrefix(ctx context.Context, prefix string) (deleted int64, err error)

DelPrefix 按前缀删除

func (*Client) GetKeyValue

func (client *Client) GetKeyValue(ctx context.Context, key string) (kv *mvccpb.KeyValue, err error)

GetKeyValue queries etcd key, returns mvccpb.KeyValue

func (*Client) GetPrefix

func (client *Client) GetPrefix(ctx context.Context, prefix string) (map[string]string, error)

GetPrefix get prefix

func (*Client) GetValues

func (client *Client) GetValues(ctx context.Context, keys ...string) (map[string]string, error)

GetValues queries etcd for keys prefixed by prefix.

func (*Client) NewMutex

func (client *Client) NewMutex(key string) (mutex *Mutex, err error)

NewMutex ...

func (*Client) NewWatch

func (client *Client) NewWatch(prefix string) (*Watch, error)

NewWatch ...

type Config

type Config struct {
	Endpoints []string `json:"endpoints"`
	CertFile  string   `json:"certFile"`
	KeyFile   string   `json:"keyFile"`
	CaCert    string   `json:"caCert"`
	BasicAuth bool     `json:"basicAuth"`
	UserName  string   `json:"userName"`
	Password  string   `json:"-"`
	// 连接超时时间
	ConnectTimeout time.Duration `json:"connectTimeout"`
	Secure         bool          `json:"secure"`
	// 自动同步member list的间隔
	AutoSyncInterval time.Duration `json:"autoAsyncInterval"`
	// contains filtered or unexported fields
}

Config ...

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig 返回默认配置

func RawConfig

func RawConfig(key string) *Config

RawConfig ...

func StdConfig

func StdConfig(name string) *Config

StdConfig ...

func TemplateConfig

func TemplateConfig(name string) *Config

func (*Config) Build

func (config *Config) Build() *Client

Build ...

func (*Config) WithLogger

func (config *Config) WithLogger(logger *xlog.Logger) *Config

WithLogger ...

type Mutex

type Mutex struct {
	// contains filtered or unexported fields
}

Mutex ...

func (*Mutex) Lock

func (mutex *Mutex) Lock(timeout time.Duration) (err error)

Lock ...

func (*Mutex) Unlock

func (mutex *Mutex) Unlock() (err error)

Unlock ...

type Watch

type Watch struct {
	// contains filtered or unexported fields
}

Watch A watch only tells the latest revision

func (*Watch) C

func (w *Watch) C() chan *clientv3.Event

C ...

Jump to

Keyboard shortcuts

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