Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompletedDelegate ¶
type InputDelegate ¶
type OutputDelegate ¶
type SyncJob ¶
type SyncJob[T any] struct { SyncJobOptions[T] // contains filtered or unexported fields }
func NewSyncJob ¶
func NewSyncJob[T any](options SyncJobOptions[T]) *SyncJob[T]
func NewSyncJobWithMetrics ¶
func NewSyncJobWithMetrics[T any](job *SyncJob[T], r prometheus.Registerer) *SyncJob[T]
NewSyncJobWithMetrics instruments an existing SyncJob with Prometheus histograms and returns the same job instance. It wraps the job's delegates to record durations.
Metrics exported (metric names use the job Name with hyphens/spaces replaced by underscores): - <name>_sync_run_seconds{job, status}: duration per full sync run (from InputDelegate to CompletedDelegate) - <name>_sync_item_seconds{job, status}: duration per processed item T (around OutputDelegate)
func (*SyncJob[T]) WithMetrics ¶
func (s *SyncJob[T]) WithMetrics(r prometheus.Registerer) *SyncJob[T]
type SyncJobOptions ¶
type SyncJobOptions[T any] struct { NumWorkers int InputDelegate InputDelegate[T] OutputDelegate threading.Handler[T] CompletedDelegate CompletedDelegate[T] ErrorCallback threading.ErrorCallback[T] SyncInterval time.Duration CronSchedule string NextRunDelegate func() time.Time BufferSize int Name string Elector leaderElection.Elector RetryPolicy threading.RetryPolicy MaxRetries int RetryAfterDuration time.Duration OnLeadershipLost func() // Called when transitioning from leader to non-leader FirstRunImmediately bool // If true, run immediately on startup, otherwise wait for SyncInterval or CronSchedule }
Click to show internal directories.
Click to hide internal directories.