gossip

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExternalIP

func ExternalIP() (string, error)

ExternalIP returns the first non-loopback IPv4 address

Types

type Gossip

type Gossip struct {
	Enabled bool
	// contains filtered or unexported fields
}

Gossip is a struct that represents a gossip-based membership protocol implementation using the Memberlist library. It contains the following fields:

  • Enabled: a boolean that indicates if the gossip protocol is enabled.
  • memberList: a pointer to the memberlist.Memberlist instance, which manages the cluster membership and communication between nodes.

func InitMemberList

func InitMemberList(nodes []string, grpcPort int) (*Gossip, error)

InitMemberList initializes a memberlist instance with the provided seed nodes and config.

func (*Gossip) Shutdown

func (g *Gossip) Shutdown() error

Shutdown gracefully shuts down the memberlist instance.

func (*Gossip) SyncMemberList

func (g *Gossip) SyncMemberList() (nodes []string)

SyncMemberList returns a list of all nodes in the cluster.

type IGossip

type IGossip interface {
	// SyncMemberList retrieves the current list of nodes in the
	// gossip cluster and returns them as a slice of strings.
	SyncMemberList() (nodes []string)

	// Shutdown gracefully stops the gossip protocol and performs
	// any necessary cleanup. It returns an error if the shutdown
	// process encounters any issues.
	Shutdown() error
}

IGossip is an interface that represents the basic operations of a gossip-based membership protocol. Implementations of this interface should provide mechanisms for synchronizing cluster membership and managing the lifecycle of the gossip protocol.

Jump to

Keyboard shortcuts

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