summaryrefslogtreecommitdiffstats
path: root/src/filestore
diff options
context:
space:
mode:
authorMatthias Beyer <matthias.beyer@atos.net>2021-02-16 07:36:01 +0100
committerMatthias Beyer <matthias.beyer@atos.net>2021-02-16 08:00:30 +0100
commit09f5560442b13f8bf58152b36d8819ec309363fc (patch)
treefb8cea73aba9d17a0b7165e0a1e751c769cc325b /src/filestore
parent48317703c85ed55c4757aa6a966b7c5f5cdd1d14 (diff)
Rewrite artifact searching in replacement algorithm
This patch rewrites the replacement searching algorithm, to try the staging store first and then the release store. It does so by sorting the artifacts by whether they are in the staging store or not (hence the FullArtifactPath::is_in_staging_store() function). It filters out not-found artifacts and returns only ones that were found in either store. 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/path.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/filestore/path.rs b/src/filestore/path.rs
index bbcc727..486532f 100644
--- a/src/filestore/path.rs
+++ b/src/filestore/path.rs
@@ -20,6 +20,8 @@ use resiter::AndThen;
use resiter::Filter;
use resiter::Map;
+use crate::filestore::staging::StagingStore;
+
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct StoreRoot(PathBuf);
@@ -139,6 +141,11 @@ impl AsRef<Path> for ArtifactPath {
pub struct FullArtifactPath<'a>(&'a StoreRoot, &'a ArtifactPath);
impl<'a> FullArtifactPath<'a> {
+
+ pub fn is_in_staging_store(&self, store: &StagingStore) -> bool {
+ store.0.root == *self.0
+ }
+
pub fn artifact_path(&self) -> &ArtifactPath {
self.1
}