registry

package
v0.0.0-...-5642128 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: Apache-2.0 Imports: 4 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 Registry

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

Registry handles service discovery by using serf. Registry helps with managing a cluster.

func New

func New(handler Handler, config Config) (*Registry, 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 (*Registry) Leave

func (r *Registry) Leave() error

Leave tells this member to leave the cluster.

func (*Registry) Members

func (r *Registry) 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