Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExternalIP ¶
ExternalIP returns the first non-loopback IPv4 address
Types ¶
type IGossip ¶
type IGossip interface { SyncNodes(ctx context.Context, consistent *hash.ConsistentHash, nodeName, port 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.
func InitMemberList ¶
InitMemberList initializes a memberlist instance with the given
type Serf ¶ added in v0.4.7
Serf structure with the serf instance and EventCh channel
func NewSerfGossip ¶ added in v0.4.7
NewSerfGossip is a function that initializes and returns a new Serf instance
func (*Serf) Shutdown ¶ added in v0.4.7
Shutdown is a method on the Serf struct that gracefully shuts down the Serf agent. It first leaves the Serf cluster, and then shuts down the agent. It returns any errors that occurred during the shutdown process.
func (*Serf) SyncNodes ¶ added in v0.4.7
func (s *Serf) SyncNodes(ctx context.Context, consistent *hash.ConsistentHash, nodeName, port string)
SyncNodes is a method on the Serf struct that synchronizes nodes between the Serf cluster and the provided ConsistentHash. It adds new nodes that join the cluster, and removes nodes that leave or fail. The synchronization is done in a loop which continues indefinitely until the provided context is done.