v3discovery

package
v3.0.0-...-eac99ac Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

View Source
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"`
}

Jump to

Keyboard shortcuts

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