etcdv3

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(addrs []string, options *store.Config) (store.Store, error)

New creates a new Etcd client given a list of endpoints and an optional tls config

func Register

func Register()

Register registers etcd to libkv

Types

type EtcdV3

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

EtcdV3 is the receiver type for the Store interface

func (*EtcdV3) AtomicDelete

func (s *EtcdV3) AtomicDelete(key string, previous *store.KVPair) (bool, error)

AtomicDelete cas deletes a single value

func (*EtcdV3) AtomicPut

func (s *EtcdV3) AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)

AtomicPut CAS operation on a single value. Pass previous = nil to create a new key.

func (*EtcdV3) Close

func (s *EtcdV3) Close()

Close closes the client connection

func (*EtcdV3) Delete

func (s *EtcdV3) Delete(key string) error

Delete the value at the specified key

func (*EtcdV3) DeleteTree

func (s *EtcdV3) DeleteTree(directory string) error

DeleteTree deletes a range of keys under a given directory

func (*EtcdV3) Exists

func (s *EtcdV3) Exists(key string) (bool, error)

Exists verifies if a Key exists in the store

func (*EtcdV3) Get

func (s *EtcdV3) Get(key string) (*store.KVPair, error)

Get a value given its key

func (*EtcdV3) List

func (s *EtcdV3) List(directory string) ([]*store.KVPair, error)

List the content of a given prefix

func (*EtcdV3) NewLock

func (s *EtcdV3) NewLock(key string, options *store.LockOptions) (store.Locker, error)

NewLock creates a lock for a given key. The returned Locker is not held and must be acquired with `.Lock`. The Value is optional.

func (*EtcdV3) Put

func (s *EtcdV3) Put(key string, value []byte, options *store.WriteOptions) error

Put a value at the specified key

func (*EtcdV3) Watch

func (s *EtcdV3) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error)

Watch for changes on a key

func (*EtcdV3) WatchTree

func (s *EtcdV3) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error)

WatchTree watches for changes on child nodes under a given directory

Jump to

Keyboard shortcuts

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