etcdv3

package
v1.4.0-rc8 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConnDelay connection dalay
	ConnDelay = 3
	// MaxFailTimes max failure times
	MaxFailTimes = 15
	// RegistryETCDV3Client client name
	RegistryETCDV3Client = "etcd registry"
)

Variables

View Source
var (
	// ErrNilETCDV3Client ...
	ErrNilETCDV3Client = perrors.New("etcd raw client is nil") // full describe the ERR
	// ErrKVPairNotFound ...
	ErrKVPairNotFound = perrors.New("k/v pair not found")
)

Functions

func HandleClientRestart

func HandleClientRestart(r clientFacade)

HandleClientRestart ...

func ValidateClient

func ValidateClient(container clientFacade, opts ...Option) error

ValidateClient ...

Types

type Client

type Client struct {
	Wait sync.WaitGroup
	// contains filtered or unexported fields
}

Client ...

func (*Client) CleanKV

func (c *Client) CleanKV() error

CleanKV ...

func (*Client) Close

func (c *Client) Close()

Close ...

func (*Client) Create

func (c *Client) Create(k string, v string) error

Create ...

func (*Client) Delete

func (c *Client) Delete(k string) error

Delete ...

func (*Client) Done

func (c *Client) Done() <-chan struct{}

Done ...

func (*Client) Get

func (c *Client) Get(k string) (string, error)

Get ...

func (*Client) GetChildrenKVList

func (c *Client) GetChildrenKVList(k string) ([]string, []string, error)

GetChildrenKVList ...

func (*Client) RegisterTemp

func (c *Client) RegisterTemp(basePath string, node string) (string, error)

RegisterTemp ...

func (*Client) Valid

func (c *Client) Valid() bool

Valid ...

func (*Client) Watch

func (c *Client) Watch(k string) (clientv3.WatchChan, error)

Watch ...

func (*Client) WatchWithPrefix

func (c *Client) WatchWithPrefix(prefix string) (clientv3.WatchChan, error)

WatchWithPrefix ...

type EventListener

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

EventListener ...

func NewEventListener

func NewEventListener(client *Client) *EventListener

NewEventListener ...

func (*EventListener) Close

func (l *EventListener) Close()

Close ...

func (*EventListener) ListenServiceEvent

func (l *EventListener) ListenServiceEvent(key string, listener remoting.DataListener)

ListenServiceEvent is invoked by etcdv3 ConsumerRegistry::Registe/ etcdv3 ConsumerRegistry::get/etcdv3 ConsumerRegistry::getListener registry.go:Listen -> listenServiceEvent -> listenDirEvent -> ListenServiceNodeEvent

|
--------> ListenServiceNodeEvent

func (*EventListener) ListenServiceNodeEvent

func (l *EventListener) ListenServiceNodeEvent(key string, listener ...remoting.DataListener) bool

ListenServiceNodeEvent Listen on a spec key this method will return true when spec key deleted, this method will return false when deep layer connection lose

func (*EventListener) ListenServiceNodeEventWithPrefix

func (l *EventListener) ListenServiceNodeEventWithPrefix(prefix string, listener ...remoting.DataListener)

ListenServiceNodeEventWithPrefix Listen on a set of key with spec prefix

type Option

type Option func(*Options)

Option ...

func WithEndpoints

func WithEndpoints(endpoints ...string) Option

WithEndpoints ...

func WithHeartbeat

func WithHeartbeat(heartbeat int) Option

WithHeartbeat ...

func WithName

func WithName(name string) Option

WithName ...

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout ...

type Options

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

Options ...

Jump to

Keyboard shortcuts

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