pub(crate) mod archive;
pub(crate) mod dedup;
pub(crate) mod documents;
mod manifest;
pub(crate) mod media;
pub mod wizard;
mod worker;
mod date;
use std::collections::HashSet;
use std::path::PathBuf;
use crate::commands::keyring::bucket::store::BucketConfig;
use crate::core::crypto::Aes256GcmSivEncryptor;
use crate::core::job::Job;
pub(crate) use manifest::{PullTransformPlan, TypeSummary, gather_pending};
pub(crate) use media::TranscodeTargets;
pub(crate) use worker::PullTransformSummary;
pub(crate) struct PullTransformJob {
pub source_bucket: BucketConfig,
pub source_secret: String,
pub local_output: PathBuf,
pub remote: Option<(BucketConfig, String)>,
pub encryptor: Option<Aes256GcmSivEncryptor>,
pub allowed_extensions: HashSet<String>,
pub expand_zip_keys: HashSet<String>,
pub transcode_targets: TranscodeTargets,
}
impl Job for PullTransformJob {
type Plan = PullTransformPlan;
type Summary = PullTransformSummary;
async fn gather(&self) -> Result<PullTransformPlan, String> {
gather_pending(&self.source_bucket, &self.source_secret, &self.local_output).await
}
async fn run(
self,
plan: PullTransformPlan,
concurrency: usize,
upload_concurrency: usize,
) -> Result<PullTransformSummary, String> {
let remote_ref = self
.remote
.as_ref()
.map(|(bucket_config, secret)| (bucket_config, secret.as_str()));
worker::run_pull_transform_job(
&self.source_bucket,
&self.source_secret,
&self.local_output,
plan.tasks,
concurrency,
upload_concurrency,
remote_ref,
self.encryptor.as_ref(),
self.allowed_extensions,
self.expand_zip_keys,
self.transcode_targets,
)
.await
}
}