zEtcd

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2022 License: LGPL-2.1 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventCreate      = EventType(1) //  create event
	EventModify      = EventType(2) //  update event
	EventDelete      = EventType(3) //  delete event
	EventWatchCancel = EventType(4) //  cancel event
	EventChannelSize = 32
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	LogPrint LogPrintFunc
	// contains filtered or unexported fields
}

func NewEtcdClient

func NewEtcdClient(config *ClientConfig) (*Client, error)

func (*Client) Close

func (cli *Client) Close() error

func (*Client) Delete

func (cli *Client) Delete(ctx context.Context, key string) error

func (*Client) Get

func (cli *Client) Get(ctx context.Context, key string, isPrefix bool) ([]keyValue, error)

func (*Client) GetOne

func (cli *Client) GetOne(ctx context.Context, key string) (string, error)

func (*Client) KeepAlive

func (cli *Client) KeepAlive(ctx context.Context, key, value string, ttl int64) (int64, error)

func (*Client) KeepAliveOnce

func (cli *Client) KeepAliveOnce(ctx context.Context, leaseId int64) error

func (*Client) Put

func (cli *Client) Put(ctx context.Context, key, value string) error

func (*Client) PutWithNotExist

func (cli *Client) PutWithNotExist(ctx context.Context, key, value string) error

func (*Client) PutWithNotExistTTL

func (cli *Client) PutWithNotExistTTL(ctx context.Context, key, value string, ttl int64) (int64, error)

func (*Client) PutWithTTL

func (cli *Client) PutWithTTL(ctx context.Context, key, value string, ttl int64) (int64, error)

func (*Client) Revoke

func (cli *Client) Revoke(ctx context.Context, leaseId int64) error

func (*Client) SetLogPrint

func (cli *Client) SetLogPrint(lpf LogPrintFunc) *Client

func (*Client) Watch

func (cli *Client) Watch(ctx context.Context, key string, isPrefix bool) (clientV3.Watcher, chan *WatchEvent)

type ClientConfig

type ClientConfig struct {
	Endpoints   []string
	UserName    string
	Password    string
	DialTimeout time.Duration
}

type EventType

type EventType int

type KeyChangeChan

type KeyChangeChan <-chan *WatchEvent

type LogPrintFunc

type LogPrintFunc func(v ...any)

type WatchEvent

type WatchEvent struct {
	Event EventType
	Data  keyValue
}

Jump to

Keyboard shortcuts

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