healthcheck

package
v0.30.0 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Receiver

type Receiver struct {
	OnTimeout chan struct{}
	// contains filtered or unexported fields
}

Receiver is a healthcheck receiver It will listen for heartbeat and check if the heartbeat is not received in a certain time If the heartbeat is not received in a certain time, it will send a timeout signal and stop to work The heartbeat timeout is a bit longer than the sender's healthcheck interval

func NewReceiver

func NewReceiver(log *log.Entry) *Receiver

NewReceiver creates a new healthcheck receiver and start the timer in the background

func (*Receiver) Heartbeat

func (r *Receiver) Heartbeat()

Heartbeat acknowledge the heartbeat has been received

func (*Receiver) Stop

func (r *Receiver) Stop()

Stop check the timeout and do not send new notifications

type Sender

type Sender struct {

	// HealthCheck is a channel to send health check signal to the peer
	HealthCheck chan struct{}
	// Timeout is a channel to the health check signal is not received in a certain time
	Timeout chan struct{}
	// contains filtered or unexported fields
}

Sender is a healthcheck sender It will send healthcheck signal to the receiver If the receiver does not receive the signal in a certain time, it will send a timeout signal and stop to work It will also stop if the context is canceled

func NewSender

func NewSender(log *log.Entry) *Sender

NewSender creates a new healthcheck sender

func (*Sender) OnHCResponse

func (hc *Sender) OnHCResponse()

OnHCResponse sends an acknowledgment signal to the sender

func (*Sender) StartHealthCheck

func (hc *Sender) StartHealthCheck(ctx context.Context)

Jump to

Keyboard shortcuts

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