diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:34 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:34 +0100 |
commit | 2a019c8bf622e1943b6d3209728570753d4bece0 (patch) | |
tree | ca83a978e13e56c5c2f5348cd16164b545820e42 /src/filestore/staging.rs | |
parent | d1badf8f02908478f50558e68f2a08b0e577979e (diff) |
Make FullArtifactPath a tuple of StoreRoot and ArtifactPath
This changes the implementation of FullArtifactPath from holding a
complete PathBuf object, to holding references to StoreRoot and
ArtifcatPath objects.
This not only reduces memory but more importantly is another step into
the right direction concerning strong path types.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/filestore/staging.rs')
-rw-r--r-- | src/filestore/staging.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/filestore/staging.rs b/src/filestore/staging.rs index 0aca6da..992a612 100644 --- a/src/filestore/staging.rs +++ b/src/filestore/staging.rs @@ -65,16 +65,15 @@ impl StagingStore { .context("Concatenating the output bytestream")? .into_iter() .inspect(|p| trace!("Trying to load into staging store: {}", p.display())) - .map(ArtifactPath::new) .filter_map(|path| { - let fullpath = self.0.root.join(&path); - if fullpath.is_dir() { + if self.0.root.join_path(&path).is_dir() { None } else { Some({ - self.0.load_from_path(&fullpath) - .inspect(|r| trace!("Loaded from path {} = {:?}", fullpath.display(), r)) - .with_context(|| anyhow!("Loading from path: {}", fullpath.display())) + let path = ArtifactPath::new(path); + self.0.load_from_path(&path) + .inspect(|r| trace!("Loaded from path {} = {:?}", path.display(), r)) + .with_context(|| anyhow!("Loading from path: {}", path.display())) .map_err(Error::from) .map(|art| art.path().clone()) }) |