etcd

package
v0.0.50-alpha.126 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2026 License: Apache-2.0 Imports: 25 Imported by: 11

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(ctx context.Context, etcdServers []string, etcdRoot string, createIfNotExist bool, options ...CfgOption) error

Check verifies if etcd is running by checking the existence of the root node and optionally creates it with a lease

Types

type CfgOption

type CfgOption func(*clientv3.Config)

CfgOption defines a function type for modifying clientv3.Config

func WithDialTimeout

func WithDialTimeout(timeout time.Duration) CfgOption

WithDialTimeout sets a custom dial timeout for the etcd client

func WithMaxCallSendMsgSize

func WithMaxCallSendMsgSize(size int) CfgOption

WithMaxCallSendMsgSize sets a custom max call send message size for the etcd client

func WithUsernameAndPassword

func WithUsernameAndPassword(username, password string) CfgOption

WithUsernameAndPassword sets a username and password for the etcd client

type SvcDiscoveryRegistryImpl

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

SvcDiscoveryRegistryImpl implementation

func NewSvcDiscoveryRegistry

func NewSvcDiscoveryRegistry(rootDirectory string, endpoints []string, watchNames []string, options ...CfgOption) (*SvcDiscoveryRegistryImpl, error)

NewSvcDiscoveryRegistry creates a new service discovery registry implementation

func (SvcDiscoveryRegistryImpl) AddOption

func (cp SvcDiscoveryRegistryImpl) AddOption(opts ...grpc.DialOption)

AddOption appends gRPC dial options to the existing options

func (*SvcDiscoveryRegistryImpl) Close

func (r *SvcDiscoveryRegistryImpl) Close()

func (SvcDiscoveryRegistryImpl) DelData

func (h SvcDiscoveryRegistryImpl) DelData(ctx context.Context, key string) error

func (*SvcDiscoveryRegistryImpl) GetClient

func (r *SvcDiscoveryRegistryImpl) GetClient() *clientv3.Client

func (SvcDiscoveryRegistryImpl) GetConn

func (cp SvcDiscoveryRegistryImpl) GetConn(ctx context.Context, serviceName string, opts ...grpc.DialOption) (grpc.ClientConnInterface, error)

GetConn returns a single gRPC client connection for a given service name

func (SvcDiscoveryRegistryImpl) GetConns

func (cp SvcDiscoveryRegistryImpl) GetConns(ctx context.Context, serviceName string, opts ...grpc.DialOption) ([]grpc.ClientConnInterface, error)

GetConns returns gRPC client connections for a given service name

func (SvcDiscoveryRegistryImpl) GetKey

func (h SvcDiscoveryRegistryImpl) GetKey(ctx context.Context, key string) ([]byte, error)

func (SvcDiscoveryRegistryImpl) GetKeyWithPrefix

func (h SvcDiscoveryRegistryImpl) GetKeyWithPrefix(ctx context.Context, key string) ([][]byte, error)

func (SvcDiscoveryRegistryImpl) GetSelfConnTarget

func (r SvcDiscoveryRegistryImpl) GetSelfConnTarget() string

GetSelfConnTarget returns the connection target for the current service

func (SvcDiscoveryRegistryImpl) IsSelfNode

func (r SvcDiscoveryRegistryImpl) IsSelfNode(cc grpc.ClientConnInterface) bool

IsSelfNode checks if the given client conn connects to the current service

func (SvcDiscoveryRegistryImpl) Register

func (r SvcDiscoveryRegistryImpl) Register(ctx context.Context, serviceName, host string, port int, opts ...grpc.DialOption) error

Register registers a new service endpoint with etcd

func (SvcDiscoveryRegistryImpl) SetKey

func (h SvcDiscoveryRegistryImpl) SetKey(ctx context.Context, key string, data []byte) error

func (SvcDiscoveryRegistryImpl) SetWithLease

func (h SvcDiscoveryRegistryImpl) SetWithLease(ctx context.Context, key string, val []byte, ttl int64) error

func (SvcDiscoveryRegistryImpl) UnRegister

func (r SvcDiscoveryRegistryImpl) UnRegister() error

UnRegister removes the service endpoint from etcd

func (SvcDiscoveryRegistryImpl) WatchKey

func (h SvcDiscoveryRegistryImpl) WatchKey(ctx context.Context, key string, fn discovery.WatchKeyHandler) error

Jump to

Keyboard shortcuts

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