Documentation ¶
Overview ¶
package job_deleter has functionality to delete jobs.
Requesting deletion marks the job as "deletion requested" in the database. This is relatively fast, and persistent. After this, the job is queued for actual deletion by a different goroutine.
At startup of the service the database is inspected and still-pending deletion requests are queued.
SPDX-License-Identifier: GPL-3.0-or-later
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeBroadcaster ¶
type ChangeBroadcaster interface { // BroadcastJobUpdate sends the job update to SocketIO clients. BroadcastJobUpdate(jobUpdate api.EventJobUpdate) }
type PersistenceService ¶
type PersistenceService interface { FetchJob(ctx context.Context, jobUUID string) (*persistence.Job, error) FetchJobShamanCheckoutID(ctx context.Context, jobUUID string) (string, error) RequestJobDeletion(ctx context.Context, j *persistence.Job) error RequestJobMassDeletion(ctx context.Context, lastUpdatedMax time.Time) ([]string, error) // FetchJobsDeletionRequested returns the UUIDs of to-be-deleted jobs. FetchJobsDeletionRequested(ctx context.Context) ([]string, error) DeleteJob(ctx context.Context, jobUUID string) error RequestIntegrityCheck() }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service can mark jobs as "deletion requested", as well as delete those jobs in a background goroutine.
func NewService ¶
func NewService( persist PersistenceService, storage Storage, changeBroadcaster ChangeBroadcaster, shaman Shaman, ) *Service
NewService constructs a new job deletion service. `shaman` can be nil if Shaman checkouts shouldn't be erased.
func (*Service) QueueJobDeletion ¶
func (*Service) QueueMassJobDeletion ¶
func (*Service) Run ¶
Run processes the queue of deletion requests. It starts by building up a queue of still-pending job deletions.
func (*Service) WhatWouldBeDeleted ¶
func (s *Service) WhatWouldBeDeleted(job *persistence.Job) api.JobDeletionInfo