Documentation
¶
Index ¶
- type ClaimedScheduleFire
- type DispatchResult
- type DueScheduleTrigger
- type NotificationProducer
- type Option
- type PipelineExecutor
- type PipelineRetryProducer
- type Repository
- type RetryDecisionInput
- type ScheduleFireClaim
- type ScheduleFireClaimResult
- type ScheduleFireCompletion
- type ScheduleFireExecutionRef
- type ScheduleFireProducer
- type Service
- func (s *Service) DispatchDueSchedules(ctx context.Context, now time.Time) (DispatchResult, error)
- func (s *Service) ExecuteClaimedScheduleFire(ctx context.Context, args jobs.PipelineScheduleFireExecutionArgs) error
- func (s *Service) ExecuteTriggerRetryAttempt(ctx context.Context, args jobs.PipelineTriggerRetryExecutionArgs) error
- type TriggerRetryAttempt
- type TriggerRetryAttemptRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClaimedScheduleFire ¶
type ClaimedScheduleFire = pipelinetriggers.ClaimedScheduleFire
type DispatchResult ¶
type DispatchResult struct {
Scanned int
Claimed int
Enqueued int
SkippedDisabled int
SkippedMisfire int
AlreadyClaimed int
}
DispatchResult summarizes one scheduler scan for worker diagnostics and tests.
type DueScheduleTrigger ¶
type DueScheduleTrigger = pipelinetriggers.DueScheduleTrigger
type NotificationProducer ¶
type NotificationProducer = notificationsvc.CandidateProducer
NotificationProducer creates generic notification candidates for scheduler observations.
type Option ¶
type Option func(*Service)
Option customizes optional scheduler integrations.
func WithNotificationProducer ¶
func WithNotificationProducer(producer NotificationProducer) Option
WithNotificationProducer emits generic notification candidates for terminal retry decisions.
type PipelineExecutor ¶
type PipelineExecutor interface {
FailUnadmittedRun(context.Context, slug.Slug, slug.Slug, slug.Slug, slug.Slug) error
ReconcileInterruptedRuns(context.Context, time.Time) error
AcceptQueuedRun(context.Context, slug.Slug, slug.Slug, slug.Slug, slug.Slug, slug.Slug, pipelinerun.RunSourceSummary, time.Time, int64) error
StartQueuedRun(context.Context, slug.Slug, slug.Slug, slug.Slug, slug.Slug, time.Time) error
GetRun(context.Context, slug.Slug, slug.Slug, slug.Slug, string) (*pipelinesvc.PipelineRunDetail, error)
Execute(
ctx context.Context,
orgSlug, projectSlug, environmentSlug, pipelineSlug slug.Slug,
runSlug *slug.Slug,
protectedEnvironmentConfirmation *slug.Slug,
actor model.EventActor,
source pipelinerun.RunSourceSummary,
runtimeInput map[string]any,
) (*pipelinesvc.PipelineRunDetail, error)
ExecuteVersion(
ctx context.Context,
orgSlug, projectSlug, environmentSlug, pipelineSlug slug.Slug,
specHash string,
runSlug *slug.Slug,
protectedEnvironmentConfirmation *slug.Slug,
actor model.EventActor,
source pipelinerun.RunSourceSummary,
runtimeInput map[string]any,
) (*pipelinesvc.PipelineRunDetail, error)
}
PipelineExecutor is the existing pipeline run entrypoint used by the scheduler.
type PipelineRetryProducer ¶
type PipelineRetryProducer interface {
EnqueueTriggerRetryExecution(
ctx context.Context,
tx postgres.DBTX,
args jobs.PipelineTriggerRetryExecutionArgs,
) (queue.QueuedJob, error)
}
PipelineRetryProducer enqueues one trigger retry attempt into River.
type Repository ¶
type Repository interface {
ReconcileLogicalRunFinalizationsForSystem(context.Context, postgres.DBTX) error
ListPendingRunFinalizationsForSystem(context.Context, postgres.DBTX) ([]pipelinetriggers.PendingRunFinalization, error)
ListDelayedScheduleFiresForSystem(context.Context, postgres.DBTX, time.Time) ([]pipelinetriggers.DelayedScheduleFire, error)
ListDueScheduleTriggersForSystem(
ctx context.Context,
tx postgres.DBTX,
) ([]DueScheduleTrigger, error)
ClaimScheduleFire(
ctx context.Context,
tx postgres.DBTX,
claim ScheduleFireClaim,
) (ScheduleFireClaimResult, error)
LoadClaimedScheduleFire(
ctx context.Context,
tx postgres.DBTX,
ref ScheduleFireExecutionRef,
) (ClaimedScheduleFire, error)
MarkScheduleFireRunning(
ctx context.Context,
tx postgres.DBTX,
ref ScheduleFireExecutionRef,
) error
CompleteScheduleFire(
ctx context.Context,
tx postgres.DBTX,
completion ScheduleFireCompletion,
) error
RecordTriggerRetryAttempt(
ctx context.Context,
tx postgres.DBTX,
record TriggerRetryAttemptRecord,
) (TriggerRetryAttempt, error)
LoadTriggerRetryAttemptForExecution(
ctx context.Context,
tx postgres.DBTX,
orgSlug, projectSlug, environmentSlug, attemptSlug slug.Slug,
) (TriggerRetryAttempt, error)
MarkTriggerRetryAttemptRunning(
ctx context.Context,
tx postgres.DBTX,
orgSlug, projectSlug, environmentSlug, attemptSlug slug.Slug,
) error
CompleteTriggerRetryAttempt(
ctx context.Context,
tx postgres.DBTX,
orgSlug, projectSlug, environmentSlug, attemptSlug slug.Slug,
status model.PipelineTriggerRetryAttemptStatus,
sourceEventSlug *slug.Slug,
errorSummary *string,
) error
}
Repository defines the persistence operations required by schedule dispatch.
type RetryDecisionInput ¶
type RetryDecisionInput struct {
OrgSlug slug.Slug
ProjectSlug slug.Slug
EnvironmentSlug slug.Slug
TriggerSlug slug.Slug
TriggerRevision int64
PipelineSlug slug.Slug
VersionPolicy model.PipelineTriggerVersionPolicy
PipelineVersionSpecHash string
RuntimeInputKeys []string
RetryPolicy model.PipelineTriggerRetryPolicy
FailedRun *pipelinesvc.PipelineRunDetail
ExecutionError error
BaseAt time.Time
ElapsedBaseAt time.Time
}
RetryDecisionInput combines a captured policy with authoritative failed-run evidence.
type ScheduleFireClaim ¶
type ScheduleFireClaim = pipelinetriggers.ScheduleFireClaim
type ScheduleFireClaimResult ¶
type ScheduleFireClaimResult = pipelinetriggers.ScheduleFireClaimResult
type ScheduleFireCompletion ¶
type ScheduleFireCompletion = pipelinetriggers.ScheduleFireCompletion
type ScheduleFireExecutionRef ¶
type ScheduleFireExecutionRef = pipelinetriggers.ScheduleFireExecutionRef
type ScheduleFireProducer ¶
type ScheduleFireProducer interface {
EnqueueRunFinalization(context.Context, postgres.DBTX, queue.JobArgs) (queue.QueuedJob, error)
EnqueueScheduleFireExecution(
ctx context.Context,
tx postgres.DBTX,
args jobs.PipelineScheduleFireExecutionArgs,
) (queue.QueuedJob, error)
}
ScheduleFireProducer enqueues one claimed schedule fire into River.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service dispatches persisted schedule triggers into pipeline runs.
func New ¶
func New( txm postgres.TransactionManager, repo Repository, executor PipelineExecutor, producer ScheduleFireProducer, retryProducer PipelineRetryProducer, opts ...Option, ) *Service
New creates a schedule dispatcher using the repository and existing pipeline executor. Pass nil retryProducer only for callers that do not enqueue trigger retry attempts.
func (*Service) DispatchDueSchedules ¶
DispatchDueSchedules claims due schedule fires and enqueues one execution job per claimed fire.
func (*Service) ExecuteClaimedScheduleFire ¶
func (s *Service) ExecuteClaimedScheduleFire( ctx context.Context, args jobs.PipelineScheduleFireExecutionArgs, ) error
ExecuteClaimedScheduleFire executes one already-claimed schedule fire and records completion.
func (*Service) ExecuteTriggerRetryAttempt ¶
func (s *Service) ExecuteTriggerRetryAttempt( ctx context.Context, args jobs.PipelineTriggerRetryExecutionArgs, ) error
ExecuteTriggerRetryAttempt executes one queued retry attempt and records the terminal result.
type TriggerRetryAttempt ¶
type TriggerRetryAttempt = pipelinetriggers.TriggerRetryAttempt
type TriggerRetryAttemptRecord ¶
type TriggerRetryAttemptRecord = pipelinetriggers.TriggerRetryAttemptRecord
func BuildRetryAttempt ¶
func BuildRetryAttempt(input RetryDecisionInput) (TriggerRetryAttemptRecord, bool, error)
BuildRetryAttempt converts one failed run into a durable retry decision.