From 34291a0442ac6fb66967543f1bbf465c0b3dd731 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 22 Jan 2021 16:28:15 +0100 Subject: Let the JobHandle::run() return a Vec 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 Tested-by: Matthias Beyer --- src/filestore/merged.rs | 6 ++++++ src/filestore/path.rs | 6 ++++++ src/filestore/staging.rs | 5 +++++ 3 files changed, 17 insertions(+) (limited to 'src/filestore') 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 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) + } } -- cgit v1.2.3