mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-29 02:42:47 -04:00
* First draft on task system usage, still missing job system * Scan location roughly working, a ton of stuff to fix yet * Updating some deps due to crashes and bugs * Exposing non critical errors to frontend * Getting active job reports from job system * Using boxed opaque type to avoid a downcast issue with generics * Task system issues discovered on race conditions * Enable debug * Fix job report in the job manager * Fix race condition on steal tasks * Fixed race condition on task suspend * Some fixes on job progress reporting and save * Fixed many race conditions and a hard deadlock Also some progress report polishing * Ignore .ts and .mts video files for now * Some better logs * bruh * Internal deadlocks and excess of communication in the task system - Also better logs * Bunch of fixes and optimizations * WIP at fixing file identifier * Fixed file identifier job - still need to work on its progress report frontend * A bunch of polishing * Fixed some bugs and did more polishing * Cleanup * Bridging old and new job systems * A ton of fixes * A bunch of bugs related to shutdown and resume * Indexer and watcher bugs * Log normalizing * Fixing CI * Change error! to warn! on non critical errors log * Fix redirect to new location * Type annotation * Bogus merge resolution on cargo lock
115 lines
2.6 KiB
Rust
115 lines
2.6 KiB
Rust
#![recursion_limit = "256"]
|
|
#![warn(
|
|
clippy::all,
|
|
clippy::pedantic,
|
|
clippy::correctness,
|
|
clippy::perf,
|
|
clippy::style,
|
|
clippy::suspicious,
|
|
clippy::complexity,
|
|
clippy::nursery,
|
|
clippy::unwrap_used,
|
|
unused_qualifications,
|
|
rust_2018_idioms,
|
|
trivial_casts,
|
|
trivial_numeric_casts,
|
|
unused_allocation,
|
|
clippy::unnecessary_cast,
|
|
clippy::cast_lossless,
|
|
clippy::cast_possible_truncation,
|
|
clippy::cast_possible_wrap,
|
|
clippy::cast_precision_loss,
|
|
clippy::cast_sign_loss,
|
|
clippy::dbg_macro,
|
|
clippy::deprecated_cfg_attr,
|
|
clippy::separated_literal_suffix,
|
|
deprecated
|
|
)]
|
|
#![forbid(deprecated_in_future)]
|
|
#![allow(clippy::missing_errors_doc, clippy::module_name_repetitions)]
|
|
|
|
use sd_prisma::prisma::file_path;
|
|
use sd_task_system::TaskSystemError;
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
use specta::Type;
|
|
use thiserror::Error;
|
|
|
|
pub mod file_identifier;
|
|
pub mod indexer;
|
|
pub mod job_system;
|
|
pub mod media_processor;
|
|
pub mod utils;
|
|
|
|
use media_processor::ThumbKey;
|
|
|
|
pub use job_system::{
|
|
job::{
|
|
IntoJob, JobContext, JobEnqueuer, JobName, JobOutput, JobOutputData, OuterContext,
|
|
ProgressUpdate,
|
|
},
|
|
report::Report,
|
|
JobId, JobSystem, JobSystemError,
|
|
};
|
|
|
|
#[derive(Error, Debug)]
|
|
pub enum Error {
|
|
#[error(transparent)]
|
|
Indexer(#[from] indexer::Error),
|
|
#[error(transparent)]
|
|
FileIdentifier(#[from] file_identifier::Error),
|
|
#[error(transparent)]
|
|
MediaProcessor(#[from] media_processor::Error),
|
|
|
|
#[error(transparent)]
|
|
TaskSystem(#[from] TaskSystemError),
|
|
|
|
#[error(transparent)]
|
|
JobSystem(#[from] JobSystemError),
|
|
}
|
|
|
|
impl From<Error> for rspc::Error {
|
|
fn from(e: Error) -> Self {
|
|
match e {
|
|
Error::Indexer(e) => e.into(),
|
|
Error::FileIdentifier(e) => e.into(),
|
|
Error::MediaProcessor(e) => e.into(),
|
|
Error::TaskSystem(e) => {
|
|
Self::with_cause(rspc::ErrorCode::InternalServerError, e.to_string(), e)
|
|
}
|
|
Error::JobSystem(e) => e.into(),
|
|
}
|
|
}
|
|
}
|
|
|
|
#[derive(thiserror::Error, Debug, Serialize, Deserialize, Type, Clone)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum NonCriticalError {
|
|
// TODO: Add variants as needed
|
|
#[error(transparent)]
|
|
Indexer(#[from] indexer::NonCriticalIndexerError),
|
|
#[error(transparent)]
|
|
FileIdentifier(#[from] file_identifier::NonCriticalFileIdentifierError),
|
|
#[error(transparent)]
|
|
MediaProcessor(#[from] media_processor::NonCriticalMediaProcessorError),
|
|
}
|
|
|
|
#[repr(i32)]
|
|
#[derive(Debug, Clone, Copy, Serialize, Deserialize, Type, Eq, PartialEq)]
|
|
pub enum LocationScanState {
|
|
Pending = 0,
|
|
Indexed = 1,
|
|
FilesIdentified = 2,
|
|
Completed = 3,
|
|
}
|
|
|
|
#[derive(Debug, Serialize, Type)]
|
|
pub enum UpdateEvent {
|
|
NewThumbnail {
|
|
thumb_key: ThumbKey,
|
|
},
|
|
NewIdentifiedObjects {
|
|
file_path_ids: Vec<file_path::id::Type>,
|
|
},
|
|
}
|