checkpoints

package
v1.1.25 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 6 Imported by: 1 module, 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

Index

Constants

View Source
const DefaultCheckpointName = "default"

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	Name              string    `json:"name" gorm:"primaryKey;autoIncrement:false"`
	Job               string    `json:"job" gorm:"primaryKey;autoIncrement:false"`
	LastCompletedTime time.Time `json:"lastCompletedTime" gorm:"type:timestamptz"`
}

type CheckpointQuery

type CheckpointQuery struct {
	Name string `json:"name,omitempty"`
	Job  string `json:"job,omitempty"`
}

type CheckpointRepository

type CheckpointRepository interface {
	database.Repository
	SetCheckpoint(checkpoint *Checkpoint) error
	ListCheckpoints() ([]*Checkpoint, error)
	QueryCheckpoints(query *CheckpointQuery) ([]*Checkpoint, error)
	GetCheckpoint(query *CheckpointQuery) (*Checkpoint, error)

	ResetAllCheckpoints(newCheckpointTime time.Time) error
	ResetCheckpoints(request *ResetCheckpointsRequest) error
	// EnforceMinimumCheckpointTime advances lingering checkpoints to the minimum, except the rows
	// named in excludeNames — rows a caller manages itself, where a checkpoint sitting in the past
	// is a deliberate instruction to re-meter rather than a leftover.
	EnforceMinimumCheckpointTime(minimum time.Time, excludeNames []string) error
}

func NewPostgresqlCheckpointRepository

func NewPostgresqlCheckpointRepository() CheckpointRepository

type ListCheckpointsResult

type ListCheckpointsResult struct {
	Checkpoints []*Checkpoint `json:"checkpoints"`
}

type PostgresqlCheckpointRepository

type PostgresqlCheckpointRepository struct {
	database.Repository
	// contains filtered or unexported fields
}

func (*PostgresqlCheckpointRepository) EnforceMinimumCheckpointTime

func (r *PostgresqlCheckpointRepository) EnforceMinimumCheckpointTime(minimum time.Time, excludeNames []string) error

EnforceMinimumCheckpointTime sets all non-default checkpoints to the given minimum time, except the rows named in excludeNames. Excluded rows are the ones the metering engine advances itself: force-advancing one of those would silently cancel a checkpoint reset — the hours between the reset and the minimum would never be metered, with nothing failing.

func (*PostgresqlCheckpointRepository) GetCheckpoint

func (r *PostgresqlCheckpointRepository) GetCheckpoint(query *CheckpointQuery) (*Checkpoint, error)

func (*PostgresqlCheckpointRepository) Initialize

func (r *PostgresqlCheckpointRepository) Initialize(connection database.Connection) error

func (*PostgresqlCheckpointRepository) ListCheckpoints

func (r *PostgresqlCheckpointRepository) ListCheckpoints() ([]*Checkpoint, error)

func (*PostgresqlCheckpointRepository) QueryCheckpoints

func (r *PostgresqlCheckpointRepository) QueryCheckpoints(query *CheckpointQuery) ([]*Checkpoint, error)

func (*PostgresqlCheckpointRepository) ResetAllCheckpoints

func (r *PostgresqlCheckpointRepository) ResetAllCheckpoints(newCheckpointTime time.Time) error

func (*PostgresqlCheckpointRepository) ResetCheckpoints

func (r *PostgresqlCheckpointRepository) ResetCheckpoints(request *ResetCheckpointsRequest) error

func (*PostgresqlCheckpointRepository) SetCheckpoint

func (r *PostgresqlCheckpointRepository) SetCheckpoint(checkpoint *Checkpoint) error

type QueryCheckpointsRequest

type QueryCheckpointsRequest struct {
	CheckpointQuery
}

type QueryCheckpointsResult

type QueryCheckpointsResult struct {
	Checkpoints []*Checkpoint `json:"checkpoints"`
}

type ResetCheckpointsRequest

type ResetCheckpointsRequest struct {
	NewCheckpointTime time.Time `json:"newCheckpointTime"`
	CheckpointQuery
}

Jump to

Keyboard shortcuts

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