etcdutil

package
v1.2.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEtcdKVGet         = coderr.NewCodeError(coderr.Internal, "etcd KV get failed")
	ErrEtcdKVGetResponse = coderr.NewCodeError(coderr.Internal, "etcd invalid get value response must only one")
	ErrEtcdKVGetNotFound = coderr.NewCodeError(coderr.Internal, "etcd KV get value not found")
)

Functions

func CleanConfig

func CleanConfig(cfg *embed.Config)

CleanConfig is used to clean the etcd data for the unit test purpose.

func Get added in v0.4.0

func Get(ctx context.Context, client *clientv3.Client, key string) (string, error)

func List added in v1.2.0

func List(ctx context.Context, client *clientv3.Client, prefix string) ([]string, error)

func NewTestSingleConfig

func NewTestSingleConfig() *embed.Config

NewTestSingleConfig is used to create an etcd config for the unit test purpose.

func Scan added in v0.4.0

func Scan(ctx context.Context, client *clientv3.Client, startKey, endKey string, batchSize int, do func(key string, val []byte) error) error

Types

type CloseFn added in v0.4.0

type CloseFn = func()

func PrepareEtcdServerAndClient added in v0.4.0

func PrepareEtcdServerAndClient(t *testing.T) (*embed.Etcd, *clientv3.Client, CloseFn)

PrepareEtcdServerAndClient makes the server and client for testing.

Caller should take responsibilities to close the server and client.

type EtcdLeaderGetter

type EtcdLeaderGetter interface {
	EtcdLeaderID() (uint64, error)
}

type LeaderGetterWrapper

type LeaderGetterWrapper struct {
	Server *etcdserver.EtcdServer
}

func (*LeaderGetterWrapper) EtcdLeaderID

func (w *LeaderGetterWrapper) EtcdLeaderID() (uint64, error)

Jump to

Keyboard shortcuts

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