repository

package
v1.0.0-alpha1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: Apache-2.0 Imports: 8 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

Overview

Package repository reads and writes processes, the sections they own and their status history.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchJobStatusRepository

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

BatchJobStatusRepository reads and writes the scheduler states observed for a batch job

func NewBatchJobStatusRepository

func NewBatchJobStatusRepository(db *gorm.DB) *BatchJobStatusRepository

NewBatchJobStatusRepository returns a repository backed by db.

func (*BatchJobStatusRepository) Create

Create inserts a status row. BeforeCreate assigns its id and GORM stamps UpdatedAt with the time of the insert.

func (*BatchJobStatusRepository) FindByBatchProcessID

func (r *BatchJobStatusRepository) FindByBatchProcessID(ctx context.Context, batchProcessID string) ([]model.BatchJobStatus, error)

FindByBatchProcessID returns every status recorded for one batch process, oldest first.

func (*BatchJobStatusRepository) FindByProcessID

func (r *BatchJobStatusRepository) FindByProcessID(ctx context.Context, processID string) ([]model.BatchJobStatus, error)

FindByProcessID returns every status recorded for the batch section of one process, oldest first.

The filter goes through batch_processes because a caller coming from the API holds a process id, not the id of the section that owns the statuses — the same indirection ProcessRepository.FindByDeploymentID makes.

func (*BatchJobStatusRepository) FindLatestByBatchProcessID

func (r *BatchJobStatusRepository) FindLatestByBatchProcessID(ctx context.Context, batchProcessID string) (*model.BatchJobStatus, error)

FindLatestByBatchProcessID returns the most recent state reported for one batch process — what a caller asking "where is this job now" wants — or gorm.ErrRecordNotFound when nothing has been recorded for it yet.

func (*BatchJobStatusRepository) WithTx

WithTx returns a repository bound to tx.

type DataStagingTaskRepository

type DataStagingTaskRepository = TaskRepository[model.DataStagingTask]

The four instantiations. They exist so the wiring reads in entity terms rather than in type parameters, and so a future kind-specific query has somewhere to live.

func NewDataStagingTaskRepository

func NewDataStagingTaskRepository(db *gorm.DB) *DataStagingTaskRepository

NewDataStagingTaskRepository returns a repository over data_staging_tasks.

type InteractiveCommandTaskRepository

type InteractiveCommandTaskRepository = TaskRepository[model.InteractiveCommandTask]

The four instantiations. They exist so the wiring reads in entity terms rather than in type parameters, and so a future kind-specific query has somewhere to live.

func NewInteractiveCommandTaskRepository

func NewInteractiveCommandTaskRepository(db *gorm.DB) *InteractiveCommandTaskRepository

NewInteractiveCommandTaskRepository returns a repository over interactive_command_tasks.

type JobMonitoringTaskRepository

type JobMonitoringTaskRepository = TaskRepository[model.JobMonitoringTask]

The four instantiations. They exist so the wiring reads in entity terms rather than in type parameters, and so a future kind-specific query has somewhere to live.

func NewJobMonitoringTaskRepository

func NewJobMonitoringTaskRepository(db *gorm.DB) *JobMonitoringTaskRepository

NewJobMonitoringTaskRepository returns a repository over job_monitoring_tasks.

type JobSubmissionTaskRepository

type JobSubmissionTaskRepository = TaskRepository[model.JobSubmissionTask]

The four instantiations. They exist so the wiring reads in entity terms rather than in type parameters, and so a future kind-specific query has somewhere to live.

func NewJobSubmissionTaskRepository

func NewJobSubmissionTaskRepository(db *gorm.DB) *JobSubmissionTaskRepository

NewJobSubmissionTaskRepository returns a repository over job_submission_tasks.

type LinkRepository

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

LinkRepository persists the link secrets issued to each process's job.

func NewLinkRepository

func NewLinkRepository(db *gorm.DB) *LinkRepository

NewLinkRepository returns a repository over db.

func (*LinkRepository) FindByProcessID

func (r *LinkRepository) FindByProcessID(ctx context.Context, processID string) (*model.ProcessLink, error)

FindByProcessID returns the process's link, or gorm.ErrRecordNotFound.

func (*LinkRepository) Save

func (r *LinkRepository) Save(ctx context.Context, link *model.ProcessLink) error

Save inserts the link or replaces the process's existing one.

type ProcessRepository

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

ProcessRepository reads and writes processes.

The batch process, the owned resource request and the template mappings are handled here rather than in repositories of their own: none is reachable except through the process that owns it, so there is no caller that would want one on its own.

func NewProcessRepository

func NewProcessRepository(db *gorm.DB) *ProcessRepository

NewProcessRepository returns a repository backed by db.

