etcd

package
v0.0.0-...-dd115e8 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

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

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 NewEmbeddded

func NewEmbeddded(options *Options, embedded *embed.Etcd, zapLogger *zap.Logger, logger *zerolog.Logger) (*ETCD, error)

func (*ETCD) Close

func (e *ETCD) Close() error

func (*ETCD) Delete

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

func (*ETCD) DeleteAll

func (e *ETCD) DeleteAll(ctx context.Context, prefix string) error

func (*ETCD) DeleteIf

func (e *ETCD) DeleteIf(ctx context.Context, key string, condition kvstore.Condition) error

func (*ETCD) Exists

func (e *ETCD) Exists(ctx context.Context, key string) (bool, error)

func (*ETCD) Get

func (e *ETCD) Get(ctx context.Context, key string) ([]byte, uint64, error)

func (*ETCD) GetAll

func (e *ETCD) GetAll(ctx context.Context, prefix string) (kvstore.Entries, error)

func (*ETCD) GetAllKeys

func (e *ETCD) GetAllKeys(ctx context.Context, prefix string) ([]string, error)

func (*ETCD) GetBatch

func (e *ETCD) GetBatch(ctx context.Context, keys ...string) (kvstore.Entries, error)

func (*ETCD) GetFirst

func (e *ETCD) GetFirst(ctx context.Context, prefix string) (*kvstore.Entry, error)

func (*ETCD) GetLimit

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

func (*ETCD) Move

func (e *ETCD) Move(ctx context.Context, oldKey string, newKey string) error

func (*ETCD) MoveReplace

func (e *ETCD) MoveReplace(ctx context.Context, oldKey string, newKey string, value []byte) error

func (*ETCD) MoveReplaceIf

func (e *ETCD) MoveReplaceIf(ctx context.Context, oldKey string, newKey string, value []byte, condition kvstore.Condition) error

func (*ETCD) Set

func (e *ETCD) Set(ctx context.Context, key string, value []byte) error

func (*ETCD) SetDelete

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

func (*ETCD) SetEmpty

func (e *ETCD) SetEmpty(ctx context.Context, key string) error

func (*ETCD) SetExpiry

func (e *ETCD) SetExpiry(ctx context.Context, key string, value []byte, ttl time.Duration) error

func (*ETCD) SetIf

func (e *ETCD) SetIf(ctx context.Context, key string, value []byte, condition kvstore.Condition) error

func (*ETCD) SetIfNotExist

func (e *ETCD) SetIfNotExist(ctx context.Context, key string, value []byte) error

func (*ETCD) SetIfNotExistExpiry

func (e *ETCD) SetIfNotExistExpiry(ctx context.Context, key string, value []byte, ttl time.Duration) error

func (*ETCD) SetKeepAlive

func (e *ETCD) SetKeepAlive(ctx context.Context, key string, value []byte) error

func (*ETCD) Subscribe

func (e *ETCD) Subscribe(ctx context.Context, prefix string, handler kvstore.SubscriptionHandler) error

type Options

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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