etcd

package
v0.21.18 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2021 License: GPL-3.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 {
	// contains filtered or unexported fields
}

Client implements ring.KVClient for etcd.

func New

func New(cfg Config, codec codec.Codec) (*Client, error)

New makes a new Client.

func (*Client) CAS

func (p *Client) CAS(ctx context.Context, key string,
	f func(in interface{}) (out interface{}, retry bool, err error)) error

CAS implements kv.Client. TODO Test with lease

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, key string) error

Delete implements kv.Client.

func (*Client) Get

func (c *Client) Get(ctx context.Context, key string) (interface{}, error)

Get implements kv.Client.

func (*Client) List

func (c *Client) List(ctx context.Context, prefix string) ([]string, error)

List implements kv.Client.

func (*Client) WatchKey

func (c *Client) WatchKey(ctx context.Context, key string, f func(interface{}) bool)

WatchKey implements kv.Client.

func (*Client) WatchPrefix

func (c *Client) WatchPrefix(ctx context.Context, key string, f func(string, interface{}) bool)

WatchPrefix implements kv.Client.

type Config

type Config struct {
	Endpoints   []string          `yaml:"endpoints"`
	DialTimeout formats.Duration  `yaml:"dial_timeout"`
	MaxRetries  int               `yaml:"max_retries"`
	EnableTLS   bool              `yaml:"tls_enabled"`
	UserName    string            `yaml:"username"`
	Password    formats.Hide      `yaml:"password"`
	TLS         iTLS.ClientConfig `yaml:",inline"`
	TTL         formats.Duration  `yaml:"ttl"` // use with lease

	ZapLogger *zap.Logger `yaml:"-"`
}

Config for a new etcd.Client.

func (*Config) GetTLS

func (p *Config) GetTLS() (*tls.Config, error)

GetTLS sets the TLS config field with certs

Jump to

Keyboard shortcuts

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