etcd

package
v1.15.2 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: Apache-2.0 Imports: 19 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 kv.Client for etcd.

func New

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

New makes a new Client.

func NewInMemoryClient added in v1.13.0

func NewInMemoryClient(codec codec.Codec, logger log.Logger) (*Client, io.Closer)

NewInMemoryClient creates an Etcd Client implementation that uses an in-memory version of the underlying Etcd client.

func (*Client) CAS

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

CAS implements kv.Client.

func (*Client) Delete added in v1.1.0

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) LastUpdateTime added in v1.15.0

func (c *Client) LastUpdateTime(_ string) time.Time

func (*Client) List added in v1.1.0

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 Clientv3Facade added in v1.13.0

type Clientv3Facade interface {
	clientv3.KV
	clientv3.Watcher
}

Clientv3Facade is a subset of all Etcd client operations that are required to implement an Etcd version of kv.Client

type Config

type Config struct {
	Endpoints   []string               `yaml:"endpoints"`
	DialTimeout time.Duration          `yaml:"dial_timeout"`
	MaxRetries  int                    `yaml:"max_retries"`
	EnableTLS   bool                   `yaml:"tls_enabled"`
	TLS         cortextls.ClientConfig `yaml:",inline"`

	UserName string `yaml:"username"`
	Password string `yaml:"password"`
}

Config for a new etcd.Client.

func (*Config) GetTLS added in v1.4.0

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

GetTLS sets the TLS config field with certs

func (*Config) RegisterFlags

func (cfg *Config) RegisterFlags(f *flag.FlagSet)

func (*Config) RegisterFlagsWithPrefix

func (cfg *Config) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string)

RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet.

Jump to

Keyboard shortcuts

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