sqlstore

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 12 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package sqlstore persists scheduled definitions and their occurrences.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

func New

func New(database *sql.DB, dialect db.Dialect) (*Store, error)

func (*Store) BacklogMetrics

func (s *Store) BacklogMetrics(ctx context.Context, tenant string) (int64, time.Time, error)

BacklogMetrics returns the count and oldest scheduled time of materialized pending occurrences for one tenant. The composite due index bounds the scan to that tenant's pending schedules; SQL work is admitted by the scheduler.

func (*Store) ClaimDue

func (s *Store) ClaimDue(ctx context.Context, tenant, jobName, owner string, now time.Time, lease time.Duration) (*scheduler.ScheduleOccurrence, error)

func (*Store) Complete

func (s *Store) Complete(ctx context.Context, occurrence scheduler.ScheduleOccurrence, nextRun, now time.Time) error

func (*Store) Ensure

func (s *Store) Ensure(ctx context.Context) error

func (*Store) InspectOpenWork

func (s *Store) InspectOpenWork(ctx context.Context, tenant contract.TenantID, module contract.ModuleID, limit uint16) ([]contract.ModuleBlocker, error)

func (*Store) MarkOutcomeUnknown

func (s *Store) MarkOutcomeUnknown(ctx context.Context, occurrence scheduler.ScheduleOccurrence, now time.Time, reason string) error

func (*Store) NextRunAt

func (s *Store) NextRunAt(ctx context.Context, tenant, jobName string) (time.Time, error)

NextRunAt returns the persisted cursor for one scheduled definition. It is a wake-up hint only; ClaimDue remains authoritative about whether work is due.

func (*Store) RegisterDefinition

func (s *Store) RegisterDefinition(ctx context.Context, tenant string, job *scheduler.JobConfig, digest string, firstRun, now time.Time) error

func (*Store) Renew

func (s *Store) Renew(ctx context.Context, occurrence scheduler.ScheduleOccurrence, now time.Time, lease time.Duration) error

Jump to

Keyboard shortcuts

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