Help us shape the future of Go! Take the 2026 Go Developer Survey

maintenance

package
v0.0.0-...-e9258a2 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package maintenance holds Temporal workflows and activities for cross-cutting database maintenance — currently the recurring ensure pass that keeps core.webhook_events' monthly RANGE partitions provisioned ahead of need (design.md D3, webhook-partition-maintenance spec).

Index

Constants

View Source
const (
	// WebhookPartitionEnsureScheduleID is the unique identifier for the
	// webhook_events partition ensure schedule.
	WebhookPartitionEnsureScheduleID = "webhook-partition-ensure"
	// WebhookPartitionEnsureWorkflowID is the workflow ID used for
	// schedule-triggered ensure runs. Schedule-spawned runs carry a
	// timestamp-suffixed workflow ID on top of this base
	// (design.md Risks/Trade-offs — resolve via the schedule handle, not a
	// bespoke ID lookup).
	WebhookPartitionEnsureWorkflowID = "webhook-partition-ensure-workflow"
	// DefaultWebhookPartitionEnsureInterval is the default interval between
	// scheduled ensure runs.
	DefaultWebhookPartitionEnsureInterval = 24 * time.Hour
)

Variables

This section is empty.

Functions

func EnsureWebhookPartitionsWorkflow

func EnsureWebhookPartitionsWorkflow(ctx workflow.Context) error

EnsureWebhookPartitionsWorkflow keeps core.webhook_events' monthly RANGE partitions provisioned ahead of need. It runs on a recurring schedule as the backstop to the console's own boot pass: the boot pass covers every deployment on every restart, Temporal-configured or not, but a deployment that runs for longer than the partition lookahead window without restarting needs this schedule to keep extending it (design.md D3, webhook-partition-maintenance spec, "Long-running deployment never exhausts partitions").

Types

type Activities

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

Activities holds dependencies for webhook_events partition-maintenance activities.

func NewActivities

func NewActivities(database *sql.DB, logger *slog.Logger) *Activities

NewActivities constructs an Activities ready for registration.

func (*Activities) EnsureWebhookPartitionsActivity

func (a *Activities) EnsureWebhookPartitionsActivity(ctx context.Context) (EnsureWebhookPartitionsOutput, error)

EnsureWebhookPartitionsActivity creates any missing monthly RANGE partitions of core.webhook_events for the current month through db.DefaultWebhookPartitionMonthsAhead months ahead. It is idempotent (CREATE TABLE IF NOT EXISTS), so re-running it — on the recurring schedule this backs, or racing the console's own boot pass — changes nothing it should not.

type EnsureWebhookPartitionsOutput

type EnsureWebhookPartitionsOutput struct {
	MonthsAhead int
}

EnsureWebhookPartitionsOutput reports one ensure pass.

type ScheduleManager

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

ScheduleManager manages the Temporal schedule for webhook_events partition maintenance.

func NewScheduleManager

func NewScheduleManager(c client.Client, logger *slog.Logger) *ScheduleManager

NewScheduleManager creates a new ScheduleManager.

func (*ScheduleManager) EnsureWebhookPartitionSchedule

func (m *ScheduleManager) EnsureWebhookPartitionSchedule(ctx context.Context, cfg WebhookPartitionScheduleConfig) error

EnsureWebhookPartitionSchedule creates or updates the webhook_events partition ensure schedule. If the schedule already exists, it updates the spec; otherwise it creates it (describe-then-update, mirroring internal/workflows/domains/schedule.go's EnsureExpirySweepSchedule).

type WebhookPartitionScheduleConfig

type WebhookPartitionScheduleConfig struct {
	// Interval is how often to run the ensure workflow.
	Interval time.Duration
	// TriggerImmediately runs the ensure workflow immediately when creating
	// the schedule. The webhook-partition-maintenance spec requires this
	// (unlike the domains claim expiry sweep, whose boot pass is deliberately
	// the only immediate run): "Recurring Temporal schedule keeps partitions
	// extended" SHALL trigger one run immediately on registration.
	TriggerImmediately bool
}

WebhookPartitionScheduleConfig holds configuration for the ensure schedule.

Jump to

Keyboard shortcuts

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