etcdv3

package
v0.0.0-...-0b7460b Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EtcdConfigAutoSyncInterval = time.Minute * 5

EtcdConfigAutoSyncInterval give a choice to those etcd cluster could not auto sync such I deploy clusters in docker they will dial tcp: lookup etcd1: Try again, can just set this to zero

Functions

This section is empty.

Types

type EtcdV3

type EtcdV3 struct {
	AllowKeyNotFound bool
	// contains filtered or unexported fields
}

EtcdV3 is the receiver type for the Store interface

func (*EtcdV3) AtomicDelete

func (s *EtcdV3) AtomicDelete(key string, previous *store.KVPair) (bool, error)

func (*EtcdV3) AtomicPut

func (s *EtcdV3) AtomicPut(key string, value []byte, previous *store.KVPair, options *store.WriteOptions) (bool, *store.KVPair, error)

func (*EtcdV3) Close

func (s *EtcdV3) Close()

Close closes the client connection

func (*EtcdV3) Delete

func (s *EtcdV3) Delete(key string) error

func (*EtcdV3) DeleteTree

func (s *EtcdV3) DeleteTree(directory string) error

func (*EtcdV3) Exists

func (s *EtcdV3) Exists(key string) (bool, error)

func (*EtcdV3) Get

func (s *EtcdV3) Get(key string) (*store.KVPair, error)

Get a value given its key

func (*EtcdV3) List

func (s *EtcdV3) List(directory string) ([]*store.KVPair, error)

func (*EtcdV3) NewLock

func (s *EtcdV3) NewLock(key string, options *store.LockOptions) (store.Locker, error)

func (*EtcdV3) Put

func (s *EtcdV3) Put(key string, value []byte, options *store.WriteOptions) error

Put a value at the specified key

func (*EtcdV3) Watch

func (s *EtcdV3) Watch(key string, stopCh <-chan struct{}) (<-chan *store.KVPair, error)

Watch for changes on a key

func (*EtcdV3) WatchTree

func (s *EtcdV3) WatchTree(directory string, stopCh <-chan struct{}) (<-chan []*store.KVPair, error)

type EtcdV3RegisterPlugin

type EtcdV3RegisterPlugin struct {
	// service address, for example, tcp@127.0.0.1:8972, quic@127.0.0.1:1234
	ServiceAddress string
	// etcd addresses
	EtcdServers []string
	// base path for rpcx server, for example com/example/rpcx
	BasePath string
	Metrics  metrics.Registry
	// Registered services
	Services []string

	UpdateInterval time.Duration
	Expired        time.Duration

	Options *store.Config
	// contains filtered or unexported fields
}

EtcdV3RegisterPlugin implements etcd registry.

func (*EtcdV3RegisterPlugin) HandleConnAccept

func (p *EtcdV3RegisterPlugin) HandleConnAccept(conn net.Conn) (net.Conn, bool)

HandleConnAccept handles connections from clients

func (*EtcdV3RegisterPlugin) PreCall

func (p *EtcdV3RegisterPlugin) PreCall(_ context.Context, _, _ string, args interface{}) (interface{}, error)

PreCall handles rpc call from clients

func (*EtcdV3RegisterPlugin) Register

func (p *EtcdV3RegisterPlugin) Register(name string, rcvr interface{}, metadata string) (err error)

Register handles registering event. this service is registered at BASE/serviceName/thisIpAddress node

func (*EtcdV3RegisterPlugin) RegisterFunction

func (p *EtcdV3RegisterPlugin) RegisterFunction(serviceName, fname string, fn interface{}, metadata string) error

func (*EtcdV3RegisterPlugin) Start

func (p *EtcdV3RegisterPlugin) Start() error

Start starts to connect etcd cluster

func (*EtcdV3RegisterPlugin) Stop

func (p *EtcdV3RegisterPlugin) Stop() error

Stop unregister all services.

func (*EtcdV3RegisterPlugin) Unregister

func (p *EtcdV3RegisterPlugin) Unregister(name string) (err error)

Jump to

Keyboard shortcuts

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