cluster

package
v3.11.20 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cluster

type Cluster interface {
	// Join is used to take an existing members and performing state sync
	Join(ctx context.Context, addr ...string) error
	// Leave broadcast a leave message and stop listeners
	Leave(ctx context.Context) error
	// Ping is used to probe live status of the node
	Ping(ctx context.Context, node Node, payload []byte) error
	// Members returns the cluster members
	Members() ([]Node, error)
	// Broadcast send message for all members in cluster, if filter is not nil, nodes may be filtered
	// by key/value pairs
	Broadcast(ctx context.Context, msg Message, filter ...string) error
	// Unicast send message to single member in cluster
	Unicast(ctx context.Context, node Node, msg Message) error
	// Live returns cluster liveness
	Live() bool
	// Ready returns cluster readiness
	Ready() bool
	// Health returns cluster health
	Health() bool
}

Cluster interface used for cluster communication across nodes

type Message

type Message interface {
	// Header returns message headers
	Header() metadata.Metadata
	// Body returns broker message may be []byte slice or some go struct or interface
	Body() interface{}
}

Message sent to member in cluster

type Node

type Node interface {
	// Name returns node name
	Name() string
	// Address returns node address
	Address() string
	// Metadata returns node metadata
	Metadata() metadata.Metadata
}

Jump to

Keyboard shortcuts

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