etcd

package
v0.0.0-...-0450f2b Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 19 Imported by: 4

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

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

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 Clientv3Facade

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" category:"advanced"`
	MaxRetries  int                `yaml:"max_retries" category:"advanced"`
	EnableTLS   bool               `yaml:"tls_enabled" category:"advanced"`
	TLS         dstls.ClientConfig `yaml:",inline"`

	UserName string         `yaml:"username"`
	Password flagext.Secret `yaml:"password"`
}

Config for a new etcd.Client.

func (*Config) GetTLS

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