etcdkv

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.58.0

type Config struct {
	Endpoints            []string      `fig:"endpoints"`
	Username             string        `fig:"username"`
	Password             string        `fig:"password"`
	DialTimeout          time.Duration `fig:"dial_timeout" default:"20s"`
	DialKeepAliveTime    time.Duration `fig:"dial_keep_alive_time" default:"30s"`
	DialKeepAliveTimeout time.Duration `fig:"dial_keep_alive_timeout" default:"10s"`
	KeepAliveTime        time.Duration `fig:"keep_alive" default:"10s"`
	Timeout              time.Duration `fig:"keep_alive" default:"20m"`
}

Config contains etcd configuration parameters.

type KV

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

KV represents an etcd key-value store implementation.

func New

func New(cfg Config, logger kitlog.Logger) *KV

New returns a new etcd key-value store instance.

func (*KV) Del

func (k *KV) Del(ctx context.Context, key string) error

Del deletes a value associated to a given key.

func (*KV) Get

func (k *KV) Get(ctx context.Context, key string) ([]byte, error)

Get retrieves a value associated to a given key.

func (*KV) GetPrefix

func (k *KV) GetPrefix(ctx context.Context, prefix string) (map[string][]byte, error)

GetPrefix retrieves all values whose key matches prefix.

func (*KV) Put

func (k *KV) Put(ctx context.Context, key string, value string) error

Put stores a new value associated to a given key.

func (*KV) Start

func (k *KV) Start(ctx context.Context) error

Start initializes etcd key-value store.

func (*KV) Stop

func (k *KV) Stop(ctx context.Context) error

Stop closes etcd underlying connection.

func (*KV) Watch

func (k *KV) Watch(ctx context.Context, prefix string, withPrevVal bool) <-chan kvtypes.WatchResp

Watch watches on a key or prefix.

Jump to

Keyboard shortcuts

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