etcd

package
v0.3.10-0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 11 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoSuchKey = errors.Error("No such key")
)

Functions

func CloseDefaultEtcdClient

func CloseDefaultEtcdClient() error

func InitDefaultEtcdClient

func InitDefaultEtcdClient(opt *SEtcdOptions, onKeepaliveFailure func()) error

Types

type SEtcdClient

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

func Default

func Default() *SEtcdClient

func NewEtcdClient

func NewEtcdClient(opt *SEtcdOptions, onKeepaliveFailure func()) (*SEtcdClient, error)

func (*SEtcdClient) Close

func (cli *SEtcdClient) Close() error

func (*SEtcdClient) Delete

func (cli *SEtcdClient) Delete(ctx context.Context, key string) ([]byte, error)

func (*SEtcdClient) Get

func (cli *SEtcdClient) Get(ctx context.Context, key string) ([]byte, error)

func (*SEtcdClient) GetClient

func (cli *SEtcdClient) GetClient() *clientv3.Client

func (*SEtcdClient) List

func (cli *SEtcdClient) List(ctx context.Context, prefix string) ([]SEtcdKeyValue, error)

func (*SEtcdClient) Put

func (cli *SEtcdClient) Put(ctx context.Context, key string, val string) error

func (*SEtcdClient) PutSession

func (cli *SEtcdClient) PutSession(ctx context.Context, key string, val string) error

func (*SEtcdClient) PutWithLease

func (cli *SEtcdClient) PutWithLease(ctx context.Context, key string, val string, ttlSeconds int64) error

func (*SEtcdClient) RestartSession

func (cli *SEtcdClient) RestartSession() error

func (*SEtcdClient) RestartSessionWithContext

func (cli *SEtcdClient) RestartSessionWithContext(ctx context.Context) error

func (*SEtcdClient) SessionLiving

func (cli *SEtcdClient) SessionLiving() bool

func (*SEtcdClient) Unwatch

func (cli *SEtcdClient) Unwatch(prefix string)

func (*SEtcdClient) Watch

func (cli *SEtcdClient) Watch(
	ctx context.Context, prefix string,
	onCreate TEtcdCreateEventFunc,
	onModify TEtcdModifyEventFunc,
	onDelete TEtcdDeleteEventFunc,
) error

type SEtcdKeyValue

type SEtcdKeyValue struct {
	Key   string
	Value []byte
}

type SEtcdOptions

type SEtcdOptions struct {
	EtcdEndpoint              []string `help:"etcd endpoints in format of addr:port"`
	EtcdTimeoutSeconds        int      `default:"5" help:"etcd dial timeout in seconds"`
	EtcdRequestTimeoutSeconds int      `default:"2" help:"etcd request timeout in seconds"`
	EtcdLeaseExpireSeconds    int      `default:"5" help:"etcd expire timeout in seconds"`

	EtcdNamspace string `help:"etcd namespace"`

	EtcdUsername string `help:"etcd username"`
	EtcdPassword string `help:"etcd password"`

	EtcdEnabldSsl     bool        `help:"enable SSL/TLS"`
	EtcdSslCertfile   string      `help:"ssl certification file"`
	EtcdSslKeyfile    string      `help:"ssl certification private key file"`
	EtcdSslCaCertfile string      `help:"ssl ca certification file"`
	TLSConfig         *tls.Config `help:"tls config"`
}

type SEtcdWatcher

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

func (*SEtcdWatcher) Cancel

func (w *SEtcdWatcher) Cancel()

type TEtcdCreateEventFunc

type TEtcdCreateEventFunc func(ctx context.Context, key, value []byte)

type TEtcdDeleteEventFunc

type TEtcdDeleteEventFunc func(ctx context.Context, key []byte)

type TEtcdModifyEventFunc

type TEtcdModifyEventFunc func(ctx context.Context, key, oldvalue, value []byte)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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