discovery

package
v2.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventJoin = iota
	EventLeave
	EventFailed
	EventUpdate
	EventReap
)
View Source
const (
	TagRaftPort = "raft-port"
	TagGrpcPort = "grpc-port"
)

Variables

This section is empty.

Functions

func GenMemberAddrs

func GenMemberAddrs(ms []Member) (addrs []string)

func GenNodesFile

func GenNodesFile(file string, ms []Member) error

Types

type Event

type Event struct {
	Member
	Type int
}

type Member

type Member struct {
	Name string            `json:"name"`
	Addr string            `json:"addr"`
	Port int               `json:"port"`
	Tags map[string]string `json:"tags,omitempty"`
}

func ReadMembers

func ReadMembers(file string) []Member

type Node

type Node interface {
	Setup() error
	Stop()
	BindMqttServer(server *mqtt.Server)
	LocalAddr() string
	LocalName() string
	Members() []Member
	EventChan() <-chan *Event
	SendToNode(nodeName string, msg []byte) error
	SendToOthers(msg []byte)
	Stat() map[string]int64
	Join(existing []string) (int, error)
	Leave() error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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