discovery

package
v0.0.0-...-3f89aaf Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Nodename acts as the node's unique identifier
	// across the cluster.
	NodeName string

	// BindAddr is used by Serf for gossiping.
	BindAddr string

	// Tags are shared to other nodes, they are used
	// to inform the cluster how to handle the node.
	Tags map[string]string

	// StartJoinAddrs is used to configure how to
	// add new nodes to an existing cluster.
	StartJoinAddrs []string
}

Config holds node configuration.

type Handler

type Handler interface {
	Join(name, addr string) error
	Leave(name string) error
}

Handler represents a component in a service that needs to know when a server joins or leaves the cluster.

type Membership

type Membership struct {
	Config
	// contains filtered or unexported fields
}

Membership is a Serf wrapper to provide discovery and cluster membership to services.

func New

func New(handler Handler, config Config) (*Membership, error)

New is a factory function to create a Membership.

func (*Membership) Leave

func (m *Membership) Leave() error

Leave removes a member from the cluster.

func (*Membership) Members

func (m *Membership) Members() []serf.Member

Members returns all members in the cluster.

Jump to

Keyboard shortcuts

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