icingaredis

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2025 License: GPL-2.0 Imports: 18 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const Timeout = time.Minute

Timeout defines how long a heartbeat may be absent if a heartbeat has already been received. After this time, a heartbeat loss is propagated.

Variables

This section is empty.

Functions

func CreateEntities

func CreateEntities(ctx context.Context, factoryFunc database.EntityFactoryFunc, pairs <-chan redis.HPair, concurrent int) (<-chan database.Entity, <-chan error)

CreateEntities streams and creates entities from the given Redis field value pairs using the specified factory function, and streams them on a returned channel.

func SetChecksums

func SetChecksums(ctx context.Context, entities <-chan database.Entity, checksums map[string]database.Entity, concurrent int) (<-chan database.Entity, <-chan error)

SetChecksums concurrently streams from the given entities and sets their checksums using the specified map and streams the results on a returned channel.

func YieldAll added in v1.2.1

func YieldAll(ctx context.Context, c *redis.Client, subject *common.SyncSubject) (<-chan database.Entity, <-chan error)

YieldAll yields all entities from Redis that belong to the specified SyncSubject.

Types

type Heartbeat

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

Heartbeat periodically reads heartbeats from a Redis stream and signals in Beat channels when they are received. Also signals on if the heartbeat is Lost.

func NewHeartbeat

func NewHeartbeat(ctx context.Context, client *redis.Client, logger *logging.Logger) *Heartbeat

NewHeartbeat returns a new Heartbeat and starts the heartbeat controller loop.

func (*Heartbeat) Close

func (h *Heartbeat) Close() error

Close stops the heartbeat controller loop, waits for it to finish, and returns an error if any. Implements the io.Closer interface.

func (*Heartbeat) Done

func (h *Heartbeat) Done() <-chan struct{}

Done returns a channel that will be closed when the heartbeat controller loop has ended.

func (*Heartbeat) Err

func (h *Heartbeat) Err() error

Err returns an error if Done has been closed and there is an error. Otherwise returns nil.

func (*Heartbeat) Events

func (h *Heartbeat) Events() <-chan *HeartbeatMessage

Events returns a channel that is sent to on heartbeat events.

A non-nil pointer signals that a heartbeat was received from Icinga 2 whereas a nil pointer signals a heartbeat loss.

func (*Heartbeat) LastMessageTime added in v1.2.1

func (h *Heartbeat) LastMessageTime() int64

LastMessageTime returns the last message's time in ms.

func (*Heartbeat) LastReceived

func (h *Heartbeat) LastReceived() int64

LastReceived returns the last heartbeat's receive time in ms.

type HeartbeatMessage

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

HeartbeatMessage represents a heartbeat received from Icinga 2 together with a timestamp when it was received.

func (*HeartbeatMessage) EnvironmentID

func (m *HeartbeatMessage) EnvironmentID() (types.Binary, error)

EnvironmentID returns the Icinga DB environment ID stored in the heartbeat message.

func (*HeartbeatMessage) ExpiryTime

func (m *HeartbeatMessage) ExpiryTime() time.Time

ExpiryTime returns the timestamp when the heartbeat expires.

func (*HeartbeatMessage) Stats

func (m *HeartbeatMessage) Stats() *v1.StatsMessage

Stats returns the underlying heartbeat message from the icinga:stats stream.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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