manager

package
v0.0.0-...-0194b68 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2024 License: GPL-3.0 Imports: 3 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       string
	BindAddr       string
	Tags           map[string]string
	StartJoinAddrs []string
}

Config has all the configurable fields for Registry.

type Handler

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

Handler represents a interface to a internal handler that also needs information about any possible joins or leaves. In actual use the store.Store is passed here because Raft needs to know of any possible changes to the cluster.

type Manager

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

Manager handles service discovery and keeping track of the nodes currently in the cluster.

func New

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

New creates a registry instance and sets up serf for service discovery. This function starts up the whole registry functionality by running an event handler, connection to existing nodes and managing possible joins/leaves.

func (*Manager) Leave

func (r *Manager) Leave() error

Leave tells this member to leave the cluster.

func (*Manager) Members

func (r *Manager) Members() []serf.Member

Members returns a point-in-time snapshot of the cluster's members.

Jump to

Keyboard shortcuts

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