pub(crate) mod classify;
mod manifest;
pub mod wizard;
mod worker;
use std::path::PathBuf;
use crate::commands::keyring::bucket::store::BucketConfig;
use crate::core::job::Job;
pub(crate) use manifest::{ReducePlan, gather_pending};
pub(crate) use worker::ReduceSummary;
pub(crate) struct ReduceJob {
pub source_bucket: BucketConfig,
pub source_secret: String,
pub local_output: PathBuf,
pub force_valuable: Vec<String>,
pub force_reproducible: Vec<String>,
pub remote: (BucketConfig, String),
}
impl Job for ReduceJob {
type Plan = ReducePlan;
type Summary = ReduceSummary;
async fn gather(&self) -> Result<ReducePlan, String> {
gather_pending(
&self.source_bucket,
&self.source_secret,
&self.local_output.join(".staging"),
&self.force_valuable,
&self.force_reproducible,
)
.await
}
async fn run(
self,
plan: ReducePlan,
concurrency: usize,
upload_concurrency: usize,
) -> Result<ReduceSummary, String> {
let (remote_bucket, remote_secret) = &self.remote;
worker::run_reduce_job(
&self.source_bucket,
&self.source_secret,
&self.local_output,
plan,
concurrency,
upload_concurrency,
(remote_bucket, remote_secret),
)
.await
}
}