summaryrefslogtreecommitdiffstats
path: root/src/filestore/staging.rs
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2020-12-03 12:45:15 +0100
committerMatthias Beyer <mail@beyermatthias.de>2020-12-03 12:45:15 +0100
commitf09bfca7a8c028eede982508dbedecfed9b8327a (patch)
treec22eb14179d0c9f471410be1529ff0e350c2f595 /src/filestore/staging.rs
parent973219c576e2a40f8c9932006ab5334e20126489 (diff)
Make sure only the relative pathes are written to database
This patch is a bit of a mess. It makes sure that an crate::filestore::Artifact only knows its _relative_ path to the store it is put into. First of all, this is what it should be like. Secondly, we only want to track relative pathes in the database (to reduce database size, but more importantly because it is just duplicated data). The full path of an Artifact can always be reconstructed from the submit id, the configured pathes of the staging/release store and the artifact information (relative path) tracked in the database. This patch would not be necessary if we would introduce strong typing for the different kinds of pathes. This is most certainly on our todo list here. Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/filestore/staging.rs')
-rw-r--r--src/filestore/staging.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/filestore/staging.rs b/src/filestore/staging.rs
index 91e71d2..bd97f6c 100644
--- a/src/filestore/staging.rs
+++ b/src/filestore/staging.rs
@@ -51,7 +51,6 @@ impl StagingStore {
let p = ent?.path().context("Getting path of TAR entry")?.into_owned();
Ok(p)
})
- .map_ok(|path| dest.join(path))
.inspect(|p| trace!("Path in tar archive: {:?}", p))
.collect::<Result<Vec<_>>>()
.context("Collecting outputs of TAR archive")?;
@@ -67,13 +66,14 @@ impl StagingStore {
.into_iter()
.inspect(|p| trace!("Trying to load into staging store: {}", p.display()))
.filter_map(|path| {
- if path.is_dir() {
+ let fullpath = self.0.root.join(&path);
+ if fullpath.is_dir() {
None
} else {
Some({
- self.0.load_from_path(&path)
- .inspect(|r| trace!("Loading from path = {:?}", r))
- .with_context(|| anyhow!("Loading from path: {}", path.display()))
+ self.0.load_from_path(&fullpath)
+ .inspect(|r| trace!("Loaded from path {} = {:?}", fullpath.display(), r))
+ .with_context(|| anyhow!("Loading from path: {}", fullpath.display()))
.map_err(Error::from)
.map(|art| art.path().clone())
})