Documentation ¶
Overview ¶
Package persistence provides the database interface for Flamenco Manager.
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: GPL-3.0-or-later
SPDX-License-Identifier: GPL-3.0-or-later
Package persistence provides the database interface for Flamenco Manager.
Index ¶
- Constants
- Variables
- func ErrIsDBBusy(err error) bool
- type Command
- type Commands
- type DB
- func (db *DB) AddWorkerToJobBlocklist(ctx context.Context, job *Job, worker *Worker, taskType string) error
- func (db *DB) AddWorkerToTaskFailedList(ctx context.Context, t *Task, w *Worker) (numFailed int, err error)
- func (db *DB) ClearFailureListOfJob(ctx context.Context, j *Job) error
- func (db *DB) ClearFailureListOfTask(ctx context.Context, t *Task) error
- func (db *DB) ClearJobBlocklist(ctx context.Context, job *Job) error
- func (db *DB) Close() error
- func (db *DB) CountTaskFailuresOfWorker(ctx context.Context, job *Job, worker *Worker, taskType string) (int, error)
- func (db *DB) CountTasksOfJobInStatus(ctx context.Context, job *Job, taskStatuses ...api.TaskStatus) (numInStatus, numTotal int, err error)
- func (db *DB) CreateWorker(ctx context.Context, w *Worker) error
- func (db *DB) CreateWorkerTag(ctx context.Context, wc *WorkerTag) error
- func (db *DB) DeleteJob(ctx context.Context, jobUUID string) error
- func (db *DB) DeleteWorker(ctx context.Context, uuid string) error
- func (db *DB) DeleteWorkerTag(ctx context.Context, uuid string) error
- func (db *DB) FetchJob(ctx context.Context, jobUUID string) (*Job, error)
- func (db *DB) FetchJobBlocklist(ctx context.Context, jobUUID string) ([]JobBlock, error)
- func (db *DB) FetchJobShamanCheckoutID(ctx context.Context, jobUUID string) (string, error)
- func (db *DB) FetchJobs(ctx context.Context) ([]*Job, error)
- func (db *DB) FetchJobsDeletionRequested(ctx context.Context) ([]string, error)
- func (db *DB) FetchJobsInStatus(ctx context.Context, jobStatuses ...api.JobStatus) ([]*Job, error)
- func (db *DB) FetchSleepScheduleWorker(ctx context.Context, schedule *SleepSchedule) error
- func (db *DB) FetchSleepSchedulesToCheck(ctx context.Context) ([]*SleepSchedule, error)
- func (db *DB) FetchTask(ctx context.Context, taskUUID string) (*Task, error)
- func (db *DB) FetchTaskFailureList(ctx context.Context, t *Task) ([]*Worker, error)
- func (db *DB) FetchTaskJobUUID(ctx context.Context, taskUUID string) (string, error)
- func (db *DB) FetchTasksOfJob(ctx context.Context, job *Job) ([]*Task, error)
- func (db *DB) FetchTasksOfJobInStatus(ctx context.Context, job *Job, taskStatuses ...api.TaskStatus) ([]*Task, error)
- func (db *DB) FetchTasksOfWorkerInStatus(ctx context.Context, worker *Worker, taskStatus api.TaskStatus) ([]*Task, error)
- func (db *DB) FetchTasksOfWorkerInStatusOfJob(ctx context.Context, worker *Worker, taskStatus api.TaskStatus, job *Job) ([]*Task, error)
- func (db *DB) FetchTimedOutTasks(ctx context.Context, untouchedSince time.Time) ([]*Task, error)
- func (db *DB) FetchTimedOutWorkers(ctx context.Context, lastSeenBefore time.Time) ([]*Worker, error)
- func (db *DB) FetchWorker(ctx context.Context, uuid string) (*Worker, error)
- func (db *DB) FetchWorkerSleepSchedule(ctx context.Context, workerUUID string) (*SleepSchedule, error)
- func (db *DB) FetchWorkerTag(ctx context.Context, uuid string) (*WorkerTag, error)
- func (db *DB) FetchWorkerTags(ctx context.Context) ([]*WorkerTag, error)
- func (db *DB) FetchWorkerTask(ctx context.Context, worker *Worker) (*Task, error)
- func (db *DB) FetchWorkers(ctx context.Context) ([]*Worker, error)
- func (db *DB) GetLastRenderedJobUUID(ctx context.Context) (string, error)
- func (db *DB) HasWorkerTags(ctx context.Context) (bool, error)
- func (db *DB) JobHasTasksInStatus(ctx context.Context, job *Job, taskStatus api.TaskStatus) (bool, error)
- func (db *DB) PeriodicIntegrityCheck(ctx context.Context, period time.Duration, onErrorCallback func())
- func (db *DB) QueryJobTaskSummaries(ctx context.Context, jobUUID string) ([]*Task, error)
- func (db *DB) RemoveFromJobBlocklist(ctx context.Context, jobUUID, workerUUID, taskType string) error
- func (db *DB) RequestIntegrityCheck()
- func (db *DB) RequestJobDeletion(ctx context.Context, j *Job) error
- func (db *DB) RequestJobMassDeletion(ctx context.Context, lastUpdatedMax time.Time) ([]string, error)
- func (db *DB) SaveJobPriority(ctx context.Context, j *Job) error
- func (db *DB) SaveJobStatus(ctx context.Context, j *Job) error
- func (db *DB) SaveJobStorageInfo(ctx context.Context, j *Job) error
- func (db *DB) SaveTask(ctx context.Context, t *Task) error
- func (db *DB) SaveTaskActivity(ctx context.Context, t *Task) error
- func (db *DB) SaveTaskStatus(ctx context.Context, t *Task) error
- func (db *DB) SaveWorker(ctx context.Context, w *Worker) error
- func (db *DB) SaveWorkerStatus(ctx context.Context, w *Worker) error
- func (db *DB) SaveWorkerTag(ctx context.Context, tag *WorkerTag) error
- func (db *DB) ScheduleTask(ctx context.Context, w *Worker) (*Task, error)
- func (db *DB) SetLastRendered(ctx context.Context, j *Job) error
- func (db *DB) SetWorkerSleepSchedule(ctx context.Context, workerUUID string, schedule *SleepSchedule) error
- func (db *DB) SetWorkerSleepScheduleNextCheck(ctx context.Context, schedule *SleepSchedule) error
- func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.AuthoredJob) error
- func (db *DB) StoreAuthoredJobTaks(ctx context.Context, job *Job, authoredJob *job_compilers.AuthoredJob) error
- func (db *DB) SummarizeJobStatuses(ctx context.Context) (JobStatusCount, error)
- func (db *DB) SummarizeWorkerStatuses(ctx context.Context) (WorkerStatusCount, error)
- func (db *DB) TaskAssignToWorker(ctx context.Context, t *Task, w *Worker) error
- func (db *DB) TaskTouchedByWorker(ctx context.Context, t *Task) error
- func (db *DB) UpdateJobsTaskStatuses(ctx context.Context, job *Job, taskStatus api.TaskStatus, activity string) error
- func (db *DB) UpdateJobsTaskStatusesConditional(ctx context.Context, job *Job, statusesToUpdate []api.TaskStatus, ...) error
- func (db *DB) WorkerSeen(ctx context.Context, w *Worker) error
- func (db *DB) WorkerSetTags(ctx context.Context, worker *Worker, tagUUIDs []string) error
- func (db *DB) WorkersLeftToRun(ctx context.Context, job *Job, taskType string) (map[string]bool, error)
- type GooseLogger
- type Job
- type JobBlock
- type JobStatusCount
- type JobStorageInfo
- type LastRendered
- type LoggingDBConn
- func (ldbc *LoggingDBConn) ExecContext(ctx context.Context, sql string, args ...interface{}) (sql.Result, error)
- func (ldbc *LoggingDBConn) PrepareContext(ctx context.Context, sql string) (*sql.Stmt, error)
- func (ldbc *LoggingDBConn) QueryContext(ctx context.Context, sql string, args ...interface{}) (*sql.Rows, error)
- func (ldbc *LoggingDBConn) QueryRowContext(ctx context.Context, sql string, args ...interface{}) *sql.Row
- type Model
- type PersistenceError
- type SleepSchedule
- type StringInterfaceMap
- type StringStringMap
- type Task
- type TaskFailure
- type TimeOfDay
- func (ot TimeOfDay) Equals(other TimeOfDay) bool
- func (ot TimeOfDay) HasValue() bool
- func (ot TimeOfDay) IsAfter(other TimeOfDay) bool
- func (ot TimeOfDay) IsBefore(other TimeOfDay) bool
- func (ot TimeOfDay) OnDate(date time.Time) time.Time
- func (ot *TimeOfDay) Scan(value interface{}) error
- func (ot TimeOfDay) String() string
- func (ot TimeOfDay) Value() (driver.Value, error)
- type Worker
- type WorkerStatusCount
- type WorkerTag
- type WorkerTestFixture
Constants ¶
const TestDSN = "file::memory:"
Change this to a filename if you want to run a single test and inspect the resulting database.
Variables ¶
var ( ErrJobNotFound = PersistenceError{Message: "job not found", Err: sql.ErrNoRows} ErrTaskNotFound = PersistenceError{Message: "task not found", Err: sql.ErrNoRows} ErrWorkerNotFound = PersistenceError{Message: "worker not found", Err: sql.ErrNoRows} ErrWorkerTagNotFound = PersistenceError{Message: "worker tag not found", Err: sql.ErrNoRows} ErrDeletingWithoutFK = errors.New("refusing to delete a job when foreign keys are not enabled on the database") // ErrContextCancelled wraps the SQLite error "interrupted (9)". That error is // (as far as Sybren could figure out) caused by the context being closed. // Unfortunately there is no wrapping of the context error, so it's not // possible to determine whether it was due to a 'deadline exceeded' error or // another cancellation cause (like upstream HTTP connection closing). ErrContextCancelled = errors.New("context cancelled") )
var ErrIntegrity = errors.New("database integrity check failed")
Functions ¶
func ErrIsDBBusy ¶
ErrIsDBBusy returns true when the error is a "database busy" error.
Types ¶
type Command ¶
type Command struct { Name string `json:"name"` Parameters StringInterfaceMap `json:"parameters"` }
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB provides the database interface.
func CreateTestDB ¶
func CreateTestDB() (db *DB, closer func())
func (*DB) AddWorkerToJobBlocklist ¶
func (db *DB) AddWorkerToJobBlocklist(ctx context.Context, job *Job, worker *Worker, taskType string) error
AddWorkerToJobBlocklist prevents this Worker of getting any task, of this type, on this job, from the task scheduler.
func (*DB) AddWorkerToTaskFailedList ¶
func (db *DB) AddWorkerToTaskFailedList(ctx context.Context, t *Task, w *Worker) (numFailed int, err error)
AddWorkerToTaskFailedList records that the given worker failed the given task. This information is not used directly by the task scheduler. It's used to determine whether there are any workers left to perform this task, and thus whether it should be hard- or soft-failed.
Calling this multiple times with the same task/worker is a no-op.
Returns the new number of workers that failed this task.
func (*DB) ClearFailureListOfJob ¶
ClearFailureListOfJob en-mass, for all tasks of this job, clears the list of workers that failed those tasks.
func (*DB) ClearFailureListOfTask ¶
ClearFailureListOfTask clears the list of workers that failed this task.
func (*DB) ClearJobBlocklist ¶
ClearJobBlocklist removes the entire blocklist of this job.
func (*DB) CountTaskFailuresOfWorker ¶
func (db *DB) CountTaskFailuresOfWorker(ctx context.Context, job *Job, worker *Worker, taskType string) (int, error)
CountTaskFailuresOfWorker returns the number of task failures of this worker, on this particular job and task type.
func (*DB) CountTasksOfJobInStatus ¶
func (db *DB) CountTasksOfJobInStatus( ctx context.Context, job *Job, taskStatuses ...api.TaskStatus, ) (numInStatus, numTotal int, err error)
CountTasksOfJobInStatus counts the number of tasks in the job. It returns two counts, one is the number of tasks in the given statuses, the other is the total number of tasks of the job.
func (*DB) CreateWorkerTag ¶
func (*DB) DeleteJob ¶
DeleteJob deletes a job from the database. The deletion cascades to its tasks and other job-related tables.
func (*DB) DeleteWorkerTag ¶
DeleteWorkerTag deletes the given tag, after unassigning all workers from it.
func (*DB) FetchJobBlocklist ¶
FetchJobBlocklist fetches the blocklist for the given job. Workers are fetched too, and embedded in the returned list.
func (*DB) FetchJobShamanCheckoutID ¶
FetchJobShamanCheckoutID fetches the job's Shaman Checkout ID.
func (*DB) FetchJobsDeletionRequested ¶
func (*DB) FetchJobsInStatus ¶
func (*DB) FetchSleepScheduleWorker ¶
func (db *DB) FetchSleepScheduleWorker(ctx context.Context, schedule *SleepSchedule) error
FetchSleepScheduleWorker sets the given schedule's `Worker` pointer.
func (*DB) FetchSleepSchedulesToCheck ¶
func (db *DB) FetchSleepSchedulesToCheck(ctx context.Context) ([]*SleepSchedule, error)
FetchSleepSchedulesToCheck returns the sleep schedules that are due for a check.
func (*DB) FetchTaskFailureList ¶
func (*DB) FetchTaskJobUUID ¶
FetchTaskJobUUID fetches the job UUID of the given task.
func (*DB) FetchTasksOfJob ¶
FetchTaskIDsOfJob returns all tasks of the given job.
func (*DB) FetchTasksOfJobInStatus ¶
func (db *DB) FetchTasksOfJobInStatus(ctx context.Context, job *Job, taskStatuses ...api.TaskStatus) ([]*Task, error)
FetchTasksOfJobInStatus returns those tasks of the given job that have any of the given statuses.
func (*DB) FetchTasksOfWorkerInStatus ¶
func (*DB) FetchTasksOfWorkerInStatusOfJob ¶
func (*DB) FetchTimedOutTasks ¶
FetchTimedOutTasks returns a slice of tasks that have timed out.
In order to time out, a task must be in status `active` and not touched by a Worker since `untouchedSince`.
The returned tasks also have their `Job` and `Worker` fields set.
func (*DB) FetchTimedOutWorkers ¶
func (*DB) FetchWorker ¶
func (*DB) FetchWorkerSleepSchedule ¶
func (db *DB) FetchWorkerSleepSchedule(ctx context.Context, workerUUID string) (*SleepSchedule, error)
FetchWorkerSleepSchedule fetches the worker's sleep schedule. It does not fetch the worker itself. If you need that, call `FetchSleepScheduleWorker()` afterwards.
func (*DB) FetchWorkerTag ¶
func (*DB) FetchWorkerTags ¶
func (*DB) FetchWorkerTask ¶
FetchWorkerTask returns the most recent task assigned to the given Worker.
func (*DB) GetLastRenderedJobUUID ¶
GetLastRendered returns the UUID of the job with the most recent rendered image.
func (*DB) HasWorkerTags ¶
HasWorkerTags returns whether there are any tags defined at all.
func (*DB) JobHasTasksInStatus ¶
func (*DB) PeriodicIntegrityCheck ¶
func (db *DB) PeriodicIntegrityCheck( ctx context.Context, period time.Duration, onErrorCallback func(), )
PeriodicIntegrityCheck periodically checks the database integrity. This function only returns when the context is done.
func (*DB) QueryJobTaskSummaries ¶
QueryJobTaskSummaries retrieves all tasks of the job, but not all fields of those tasks. Fields are synchronised with api.TaskSummary.
func (*DB) RemoveFromJobBlocklist ¶
func (*DB) RequestIntegrityCheck ¶
func (db *DB) RequestIntegrityCheck()
RequestIntegrityCheck triggers a check of the database persistency.
func (*DB) RequestJobDeletion ¶
RequestJobDeletion sets the job's "DeletionRequestedAt" field to "now".
func (*DB) RequestJobMassDeletion ¶
func (db *DB) RequestJobMassDeletion(ctx context.Context, lastUpdatedMax time.Time) ([]string, error)
RequestJobMassDeletion sets multiple job's "DeletionRequestedAt" field to "now". The list of affected job UUIDs is returned.
func (*DB) SaveJobPriority ¶
SaveJobPriority saves the job's Priority field.
func (*DB) SaveJobStatus ¶
SaveJobStatus saves the job's Status and Activity fields.
func (*DB) SaveJobStorageInfo ¶
SaveJobStorageInfo saves the job's Storage field. NOTE: this function does NOT update the job's `UpdatedAt` field. This is necessary for `cmd/shaman-checkout-id-setter` to do its work quietly.
func (*DB) SaveTask ¶
SaveTask updates a task that already exists in the database. This function is not used by the Flamenco API, only by unit tests.
func (*DB) ScheduleTask ¶
ScheduleTask finds a task to execute by the given worker. If no task is available, (nil, nil) is returned, as this is not an error situation. NOTE: this does not also fetch returnedTask.Worker, but returnedTask.WorkerID is set.
func (*DB) SetLastRendered ¶
SetLastRendered sets this job as the one with the most recent rendered image.
func (*DB) SetWorkerSleepSchedule ¶
func (*DB) SetWorkerSleepScheduleNextCheck ¶
func (db *DB) SetWorkerSleepScheduleNextCheck(ctx context.Context, schedule *SleepSchedule) error
func (*DB) StoreAuthoredJob ¶
func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.AuthoredJob) error
StoreJob stores an AuthoredJob and its tasks, and saves it to the database. The job will be in 'under construction' status. It is up to the caller to transition it to its desired initial status.
func (*DB) StoreAuthoredJobTaks ¶
func (db *DB) StoreAuthoredJobTaks( ctx context.Context, job *Job, authoredJob *job_compilers.AuthoredJob, ) error
StoreAuthoredJobTaks is a low-level function that is only used for recreating an existing job's tasks. It stores `authoredJob`'s tasks, but attaches them to the already-persisted `job`.
func (*DB) SummarizeJobStatuses ¶
func (db *DB) SummarizeJobStatuses(ctx context.Context) (JobStatusCount, error)
func (*DB) SummarizeWorkerStatuses ¶
func (db *DB) SummarizeWorkerStatuses(ctx context.Context) (WorkerStatusCount, error)
func (*DB) TaskAssignToWorker ¶
TaskAssignToWorker assigns the given task to the given worker. This function is only used by unit tests. During normal operation, Flamenco uses the code in task_scheduler.go to assign tasks to workers.
func (*DB) TaskTouchedByWorker ¶
TaskTouchedByWorker marks the task as 'touched' by a worker. This is used for timeout detection.
func (*DB) UpdateJobsTaskStatuses ¶
func (db *DB) UpdateJobsTaskStatuses(ctx context.Context, job *Job, taskStatus api.TaskStatus, activity string) error
UpdateJobsTaskStatuses updates the status & activity of all tasks of `job`.
func (*DB) UpdateJobsTaskStatusesConditional ¶
func (db *DB) UpdateJobsTaskStatusesConditional(ctx context.Context, job *Job, statusesToUpdate []api.TaskStatus, taskStatus api.TaskStatus, activity string) error
UpdateJobsTaskStatusesConditional updates the status & activity of the tasks of `job`, limited to those tasks with status in `statusesToUpdate`.
func (*DB) WorkerSeen ¶
WorkerSeen marks the worker as 'seen' by this Manager. This is used for timeout detection.
func (*DB) WorkerSetTags ¶
func (*DB) WorkersLeftToRun ¶
func (db *DB) WorkersLeftToRun(ctx context.Context, job *Job, taskType string) (map[string]bool, error)
WorkersLeftToRun returns a set of worker UUIDs that can run tasks of the given type on the given job.
NOTE: this does NOT consider the task failure list, which blocks individual workers from individual tasks. This is ONLY concerning the job blocklist.
type GooseLogger ¶
type GooseLogger struct{}
func (*GooseLogger) Fatalf ¶
func (gl *GooseLogger) Fatalf(format string, v ...interface{})
func (*GooseLogger) Printf ¶
func (gl *GooseLogger) Printf(format string, v ...interface{})
type Job ¶
type Job struct { Model UUID string Name string JobType string Priority int Status api.JobStatus Activity string Settings StringInterfaceMap Metadata StringStringMap DeleteRequestedAt sql.NullTime Storage JobStorageInfo WorkerTagID *uint WorkerTag *WorkerTag }
func (*Job) DeleteRequested ¶
DeleteRequested returns whether deletion of this job was requested.
type JobBlock ¶
type JobBlock struct { // Don't include the standard Gorm UpdatedAt or DeletedAt fields, as they're useless here. // Entries will never be updated, and should never be soft-deleted but just purged from existence. ID uint CreatedAt time.Time JobID uint Job *Job WorkerID uint Worker *Worker TaskType string }
JobBlock keeps track of which Worker is not allowed to run which task type on which job.
type JobStatusCount ¶
JobStatusCount is a mapping from job status to the number of jobs in that status.
type JobStorageInfo ¶
type JobStorageInfo struct { // ShamanCheckoutID is only set when the job was actually using Shaman storage. ShamanCheckoutID string }
JobStorageInfo contains info about where the job files are stored. It is intended to be used when removing a job, which may include the removal of its files.
type LastRendered ¶
LastRendered only has one entry in its database table, to indicate the job that was the last to receive a "last rendered image" from a Worker. This is used to show the global last-rendered image in the web interface.
type LoggingDBConn ¶
type LoggingDBConn struct {
// contains filtered or unexported fields
}
LoggingDBConn wraps a database/sql.DB connection, so that it can be used with sqlc and log all the queries.
func (*LoggingDBConn) ExecContext ¶
func (*LoggingDBConn) PrepareContext ¶
func (*LoggingDBConn) QueryContext ¶
func (*LoggingDBConn) QueryRowContext ¶
type Model ¶
Model contains the common database fields for most model structs. It is a copy of the gorm.Model struct, but without the `DeletedAt` field. Soft deletion is not used by Flamenco. If it ever becomes necessary to support soft-deletion, see https://gorm.io/docs/delete.html#Soft-Delete
type PersistenceError ¶
type PersistenceError struct { Message string // The error message. Err error // Any wrapped error. }
func (PersistenceError) Error ¶
func (e PersistenceError) Error() string
func (PersistenceError) Is ¶
func (e PersistenceError) Is(err error) bool
type SleepSchedule ¶
type SleepSchedule struct { Model WorkerID uint Worker *Worker IsActive bool // Space-separated two-letter strings indicating days of week the schedule is // active ("mo", "tu", etc.). Empty means "every day". DaysOfWeek string StartTime TimeOfDay EndTime TimeOfDay NextCheck time.Time }
SleepSchedule belongs to a Worker, and determines when it's automatically sent to the 'asleep' and 'awake' states.
type StringInterfaceMap ¶
type StringInterfaceMap map[string]interface{}
func (*StringInterfaceMap) Scan ¶
func (js *StringInterfaceMap) Scan(value interface{}) error
type StringStringMap ¶
func (*StringStringMap) Scan ¶
func (js *StringStringMap) Scan(value interface{}) error
type Task ¶
type Task struct { Model UUID string Name string Type string JobID uint Job *Job JobUUID string // Fetched by SQLC, handled by GORM in Task.AfterFind() IndexInJob int Priority int Status api.TaskStatus // Which worker is/was working on this. WorkerID *uint Worker *Worker WorkerUUID string // Fetched by SQLC, handled by GORM in Task.AfterFind() LastTouchedAt time.Time // Should contain UTC timestamps. // Dependencies are tasks that need to be completed before this one can run. Dependencies []*Task Commands Commands Activity string }
type TaskFailure ¶
type TaskFailure struct { // Don't include the standard Gorm ID, UpdatedAt, or DeletedAt fields, as they're useless here. // Entries will never be updated, and should never be soft-deleted but just purged from existence. CreatedAt time.Time TaskID uint Task *Task WorkerID uint Worker *Worker }
TaskFailure keeps track of which Worker failed which Task.
type TimeOfDay ¶
TimeOfDay represents a time of day, and can be converted to/from a string. Its date and timezone components are ignored, and the time is supposed to be interpreted as local time on any date (f.e. a scheduled sleep time of some Worker on a certain day-of-week & local timezone).
TimeOfDay structs can also represent "no value", which will be marshaled as an empty string.
func EmptyTimeOfDay ¶
func EmptyTimeOfDay() TimeOfDay
EmptyTimeOfDay returns a TimeOfDay struct with no value. See `TimeOfDay.HasValue()`.
func MakeTimeOfDay ¶
MakeTimeOfDay converts a time.Time into a TimeOfDay.
func (TimeOfDay) IsAfter ¶
IsAfter returns True iff ot is after other. Ignores everything except hour and minute fields.
func (TimeOfDay) IsBefore ¶
IsBefore returns True iff ot is before other. Ignores everything except hour and minute fields.
type Worker ¶
type Worker struct { Model DeletedAt sql.NullTime UUID string Secret string Name string Address string // 39 = max length of IPv6 address. Platform string Software string Status api.WorkerStatus LastSeenAt time.Time // Should contain UTC timestamps. CanRestart bool StatusRequested api.WorkerStatus LazyStatusRequest bool SupportedTaskTypes string // comma-separated list of task types. Tags []*WorkerTag }
func (*Worker) Identifier ¶
func (*Worker) StatusChangeClear ¶
func (w *Worker) StatusChangeClear()
StatusChangeClear clears the requested status change of the Worker. This just updates the Worker instance, but doesn't store the change in the database.
func (*Worker) StatusChangeRequest ¶
func (w *Worker) StatusChangeRequest(status api.WorkerStatus, isLazyRequest bool)
StatusChangeRequest stores a requested status change on the Worker. This just updates the Worker instance, but doesn't store the change in the database.
type WorkerStatusCount ¶
type WorkerStatusCount map[api.WorkerStatus]int
WorkerStatusCount is a mapping from job status to the number of jobs in that status.
type WorkerTestFixture ¶
type WorkerTestFixture struct {
// contains filtered or unexported fields
}