etcdv3

package
v0.0.0-...-730ab85 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyCreate = iota
	KeyUpdate
	KeyDelete
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func (*Client) ConnectStatus

func (client *Client) ConnectStatus() error

func (*Client) GetCount

func (client *Client) GetCount(ctx context.Context, prefix string) (int64, error)

func (*Client) GetFirstKey

func (client *Client) GetFirstKey(ctx context.Context, prefix string) (string, error)

func (*Client) GetPrefix

func (client *Client) GetPrefix(ctx context.Context, prefix string) (map[string][]byte, error)

func (*Client) GetPrefixLimit

func (client *Client) GetPrefixLimit(ctx context.Context, key string, limit int64) (map[string][]byte, error)

func (*Client) GetValue

func (client *Client) GetValue(ctx context.Context, key string) ([]byte, error)

func (*Client) NewRegistry

func (client *Client) NewRegistry() *Registry

func (*Client) NewWatch

func (client *Client) NewWatch(key string) (*Watcher, error)

func (*Client) NewWatchWithPrefixKey

func (client *Client) NewWatchWithPrefixKey(prefixKey string) (*Watcher, error)

func (*Client) PutNotExist

func (client *Client) PutNotExist(ctx context.Context, key, value string) ([]byte, error)

put a key not exist

func (*Client) Transfer

func (client *Client) Transfer(from string, to string, value string) (bool, error)

func (*Client) Update

func (client *Client) Update(ctx context.Context, key, value, oldValue string) error

type Event

type Event struct {
	Type  int
	Key   string
	Value []byte
}

type Option

type Option func(*Options)

type Options

type Options struct {
	Endpoints []string
	Timeout   int

	BasicAuth bool
	Username  string
	Password  string

	CertFile string
	KeyFile  string
	CaCert   string
}

func NewOptions

func NewOptions(opts ...Option) *Options

func (*Options) Build

func (opt *Options) Build() *Client

func (*Options) BuildConfig

func (opt *Options) BuildConfig() clientv3.Config

type Registry

type Registry struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Registry) Deregister

func (e *Registry) Deregister(key string) error

func (*Registry) Register

func (e *Registry) Register(key, value string, ttl int64) error

type Watcher

type Watcher struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*Watcher) Next

func (w *Watcher) Next() (*Event, error)

func (*Watcher) Stop

func (w *Watcher) Stop()

func (*Watcher) Type

func (w *Watcher) Type() string

Jump to

Keyboard shortcuts

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