discovery

package
v1.10.41 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

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

func NewCluster

func NewCluster(d Discoverer) *Cluster

func (*Cluster) AllNeighborAddresses

func (c *Cluster) AllNeighborAddresses(port int) []string

func (*Cluster) AssignedShardIndex

func (c *Cluster) AssignedShardIndex(key string) int

func (*Cluster) IsAssigned

func (c *Cluster) IsAssigned(key string) bool

func (*Cluster) IsLeader

func (c *Cluster) IsLeader() bool

func (*Cluster) MyAddress

func (c *Cluster) MyAddress(port int) (addr string, ok bool)

func (*Cluster) MyShardIndex

func (c *Cluster) MyShardIndex() int

func (*Cluster) Size

func (c *Cluster) Size() int

func (*Cluster) Start

func (c *Cluster) Start(ctx context.Context) error

type Discoverer

type Discoverer interface {
	// Watch watches for changes in the list of IPs and sends updates through the returned channel.
	// The context can be used to stop watching.
	//
	// Returned results are sorted by IP and are expected to pass the validateTargets func.
	Watch(ctx context.Context) (<-chan []Target, error)
}

func NewK8sDiscoverer

func NewK8sDiscoverer(svcName string) (Discoverer, error)

func NewSingleDiscoverer

func NewSingleDiscoverer(myIP string) Discoverer

type Target

type Target struct {
	IP string
	Me bool
}

Jump to

Keyboard shortcuts

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