gossip

package
v0.0.0-...-15f65a9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(config Config) (*cluster, error)

func NewClusterServer

func NewClusterServer(svc *cluster, logger logging.Logger) *clusterServer

Types

type Cluster

type Cluster interface {
	SubscribeJoinEvents(callerName string) <-chan Member
	SubscribeLeaveEvents(callerName string) <-chan Member
	Join(ctx context.Context, addrs ...string) error
	Shutdown(ctx context.Context) error
}

type Config

type Config struct {
	Logger logging.Logger

	NodeId  string
	RpcAddr string

	// How frequently to gossip with other members
	GossipInterval time.Duration

	// Timeout for gossip requests, if a member doesn't respond within this time, it is considered a
	// suspect
	GossipTimeout time.Duration

	// Each interval, a member will gossip to this many other members
	GossipFactor int
}

type Member

type Member struct {
	NodeId  string
	RpcAddr string
}

func (Member) Hash

func (m Member) Hash() []byte

Hash returns a hash of the member to detect duplicates or changes.

Jump to

Keyboard shortcuts

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