func (*ProcessRepository) Delete

func (r *ProcessRepository) Delete(ctx context.Context, p *model.Process) error

Delete removes a process. Its BeforeDelete takes the statuses and the batch process with it — and the mappings with that — and the database cascades the tasks.

func (*ProcessRepository) FindAll

func (r *ProcessRepository) FindAll(ctx context.Context) ([]model.Process, error)

FindAll returns every process.

func (*ProcessRepository) FindByDeploymentID

func (r *ProcessRepository) FindByDeploymentID(ctx context.Context, deploymentID string) ([]model.Process, error)

FindByDeploymentID returns every process run against one deployment.

The deployment is named by the batch process section rather than by the process, so the filter goes through that table.

func (*ProcessRepository) FindByID

func (r *ProcessRepository) FindByID(ctx context.Context, id string) (*model.Process, error)

FindByID returns one process, or gorm.ErrRecordNotFound.

func (*ProcessRepository) FindByOwnerID

func (r *ProcessRepository) FindByOwnerID(ctx context.Context, userID string) ([]model.Process, error)

FindByOwnerID returns every process launched by one user.

func (*ProcessRepository) ReplaceInputMappings

func (r *ProcessRepository) ReplaceInputMappings(ctx context.Context, batchProcessID string, mappings []*model.TemplateInputMapping) error

ReplaceInputMappings swaps a batch process's input mapping set for the given rows.

Wholesale replacement, matching how a template's declarations are replaced: the ids are not part of the request, so there is nothing to match an incoming mapping to an existing row by.

func (*ProcessRepository) ReplaceOutputMappings

func (r *ProcessRepository) ReplaceOutputMappings(ctx context.Context, batchProcessID string, mappings []*model.TemplateOutputMapping) error

ReplaceOutputMappings swaps a batch process's output mapping set for the given rows.

func (*ProcessRepository) Save

Save writes the process row alone, leaving its sections to the calls below. Writing them separately is what keeps an update from silently upserting a half-populated association GORM inferred from the struct.

func (*ProcessRepository) SaveBatchJobConfig

func (r *ProcessRepository) SaveBatchJobConfig(ctx context.Context, c *applicationmodel.BatchJobConfig) error

SaveBatchJobConfig inserts or updates the resource request the section owns.

func (*ProcessRepository) SaveBatchProcess

func (r *ProcessRepository) SaveBatchProcess(ctx context.Context, b *model.BatchJobProcess) error

SaveBatchProcess inserts or updates the owned batch process section.

func (*ProcessRepository) WithTx

func (r *ProcessRepository) WithTx(tx *gorm.DB) *ProcessRepository

WithTx returns a repository bound to tx.

type StatusRepository

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

StatusRepository reads and writes process statuses.

There is no Update: statuses are append-only history, never corrected in place.

func NewStatusRepository

func NewStatusRepository(db *gorm.DB) *StatusRepository

NewStatusRepository returns a repository backed by db.

func (*StatusRepository) Create

Create inserts a status row. BeforeCreate assigns its id and AfterCreate repoints the owning process's LastStatusID at it.

func (*StatusRepository) FindByIDAndProcessID

func (r *StatusRepository) FindByIDAndProcessID(ctx context.Context, id, processID string) (*model.ProcessStatus, error)

FindByIDAndProcessID returns one status scoped to its process, or gorm.ErrRecordNotFound if the id does not belong to that process.

func (*StatusRepository) FindByProcessID

func (r *StatusRepository) FindByProcessID(ctx context.Context, processID string) ([]model.ProcessStatus, error)

FindByProcessID returns every status recorded for one process, oldest first.

func (*StatusRepository) WithTx

func (r *StatusRepository) WithTx(tx *gorm.DB) *StatusRepository

WithTx returns a repository bound to tx.

type TaskRepository

type TaskRepository[T any] struct {
	// contains filtered or unexported fields
}

TaskRepository reads and writes one kind of process task.

The four kinds differ in payload but not in identity: every one is keyed by task_id, scoped by process_id and ordered by task_order. That is the whole of the table access, so it is written once here and instantiated per kind rather than copied four times. GORM resolves the table from T's TableName.

func NewTaskRepository

func NewTaskRepository[T any](db *gorm.DB) *TaskRepository[T]

NewTaskRepository returns a repository over the table backing T.

func (*TaskRepository[T]) Delete

func (r *TaskRepository[T]) Delete(ctx context.Context, t *T) error

Delete removes a task.

func (*TaskRepository[T]) FindByIDAndProcessID

func (r *TaskRepository[T]) FindByIDAndProcessID(ctx context.Context, id, processID string) (*T, error)

