etcdkv

package
v0.54.1 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type KV

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

KV represents an etcd key-value store implementation.

func New

func New(cli *etcdv3.Client) *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 kv.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