Documentation
¶
Overview ¶
Package store persists operation runs and their materialized rack targets.
Index ¶
- type PostgresStore
- func (s *PostgresStore) Create(ctx context.Context, run *operationrun.OperationRun) (uuid.UUID, error)
- func (s *PostgresStore) CreateTargets(ctx context.Context, runID uuid.UUID, ...) error
- func (s *PostgresStore) FetchRunnableIDs(ctx context.Context, limit int) ([]uuid.UUID, error)
- func (s *PostgresStore) Get(ctx context.Context, id uuid.UUID) (*operationrun.OperationRun, error)
- func (s *PostgresStore) GetTargetPhaseAggregate(ctx context.Context, runID uuid.UUID, currentPhaseIndex int32) (operationrun.TargetPhaseAggregate, error)
- func (s *PostgresStore) List(ctx context.Context, opts operationrun.ListOptions) ([]*operationrun.OperationRun, int32, error)
- func (s *PostgresStore) ListTargets(ctx context.Context, runID uuid.UUID, opts operationrun.TargetListOptions) ([]*operationrun.OperationRunTarget, int32, error)
- func (s *PostgresStore) LockOperationRun(ctx context.Context, id uuid.UUID) (*operationrun.OperationRun, error)
- func (s *PostgresStore) LockOperationRunTargets(ctx context.Context, runID uuid.UUID, phaseIndex int32) ([]*operationrun.OperationRunTarget, error)
- func (s *PostgresStore) LockRunnable(ctx context.Context, id uuid.UUID) (*operationrun.OperationRun, error)
- func (s *PostgresStore) RunInTransaction(ctx context.Context, fn func(ctx context.Context) error) error
- func (s *PostgresStore) UpdateRunState(ctx context.Context, run *operationrun.OperationRun) error
- func (s *PostgresStore) UpdateTargetState(ctx context.Context, target *operationrun.OperationRunTarget) error
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 ¶
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 ¶
func (s *PostgresStore) Get( ctx context.Context, id uuid.UUID, ) (*operationrun.OperationRun, error)
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 ¶
func (s *PostgresStore) List( ctx context.Context, opts operationrun.ListOptions, ) ([]*operationrun.OperationRun, int32, error)
List implements Store.
func (*PostgresStore) ListTargets ¶
func (s *PostgresStore) ListTargets( ctx context.Context, runID uuid.UUID, opts operationrun.TargetListOptions, ) ([]*operationrun.OperationRunTarget, int32, error)
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.