FindByIDAndProcessID returns one task scoped to its process, or gorm.ErrRecordNotFound if the id does not belong to that process.

func (*TaskRepository[T]) FindByProcessID

func (r *TaskRepository[T]) FindByProcessID(ctx context.Context, processID string) ([]T, error)

FindByProcessID returns every task of one process in execution order.

task_order is nullable, so rows without one sort last rather than jumping ahead of an explicitly ordered step; task_id breaks ties so the order is stable between calls.

func (*TaskRepository[T]) Save

func (r *TaskRepository[T]) Save(ctx context.Context, t *T) error

Save inserts or updates a task.

func (*TaskRepository[T]) WithTx

func (r *TaskRepository[T]) WithTx(tx *gorm.DB) *TaskRepository[T]

WithTx returns a repository bound to tx.

type TaskStatusRepository

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

TaskStatusRepository reads and writes task statuses.

There is no Update: statuses are append-only history, never corrected in place.

func NewTaskStatusRepository

func NewTaskStatusRepository(db *gorm.DB) *TaskStatusRepository

NewTaskStatusRepository returns a repository backed by db.

func (*TaskStatusRepository) Create

Create inserts a status row. BeforeCreate assigns its id.

func (*TaskStatusRepository) FindByProcessID

func (r *TaskStatusRepository) FindByProcessID(ctx context.Context, processID string) ([]model.TaskStatus, error)

FindByProcessID returns every status recorded for the tasks of one process, oldest first.

func (*TaskStatusRepository) FindByTaskID

func (r *TaskStatusRepository) FindByTaskID(ctx context.Context, taskID string) ([]model.TaskStatus, error)

FindByTaskID returns every status recorded for one task, oldest first.

func (*TaskStatusRepository) FindByTaskIDAndProcessID

func (r *TaskStatusRepository) FindByTaskIDAndProcessID(ctx context.Context, taskID, processID string) ([]model.TaskStatus, error)

FindByTaskIDAndProcessID returns every status recorded for one task of one process, oldest first. Scoping by process as well stops a task id from one process reading another's history.

func (*TaskStatusRepository) HasStatus

func (r *TaskStatusRepository) HasStatus(ctx context.Context, taskID, processID string, status model.TaskStatusType) (bool, error)

HasStatus reports whether one task of one process has ever recorded status.

func (*TaskStatusRepository) WithTx

WithTx returns a repository bound to tx.

type WorkflowRepository

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

WorkflowRepository reads and writes process workflows.

Only a process workflow's status is ever updated: the rest records a workflow run that was started, which is never corrected in place.

func NewWorkflowRepository

func NewWorkflowRepository(db *gorm.DB) *WorkflowRepository

NewWorkflowRepository returns a repository backed by db.

func (*WorkflowRepository) Create

Create inserts a process workflow row. BeforeCreate assigns its id and AfterCreate repoints the owning process's LastWorkflowID at it.

func (*WorkflowRepository) FindByIDAndProcessID

func (r *WorkflowRepository) FindByIDAndProcessID(ctx context.Context, id, processID string) (*model.ProcessWorkflow, error)

FindByIDAndProcessID returns one workflow scoped to its process, or gorm.ErrRecordNotFound if the id does not belong to that process.

func (*WorkflowRepository) FindByProcessID

func (r *WorkflowRepository) FindByProcessID(ctx context.Context, processID string) ([]model.ProcessWorkflow, error)

FindByProcessID returns every workflow recorded for one process, oldest first.

func (*WorkflowRepository) FindByWorkflowIDAndProcessID

func (r *WorkflowRepository) FindByWorkflowIDAndProcessID(ctx context.Context, workflowID, processID string) (*model.ProcessWorkflow, error)

FindByWorkflowIDAndProcessID returns the workflow recorded for one workflow instance of one process, or gorm.ErrRecordNotFound if none was.

func (*WorkflowRepository) Record

func (r *WorkflowRepository) Record(ctx context.Context, processID, workflowID string,
	workflowType model.ProcessWorkflowType, status model.ProcessWorkflowStatusType) (*model.ProcessWorkflow, error)

Record creates the workflow of one workflow instance of a process, or moves an existing one to status. An update changes only the status: the type and timestamp stay as first recorded, so the timestamp keeps saying when the workflow started.

It is here rather than only in the service so that the orchestration activities, which cannot import the service package, record workflows the same way.

func (*WorkflowRepository) UpdateStatus

UpdateStatus sets the status of one workflow, or returns gorm.ErrRecordNotFound if no workflow has that id.

func (*WorkflowRepository) WithTx

func (r *WorkflowRepository) WithTx(tx *gorm.DB) *WorkflowRepository

WithTx returns a repository bound to tx.

Jump to

Keyboard shortcuts

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