etcdv3

package module
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 8 Imported by: 10 modules, 19 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

libkv-etcdv3-store

libkv only supports ETCD v2 API event if you use etcd 3.x.

This project implements a libkv store via etcd v3 API.

Documentation

Index

Constants

View Source
const (
	// ETCDV3 backend
	ETCDV3 store.Backend = "etcdv3"
)

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
⌂ 换网址