etcd

package module
v0.1.16 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

README

etcd

A helper ETCD Client designed for use within Loophole Labs projects

Documentation

Index

Constants

View Source
const (
	DefaultTTL = 10
)

Variables

View Source
var (
	ErrDisabled            = errors.New("etcd is disabled")
	ErrSetDelete           = errors.New("set-delete failed")
	ErrSetIfNotExist       = errors.New("set-if-not-exists failed")
	ErrInvalidBatchRequest = errors.New("invalid batch request")
	ErrBatchRequestFailed  = errors.New("batch request failed")
)

Functions

This section is empty.

Types

type ETCD added in v0.1.10

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

ETCD is a wrapper for the etcd client

func New

func New(options *Options, loader loader.Loader, zapLogger *zap.Logger, logger *zerolog.Logger) (*ETCD, error)

func (*ETCD) Close added in v0.1.10

func (e *ETCD) Close() error

func (*ETCD) Delete added in v0.1.10

func (e *ETCD) Delete(ctx context.Context, key string) (*clientv3.DeleteResponse, error)

func (*ETCD) Get added in v0.1.10

func (e *ETCD) Get(ctx context.Context, key string) (*clientv3.GetResponse, error)

func (*ETCD) GetBatch added in v0.1.10

func (e *ETCD) GetBatch(ctx context.Context, keys ...string) (*clientv3.TxnResponse, error)

func (*ETCD) GetLimit added in v0.1.10

func (e *ETCD) GetLimit(ctx context.Context, key string, limit int64) (*clientv3.GetResponse, error)

func (*ETCD) GetPrefix added in v0.1.10

func (e *ETCD) GetPrefix(ctx context.Context, prefix string) (*clientv3.GetResponse, error)

func (*ETCD) Set added in v0.1.10

func (e *ETCD) Set(ctx context.Context, key string, value string) (*clientv3.PutResponse, error)

func (*ETCD) SetDelete added in v0.1.10

func (e *ETCD) SetDelete(ctx context.Context, key string, value string, delete string) error

func (*ETCD) SetExpiry added in v0.1.10

func (e *ETCD) SetExpiry(ctx context.Context, key string, value string, ttl time.Duration) (*clientv3.PutResponse, error)

func (*ETCD) SetIfNotExist added in v0.1.10

func (e *ETCD) SetIfNotExist(ctx context.Context, key string, value string) (*clientv3.TxnResponse, error)

func (*ETCD) SetIfNotExistExpiry added in v0.1.10

func (e *ETCD) SetIfNotExistExpiry(ctx context.Context, key string, value string, ttl time.Duration) (*clientv3.TxnResponse, error)

func (*ETCD) SetKeepAlive added in v0.1.10

func (e *ETCD) SetKeepAlive(ctx context.Context, key string, value string) (*clientv3.PutResponse, error)

func (*ETCD) Watch added in v0.1.10

func (e *ETCD) Watch(ctx context.Context, key string) clientv3.WatchChan

func (*ETCD) WatchPrefix added in v0.1.10

func (e *ETCD) WatchPrefix(ctx context.Context, prefix string) clientv3.WatchChan

type Options

type Options struct {
	LogName     string
	Disabled    bool
	SrvDomain   string
	ServiceName string
}

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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