Documentation
¶
Index ¶
- type Cluster
- func (c *Cluster) AllNeighborAddresses(port int) []string
- func (c *Cluster) AssignedShardIndex(key string) int
- func (c *Cluster) IsAssigned(key string) bool
- func (c *Cluster) IsLeader() bool
- func (c *Cluster) MyAddress(port int) (addr string, ok bool)
- func (c *Cluster) MyShardIndex() int
- func (c *Cluster) Size() int
- func (c *Cluster) Start(ctx context.Context) error
- type Discoverer
- type Target
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 (*Cluster) AssignedShardIndex ¶
func (*Cluster) IsAssigned ¶
func (*Cluster) MyShardIndex ¶
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
Click to show internal directories.
Click to hide internal directories.