jobqueue: Add DeleteJob function
This allows jobs to be deleted from the database. Currently only implemented by fsjobqueue. The function for dbjobqueue currently returns nil. This will remove all the job files used by the root job UUID as long as no other job depends on them. ie. It starts at the top, and moves down the dependency tree until it finds a job that is also used by another job, removes the job to be deleted from its dependants list, and moves back up the tree only deleting jobs with empty dependants lists. Related: RHEL-60120
This commit is contained in:
parent
5961b69caa
commit
d8285a0b74
4 changed files with 134 additions and 0 deletions
|
|
@ -910,3 +910,9 @@ func (q *DBJobQueue) AllRootJobIDs() ([]uuid.UUID, error) {
|
|||
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// DeleteJob deletes a job from the database
|
||||
// Currently not implemented for the DBJobQueue
|
||||
func (q *DBJobQueue) DeleteJob(ctx context.Context, id uuid.UUID) error {
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -98,6 +98,9 @@ type JobQueue interface {
|
|||
|
||||
// AllRootJobIDs returns a list of top level job UUIDs that the worker knows about
|
||||
AllRootJobIDs() ([]uuid.UUID, error)
|
||||
|
||||
// DeleteJob deletes a job and all of its dependencies
|
||||
DeleteJob(context.Context, uuid.UUID) error
|
||||
}
|
||||
|
||||
// SimpleLogger provides a structured logging methods for the jobqueue library.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue