discovery

package
v1.10.11 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 18 Imported by: 0

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