summaryrefslogtreecommitdiffstats
path: root/src/filestore
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-01-22 16:28:15 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-01-25 15:35:21 +0100
commit34291a0442ac6fb66967543f1bbf465c0b3dd731 (patch)
treee4d2feb6fef85527710b6d3d4431903f041eab72 /src/filestore
parent5a51e23ba57491d100f4ffeac5c8657aaa1b011b (diff)
Let the JobHandle::run() return a Vec<Artifact>
Before that change, it returned the dbmodels::Artifact objects, for which we needed to fetch the filestore::Artifact again. This change removes that restriction (improving runtime, of course). Signed-off-by: Matthias Beyer <matthias.beyer@atos.net> Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/filestore')
-rw-r--r--src/filestore/merged.rs6
-rw-r--r--src/filestore/path.rs6
-rw-r--r--src/filestore/staging.rs5
3 files changed, 17 insertions, 0 deletions
diff --git a/src/filestore/merged.rs b/src/filestore/merged.rs
index 3ed59dd..0b19d85 100644
--- a/src/filestore/merged.rs
+++ b/src/filestore/merged.rs
@@ -8,6 +8,11 @@
// SPDX-License-Identifier: EPL-2.0
//
+// TODO: The MergedStores is not used at all anymore, because we removed the feature while doing
+// the rewrite
+#![allow(unused)]
+
+
use std::sync::Arc;
use std::path::Path;
@@ -21,6 +26,7 @@ use crate::filestore::path::ArtifactPath;
use crate::filestore::ReleaseStore;
use crate::filestore::StagingStore;
+
/// A type that merges the release store and the staging store
///
/// The stores are not actually merged (on disk or in memory), but the querying mechanism works in
diff --git a/src/filestore/path.rs b/src/filestore/path.rs
index ab0655b..cfa999f 100644
--- a/src/filestore/path.rs
+++ b/src/filestore/path.rs
@@ -149,6 +149,12 @@ impl ArtifactPath {
}
}
+impl AsRef<Path> for ArtifactPath {
+ fn as_ref(&self) -> &Path {
+ &self.0
+ }
+}
+
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct FullArtifactPath<'a>(&'a StoreRoot, &'a ArtifactPath);
diff --git a/src/filestore/staging.rs b/src/filestore/staging.rs
index b944d84..788cd02 100644
--- a/src/filestore/staging.rs
+++ b/src/filestore/staging.rs
@@ -19,6 +19,7 @@ use indicatif::ProgressBar;
use log::trace;
use result_inspect::ResultInspect;
+use crate::filestore::Artifact;
use crate::filestore::path::ArtifactPath;
use crate::filestore::path::StoreRoot;
use crate::filestore::util::FileStoreImpl;
@@ -100,4 +101,8 @@ impl StagingStore {
pub fn root_path(&self) -> &StoreRoot {
self.0.root_path()
}
+
+ pub fn get(&self, p: &ArtifactPath) -> Option<&Artifact> {
+ self.0.get(p)
+ }
}