package v3discovery

import "go.etcd.io/etcd/server/v3/etcdserver/api/v3discovery"

Package v3discovery provides an implementation of the cluster discovery that is used by etcd with v3 client.

Index

Variables

var (
	ErrInvalidURL     = errors.New("discovery: invalid peer URL")
	ErrBadSizeKey     = errors.New("discovery: size key is bad")
	ErrSizeNotFound   = errors.New("discovery: size key not found")
	ErrFullCluster    = errors.New("discovery: cluster is full")
	ErrTooManyRetries = errors.New("discovery: too many retries")
)

Functions

func GetCluster

func GetCluster(lg *zap.Logger, cfg *DiscoveryConfig) (cs string, rerr error)

GetCluster will connect to the discovery service at the given endpoints and retrieve a string describing the cluster

func JoinCluster

func JoinCluster(lg *zap.Logger, cfg *DiscoveryConfig, id types.ID, config string) (cs string, rerr error)

JoinCluster will connect to the discovery service at the endpoints, and register the server represented by the given id and config to the cluster. The parameter `config` is supposed to be in the format "memberName=peerURLs", such as "member1=http://127.0.0.1:2380".

The final returned string has the same format as "--initial-cluster", such as "infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380".

Types

type DiscoveryConfig

type DiscoveryConfig struct {
	clientv3.ConfigSpec `json:"client"`
	Token               string `json:"token"`
}

Source Files

discovery.go

Version
v3.6.0 (latest)
Published
May 15, 2025
Platform
linux/amd64
Imports
12 packages
Last checked
1 hour ago

Tools for package owners.