etcdx

package
v1.1.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientX

type ClientX struct {
	*clientv3.Client
	// contains filtered or unexported fields
}

func NewClientX

func NewClientX(client *clientv3.Client, logger Logger) *ClientX

func (*ClientX) TryLease

func (x *ClientX) TryLease(ctx context.Context, key string, value string, opts ...WithLeaseOptions) (func(context.Context), error)

func (*ClientX) Watch

func (x *ClientX) Watch(ctx context.Context, key string, callback WatchCallback, opts ...WithWatchOptions) error

Watch 监听指定 key 这是一个同步的函数,会阻塞直到 ctx 超时或者出错

type LogLevel

type LogLevel string
const (
	LogLevelERROR LogLevel = "ERROR"
	LogLevelINFO  LogLevel = "INFO"
	LogLevelWARN  LogLevel = "WARN"
	LogLevelDEBUG LogLevel = "DEBUG"
)

type Logger

type Logger interface {
	Logf(level LogLevel, template string, args ...interface{})
	Logw(level LogLevel, keyPairs ...interface{})
}

type TargetNode

type TargetNode struct {
	Key   string
	Value string
}

type WatchCallback

type WatchCallback interface {
	BatchSet([]TargetNode)
	BatchDelete([]string)
	Reset()
}

type WithLeaseOptions

type WithLeaseOptions func(*leaseOptions)

func WithLeaseTTL

func WithLeaseTTL(ttl int64) WithLeaseOptions

type WithWatchOptions

type WithWatchOptions func(*watchOptions)

func WithWatchPrefix

func WithWatchPrefix() WithWatchOptions

WithWatchPrefix 是否监听前缀

func WithWatchSessionTTL

func WithWatchSessionTTL(ttl int) WithWatchOptions

WithWatchSessionTTL 探活指针探活间隔(秒)

Jump to

Keyboard shortcuts

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