Sybren A. Stüvel 791d877ff1 Manager: implement API endpoint for deleting jobs
Implement the `deleteJob` API endpoint. Calling this endpoint will mark
the job as "deletion requested", after which it's queued for actual
deletion. This makes the API response fast, even when there is a lot of
work to do in the background.

A new background service "job deleter" keeps track of the queue of such
jobs, and performs the actual deletion. It removes:

- Shaman checkout for the job (but see below)
- Manager-local files of the job (task logs, last-rendered images)
- The job itself

The removal is done in the above order, so the job is only removed from the
database if the rest of the removal was succesful.

Shaman checkouts are only removed if the job was submitted with Flamenco
version 3.2. Earlier versions did not record enough information to reliably
do this.
2023-01-04 01:18:21 +01:00

39 lines
1.2 KiB
Go

package dummy
// SPDX-License-Identifier: GPL-3.0-or-later
import (
"context"
"errors"
"io"
"git.blender.org/flamenco/internal/manager/api_impl"
"git.blender.org/flamenco/pkg/api"
)
// DummyShaman implements the Shaman interface from `internal/manager/api_impl/interfaces.go`
type DummyShaman struct{}
var _ api_impl.Shaman = (*DummyShaman)(nil)
var ErrDummyShaman = errors.New("Shaman storage component is inactive, configure Flamenco first")
func (ds *DummyShaman) IsEnabled() bool {
return false
}
func (ds *DummyShaman) Checkout(ctx context.Context, checkout api.ShamanCheckout) (string, error) {
return "", ErrDummyShaman
}
func (ds *DummyShaman) Requirements(ctx context.Context, requirements api.ShamanRequirementsRequest) (api.ShamanRequirementsResponse, error) {
return api.ShamanRequirementsResponse{}, ErrDummyShaman
}
func (ds *DummyShaman) FileStoreCheck(ctx context.Context, checksum string, filesize int64) api.ShamanFileStatus {
return api.ShamanFileStatusUnknown
}
func (ds *DummyShaman) FileStore(ctx context.Context, file io.ReadCloser, checksum string, filesize int64, canDefer bool, originalFilename string) error {
return ErrDummyShaman
}
func (ds *DummyShaman) EraseCheckout(checkoutID string) error {
return ErrDummyShaman
}