Documentation ¶
Index ¶
- Constants
- func CreateEntities(ctx context.Context, factoryFunc database.EntityFactoryFunc, ...) (<-chan database.Entity, <-chan error)
- func SetChecksums(ctx context.Context, entities <-chan database.Entity, ...) (<-chan database.Entity, <-chan error)
- func YieldAll(ctx context.Context, c *redis.Client, subject *common.SyncSubject) (<-chan database.Entity, <-chan error)
- type Heartbeat
- type HeartbeatMessage
Constants ¶
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.
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 ¶
NewHeartbeat returns a new Heartbeat and starts the heartbeat controller loop.
func (*Heartbeat) Close ¶
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 ¶
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
LastMessageTime returns the last message's time in ms.
func (*Heartbeat) LastReceived ¶
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.