migrationjobmodel

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MigrationJobModel

type MigrationJobModel struct {
	DB *domain.DB

	// add migration job events?
	MigrationJobEvents interface {
		Send(domain.MigrationJob)
	} `checkinject:"required"`
	// contains filtered or unexported fields
}

MigrationJobModel represents the model for app spaces

func (*MigrationJobModel) Create

func (m *MigrationJobModel) Create(ownerID domain.UserID, appspaceID domain.AppspaceID, toVersion domain.Version, priority bool) (*domain.MigrationJob, error)

Create adds a job to the queue It replaces any pending job for same appspace

func (*MigrationJobModel) DeleteForAppspace

func (m *MigrationJobModel) DeleteForAppspace(appspaceID domain.AppspaceID) error

DeleteForAppspace deletes all jobs for an appspace This returns an error if any job to be deleted is ongoing

func (*MigrationJobModel) GetForAppspace

func (m *MigrationJobModel) GetForAppspace(appspaceID domain.AppspaceID) ([]*domain.MigrationJob, error)

GetForAppspace returns an appspace's jobs if there are any

func (*MigrationJobModel) GetJob

func (m *MigrationJobModel) GetJob(jobID domain.JobID) (*domain.MigrationJob, error)

GetJob returns job from its job id. Errors if job not found.

func (*MigrationJobModel) GetPending

func (m *MigrationJobModel) GetPending() ([]*domain.MigrationJob, error)

GetPending returns an array of pending jobs

func (*MigrationJobModel) GetRunning

func (m *MigrationJobModel) GetRunning() ([]domain.MigrationJob, error)

GetRunning returns an array of running jobs

func (*MigrationJobModel) PrepareStatements

func (m *MigrationJobModel) PrepareStatements()

PrepareStatements for appspace model

func (*MigrationJobModel) SetFinished

func (m *MigrationJobModel) SetFinished(jobID domain.JobID, errStr nulltypes.NullString) error

SetFinished puts the current time in finished column, and an error string if there is one

func (*MigrationJobModel) SetStarted

func (m *MigrationJobModel) SetStarted(jobID domain.JobID) (bool, error)

SetStarted attempts to set the started date to now, but returns ok=false if no rows were changed (in the case of deleted job)

func (*MigrationJobModel) StartupFinishStartedJobs

func (m *MigrationJobModel) StartupFinishStartedJobs(str string) error

StartupFinishStartedJobs looks for jobs that have been started but not finished and finishes them with the specified error. This is meant to be run on startup, efore the jobs begin to execute. It cleans up messes left by a crashed ds.

Jump to

Keyboard shortcuts

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