source

package
v1.8.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PrioritySource

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

PrioritySource wraps two sources and prioritizes reading from 'recovery' before 'primary'.

func NewPrioritySource

func NewPrioritySource(recovery, primary hermod.Source, logger hermod.Logger) *PrioritySource

func (*PrioritySource) Ack

func (s *PrioritySource) Ack(ctx context.Context, msg hermod.Message) error

func (*PrioritySource) Close

func (s *PrioritySource) Close() error

func (*PrioritySource) GetLag

func (s *PrioritySource) GetLag(ctx context.Context) (uint64, error)

GetLag reports the outstanding work held by the wrapped sources.

Embedding or wrapping a source does not carry its optional interfaces across, and every lag-based check downstream — workflow status, WAL-retention alerting, and the stall watchdog's "is any work outstanding?" question (pkg/engine/stall.go:164) — reads zero when the assertion fails. Zero lag on a wedged CDC pipeline is indistinguishable from an idle healthy one, so the wedge goes unreported for as long as it lasts. This is the same defect already found and fixed in MetricsSource (pkg/comm/source/decorators.go:120).

func (*PrioritySource) GetState

func (s *PrioritySource) GetState() map[string]string

func (*PrioritySource) IsReady

func (s *PrioritySource) IsReady(ctx context.Context) error

IsReady runs each wrapped source's deep readiness check, falling back to Ping for sources that do not have one.

Without this, wrapping a source for DLQ priority downgraded the engine's health check from the CDC-aware IsReady (which verifies wal_level, that the replication slot exists and is active, and that the publication is present — pkg/comm/source/postgres/postgres.go:1671) to a plain connection Ping, which keeps returning healthy long after replication has stopped.

func (*PrioritySource) LastStreamActivity

func (s *PrioritySource) LastStreamActivity() time.Time

LastStreamActivity reports the primary source's stream liveness. Only the primary holds a replication stream; the recovery source is a dead-letter queue being drained, which has no server-push cadence to vouch for.

func (*PrioritySource) PendingWork

func (s *PrioritySource) PendingWork() (pending bool, known bool)

PendingWork reports whether either wrapped source is still owed acknowledgements: a DLQ being drained holds outstanding work just as a primary stream does.

func (*PrioritySource) Ping

func (s *PrioritySource) Ping(ctx context.Context) error

func (*PrioritySource) Read

func (*PrioritySource) SetLogger

func (s *PrioritySource) SetLogger(l hermod.Logger)

SetLogger forwards the engine's logger to both wrapped sources and keeps a copy for this wrapper's own DLQ-priority reporting.

func (*PrioritySource) SetState

func (s *PrioritySource) SetState(state map[string]string)

func (*PrioritySource) StreamSilenceThreshold

func (s *PrioritySource) StreamSilenceThreshold() time.Duration

StreamSilenceThreshold reports the primary source's silence deadline.

Jump to

Keyboard shortcuts

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