heartbeat

package
v1.5.2 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HeartbeatMessageType is the message type for heartbeats
	HeartbeatMessageType = "heartbeat"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v1.4.0

type Client interface {
	SendHeartbeat(ctx context.Context, sequence uint64) error
	Close(ctx context.Context) error
}

type HeartbeatClient

type HeartbeatClient struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(conn *nats.Conn, nodeID string, publisher ncl.Publisher) (*HeartbeatClient, error)

func (*HeartbeatClient) Close

func (h *HeartbeatClient) Close(ctx context.Context) error

func (*HeartbeatClient) SendHeartbeat

func (h *HeartbeatClient) SendHeartbeat(ctx context.Context, sequence uint64) error

type HeartbeatServer

type HeartbeatServer struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(params HeartbeatServerParams) (*HeartbeatServer, error)

func (*HeartbeatServer) FilterNodeInfos

func (h *HeartbeatServer) FilterNodeInfos(nodeInfos []*models.NodeInfo, state models.NodeConnectionState) []*models.NodeInfo

FilterNodeInfos will return only those NodeInfos that have the requested liveness

func (*HeartbeatServer) Handle

func (h *HeartbeatServer) Handle(ctx context.Context, heartbeat messages.Heartbeat) error

Handle will handle a message received through the legacy heartbeat topic

func (*HeartbeatServer) HandleMessage added in v1.5.0

func (h *HeartbeatServer) HandleMessage(ctx context.Context, message *envelope.Message) error

HandleMessage will handle a message received through ncl and will call the Handle method

func (*HeartbeatServer) RemoveNode

func (h *HeartbeatServer) RemoveNode(nodeID string)

RemoveNode will handle removing the liveness for a specific node. This is useful when a node is removed from the cluster.

func (*HeartbeatServer) ShouldProcess added in v1.5.0

func (h *HeartbeatServer) ShouldProcess(ctx context.Context, message *envelope.Message) bool

func (*HeartbeatServer) Start

func (h *HeartbeatServer) Start(ctx context.Context) error

func (*HeartbeatServer) UpdateNodeInfo

func (h *HeartbeatServer) UpdateNodeInfo(state *models.NodeState)

UpdateNode will add the liveness for specific nodes to their NodeInfo

type HeartbeatServerParams

type HeartbeatServerParams struct {
	NodeID                string
	Client                *nats.Conn
	Clock                 clock.Clock
	NodeDisconnectedAfter time.Duration
}

type TimestampedHeartbeat

type TimestampedHeartbeat struct {
	messages.Heartbeat
	Timestamp int64
}

Jump to

Keyboard shortcuts

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