etcd

package
v0.21.1 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("etcdwrapper: key not found")

Functions

func GetEtcdClient

func GetEtcdClient(ctx context.Context, certificates *Certificates, endpoints ...string) (*clientv3.Client, error)

GetEtcdClient returns an etcd client connected to the specified endpoints. If no endpoints are provided, endpoints are retrieved from the provided runtime config. If the runtime config does not list any endpoints, the default endpoint is used. The returned client should be closed when no longer needed, in order to avoid leaking GRPC client goroutines.

func WaitForEtcd added in v0.21.0

func WaitForEtcd(parentCtx context.Context, certificates *Certificates, endpoints ...string) error

Types

type Certificates

type Certificates struct {
	CaCert     string
	ServerCert string
	ServerKey  string
}

type Client added in v0.21.0

type Client interface {
	List(ctx context.Context, key string) ([]Value, error)
	Watch(ctx context.Context, key string) clientv3.WatchChan
	Get(ctx context.Context, key string) (Value, error)
	Put(ctx context.Context, key string, value []byte) error
	Delete(ctx context.Context, key string) error
	Close() error
}

func New added in v0.21.0

func New(ctx context.Context, certificates *Certificates, endpoints ...string) (Client, error)

func NewFromConfig added in v0.21.0

func NewFromConfig(ctx context.Context, vConfig *config.VirtualClusterConfig) (Client, error)

type Value added in v0.21.0

type Value struct {
	Key      []byte
	Data     []byte
	Modified int64
}

Jump to

Keyboard shortcuts

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