From 5529358019002fb25695cdff4ad321e7523d5935 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Mon, 10 May 2021 01:20:56 +0100 Subject: [PATCH] bundles: Prepare for process_bundle, skeleton Signed-off-by: Ian Jackson --- src/bundles.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bundles.rs b/src/bundles.rs index 596550cb..fab48e7a 100644 --- a/src/bundles.rs +++ b/src/bundles.rs @@ -168,6 +168,10 @@ impl Id { b_file(instance, self.index, self.kind) } + fn path_dir(&self, instance: &InstanceName) -> String { + b_file(instance, self.index, "d") + } + pub fn path(&self, instance: &Unauthorised, InstanceName>, auth: Authorisation) -> String { self.path_(&instance.by_ref(auth.therefore_ok()).name) @@ -388,6 +392,13 @@ where EH: BundleParseError, Parsed { meta } } +#[throws(LE)] +fn process_bundle(id: Id, instance: &InstanceName) { + let dir = id.path_dir(instance); + fs::create_dir(&dir) + .with_context(|| dir.clone()).context("mkdir").map_err(IE::from)?; +} + //---------- scanning/incorporating/uploading ---------- #[throws(InternalError)] @@ -550,6 +561,8 @@ impl Uploading { let parsed = parse_bundle::(id, &mut file, &tmp)?; + process_bundle(id, &*instance)?; + Uploaded { id, parsed } } } -- 2.30.2