etcd

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrKeyNotFound is thrown when the key is not found in the store during a Get operation
	ErrKeyNotFound = errors.New("key not found")
	ErrKeyModified = errors.New("unable to complete atomic operation, key modified")
)

Functions

func FromEtcdError

func FromEtcdError(err error) error

Types

type Config

type Config struct {
	Logger        *zap.Logger
	Endpoints     string
	Prefix        string
	CertFile      string
	KeyFile       string
	CAFile        string
	SkipTLSVerify bool

	CompactionInterval time.Duration
}

type ListPagedContinuation

type ListPagedContinuation struct {
	Revision int64
	LastKey  string
}

type ListPagedResp

type ListPagedResp struct {
	Resp         *clientv3.GetResponse
	HasMore      bool
	Continuation *ListPagedContinuation
}

type Store

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

func New

func New(cfg Config) (*Store, error)

func (*Store) AtomicDelete

func (s *Store) AtomicDelete(ctx context.Context, key string, revision int64) (*etcdclientv3.TxnResponse, error)

func (*Store) AtomicPut

func (s *Store) AtomicPut(ctx context.Context, key string, value []byte, prevRevision int64, options *WriteOptions) (*etcdclientv3.TxnResponse, error)

func (*Store) Client

func (s *Store) Client() *etcdclientv3.Client

func (*Store) Close

func (s *Store) Close() error

func (*Store) Delete

func (s *Store) Delete(ctx context.Context, key string) error

func (*Store) DeletePrefix added in v0.1.1

func (s *Store) DeletePrefix(ctx context.Context, prefix string) error

func (*Store) Get

func (s *Store) Get(ctx context.Context, key string, revision int64) (*etcdclientv3.GetResponse, error)

func (*Store) List

func (s *Store) List(ctx context.Context, directory, start string, revision int64) (*etcdclientv3.GetResponse, error)

func (*Store) ListPaged

func (s *Store) ListPaged(ctx context.Context, directory string, revision, limit int64, continuation *ListPagedContinuation) (*ListPagedResp, error)

func (*Store) Put

func (s *Store) Put(ctx context.Context, key string, value []byte, options *WriteOptions) (*etcdclientv3.PutResponse, error)

func (*Store) Watch

func (s *Store) Watch(ctx context.Context, prefix string, revision int64) etcdclientv3.WatchChan

func (*Store) WatchKey

func (s *Store) WatchKey(ctx context.Context, prefix string, revision int64) etcdclientv3.WatchChan

type WriteOptions

type WriteOptions struct {
	TTL time.Duration
}

Jump to

Keyboard shortcuts

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