include resumable jobs within the job match

This commit is contained in:
brxken128 2023-01-23 11:02:32 +00:00
parent 5e30cf6354
commit cea4562cdc
No known key found for this signature in database
GPG key ID: 8B8D1AA6AE10A8FF
5 changed files with 34 additions and 8 deletions

View file

@ -4,6 +4,12 @@ use crate::{
library::LibraryContext,
location::indexer::indexer_job::{IndexerJob, INDEXER_JOB_NAME},
object::{
fs::{
copy::{FileCopierJob, COPY_JOB_NAME},
cut::{FileCutterJob, CUT_JOB_NAME},
delete::{FileDeleterJob, DELETE_JOB_NAME},
erase::{FileEraserJob, ERASE_JOB_NAME},
},
identifier_job::full_identifier_job::{FullFileIdentifierJob, FULL_IDENTIFIER_JOB_NAME},
preview::{ThumbnailJob, THUMBNAIL_JOB_NAME},
validation::validator_job::{ObjectValidatorJob, VALIDATOR_JOB_NAME},
@ -217,6 +223,26 @@ impl JobManager {
.dispatch_job(ctx, Job::resume(paused_job, ObjectValidatorJob {})?)
.await;
}
CUT_JOB_NAME => {
Arc::clone(&self)
.dispatch_job(ctx, Job::resume(paused_job, FileCutterJob {})?)
.await;
}
COPY_JOB_NAME => {
Arc::clone(&self)
.dispatch_job(ctx, Job::resume(paused_job, FileCopierJob {})?)
.await;
}
DELETE_JOB_NAME => {
Arc::clone(&self)
.dispatch_job(ctx, Job::resume(paused_job, FileDeleterJob {})?)
.await;
}
ERASE_JOB_NAME => {
Arc::clone(&self)
.dispatch_job(ctx, Job::resume(paused_job, FileEraserJob {})?)
.await;
}
_ => {
error!(
"Unknown job type: {}, id: {}",

View file

@ -31,7 +31,7 @@ pub struct FileCopierJobStep {
pub source_fs_info: FsInfo,
}
const JOB_NAME: &str = "file_copier";
pub const COPY_JOB_NAME: &str = "file_copier";
#[async_trait::async_trait]
impl StatefulJob for FileCopierJob {
@ -40,7 +40,7 @@ impl StatefulJob for FileCopierJob {
type Step = FileCopierJobStep;
fn name(&self) -> &'static str {
JOB_NAME
COPY_JOB_NAME
}
async fn init(&self, ctx: WorkerContext, state: &mut JobState<Self>) -> Result<(), JobError> {

View file

@ -27,7 +27,7 @@ pub struct FileCutterJobStep {
pub target_directory: PathBuf,
}
const JOB_NAME: &str = "file_cutter";
pub const CUT_JOB_NAME: &str = "file_cutter";
#[async_trait::async_trait]
impl StatefulJob for FileCutterJob {
@ -36,7 +36,7 @@ impl StatefulJob for FileCutterJob {
type Step = FileCutterJobStep;
fn name(&self) -> &'static str {
JOB_NAME
CUT_JOB_NAME
}
async fn init(&self, ctx: WorkerContext, state: &mut JobState<Self>) -> Result<(), JobError> {

View file

@ -20,7 +20,7 @@ pub struct FileDeleterJobStep {
pub fs_info: FsInfo,
}
const JOB_NAME: &str = "file_deleter";
pub const DELETE_JOB_NAME: &str = "file_deleter";
#[async_trait::async_trait]
impl StatefulJob for FileDeleterJob {
@ -29,7 +29,7 @@ impl StatefulJob for FileDeleterJob {
type Step = FileDeleterJobStep;
fn name(&self) -> &'static str {
JOB_NAME
DELETE_JOB_NAME
}
async fn init(&self, ctx: WorkerContext, state: &mut JobState<Self>) -> Result<(), JobError> {

View file

@ -29,7 +29,7 @@ pub struct FileEraserJobStep {
pub fs_info: FsInfo,
}
const JOB_NAME: &str = "file_eraser";
pub const ERASE_JOB_NAME: &str = "file_eraser";
#[async_trait::async_trait]
impl StatefulJob for FileEraserJob {
@ -38,7 +38,7 @@ impl StatefulJob for FileEraserJob {
type Step = FileEraserJobStep;
fn name(&self) -> &'static str {
JOB_NAME
ERASE_JOB_NAME
}
async fn init(&self, ctx: WorkerContext, state: &mut JobState<Self>) -> Result<(), JobError> {