diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-17 09:48:07 +0100 |
---|---|---|
committer | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-17 09:59:34 +0100 |
commit | 6b2e73a9cf24c80b3b86df68ff62392fdfc1e09c (patch) | |
tree | 4a448aadc8ba97f94fec1b877c050f987a89c32d /src/db | |
parent | 04e7602e34987b832e1d2e95405f61443b30a641 (diff) |
Pass MergedStores to endpoint/jobs rather than only staging store
This patch changes the code so that the MergedStores object is known in the
endpoints and job execution code.
This is necessary, because the jobs must be able to load artifacts from the
release store as well, for example if a library was released in another submit
and we can reuse it because the script for that library didn't change.
For that, the interface of StoreRoot::join() was changed
- -> Result<FullArtifactPath<'a>>
+ -> Result<Option<FullArtifactPath<'a>>>
whereas it returns an Ok(None) if the artifact requested does not exist.
This was necessary to try-joining a path on the store root of the staging store,
and if there is no such file continue with try-joining the path on the release
store.
The calling code got a bit more complex with that change, though.
Next, the MergedStores got a `derive(Clone)` because clone()ing it is cheap
(two `Arc`s) and necessary to pass it easily to the jobs.
Each instance of the code where the staging store was consulted was changed to
consult the the release store as well.
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/find_artifacts.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/db/find_artifacts.rs b/src/db/find_artifacts.rs index 613e63f..e3e418d 100644 --- a/src/db/find_artifacts.rs +++ b/src/db/find_artifacts.rs @@ -213,7 +213,7 @@ pub fn find_artifacts<'a>( ); if let Some(art) = staging.get(&artpath) { trace!("Found in staging: {:?}", art); - return staging.root_path().join(art).map(|p| (p, ndt)).map(Some) + return staging.root_path().join(art).map(|p| p.map(|p| (p, ndt))) } } @@ -222,7 +222,7 @@ pub fn find_artifacts<'a>( // filesystem. if let Some(art) = release_store.get(&artpath) { trace!("Found in release: {:?}", art); - return release_store.root_path().join(art).map(|p| (p, ndt)).map(Some) + return release_store.root_path().join(art).map(|p| p.map(|p| (p, ndt))) } Ok(None) |