store

package
v0.0.0-...-7291e08 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package store persists operation runs and their materialized rack targets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PostgresStore

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

PostgresStore persists operation runs using PostgreSQL via bun.

func NewPostgresStore

func NewPostgresStore(pg *cdb.Session) *PostgresStore

NewPostgresStore creates a PostgreSQL-backed operation-run store.

func (*PostgresStore) Create

func (s *PostgresStore) Create(
	ctx context.Context,
	run *operationrun.OperationRun,
) (uuid.UUID, error)

Create implements Store.

func (*PostgresStore) CreateTargets

func (s *PostgresStore) CreateTargets(
	ctx context.Context,
	runID uuid.UUID,
	targets []*operationrun.OperationRunTarget,
) error

CreateTargets implements Store.

func (*PostgresStore) FetchRunnableIDs

func (s *PostgresStore) FetchRunnableIDs(
	ctx context.Context,
	limit int,
) ([]uuid.UUID, error)

FetchRunnableIDs returns up to limit pending/running operation runs for dispatcher work. limit must be positive; callers that want defaults should apply them before reaching the store. The returned IDs are not locked; LockRunnable owns the row lock.

func (*PostgresStore) Get

Get implements Store.

func (*PostgresStore) GetTargetPhaseAggregate

func (s *PostgresStore) GetTargetPhaseAggregate(
	ctx context.Context,
	runID uuid.UUID,
	currentPhaseIndex int32,
) (operationrun.TargetPhaseAggregate, error)

GetTargetPhaseAggregate returns aggregate target facts for phase decisions.

func (*PostgresStore) List

List implements Store.

func (*PostgresStore) ListTargets

ListTargets implements Store.

func (*PostgresStore) LockOperationRun

func (s *PostgresStore) LockOperationRun(
	ctx context.Context,
	id uuid.UUID,
) (*operationrun.OperationRun, error)

LockOperationRun implements Store.

func (*PostgresStore) LockOperationRunTargets

func (s *PostgresStore) LockOperationRunTargets(
	ctx context.Context,
	runID uuid.UUID,
	phaseIndex int32,
) ([]*operationrun.OperationRunTarget, error)

LockOperationRunTargets locks materialized targets for one run and phase.

func (*PostgresStore) LockRunnable

func (s *PostgresStore) LockRunnable(
	ctx context.Context,
	id uuid.UUID,
) (*operationrun.OperationRun, error)

LockRunnable locks one runnable operation run with SKIP LOCKED.

func (*PostgresStore) RunInTransaction

func (s *PostgresStore) RunInTransaction(
	ctx context.Context,
	fn func(ctx context.Context) error,
) error

RunInTransaction executes fn inside a database transaction.

func (*PostgresStore) UpdateRunState

func (s *PostgresStore) UpdateRunState(
	ctx context.Context,
	run *operationrun.OperationRun,
) error

UpdateRunState persists dispatcher-owned lifecycle fields.

func (*PostgresStore) UpdateTargetState

func (s *PostgresStore) UpdateTargetState(
	ctx context.Context,
	target *operationrun.OperationRunTarget,
) error

UpdateTargetState persists dispatcher-owned target lifecycle fields.

Jump to

Keyboard shortcuts

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