diff options
author | Matthias Beyer <matthias.beyer@atos.net> | 2021-02-07 12:35:33 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-02-08 09:37:04 +0100 |
commit | d319579fc89b5ac09f10abf4bfc77c21b0fc65ce (patch) | |
tree | e4fb352f3c1cd98383955d08c20fc0d311db51b7 /src/endpoint | |
parent | 31fb8c89fefd3167b8b928cd75ddc008da60b434 (diff) |
Remove `Artifact` type
This patch follows-up on the shrinking of the `Artifact` type and removes it
entirely.
The type is not needed. Only the `ArtifactPath` type is needed, which is a thin
wrapper around `PathBuf`, ensuring that the path is relative to the store root.
The `Artifact` type used `pom` to parse the name and version of the package from
the `ArtifactPath` object it contained, which resulted in the restriction that
the path must always be
<name>-<version>...
Which should not be a requirement and actually caused issues with a package
named "foo-bar" (as an example).
Signed-off-by: Matthias Beyer <matthias.beyer@atos.net>
Tested-by: Matthias Beyer <matthias.beyer@atos.net>
Diffstat (limited to 'src/endpoint')
-rw-r--r-- | src/endpoint/configured.rs | 11 | ||||
-rw-r--r-- | src/endpoint/scheduler.rs | 4 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/endpoint/configured.rs b/src/endpoint/configured.rs index 83d51b4..6979e71 100644 --- a/src/endpoint/configured.rs +++ b/src/endpoint/configured.rs @@ -390,9 +390,8 @@ impl<'a> PreparedContainer<'a> { .cloned() .map(|art| async { let artifact_file_name = art - .path() .file_name() - .ok_or_else(|| anyhow!("BUG: artifact {} is not a file", art.path().display())) + .ok_or_else(|| anyhow!("BUG: artifact {} is not a file", art.display())) .with_context(|| { anyhow!( "Collecting artifacts for copying to container {}", @@ -402,7 +401,7 @@ impl<'a> PreparedContainer<'a> { let destination = PathBuf::from("/inputs/").join(artifact_file_name); trace!( "Copying {} to container: {}:{}", - art.path().display(), + art.display(), container.id(), destination.display() ); @@ -410,13 +409,13 @@ impl<'a> PreparedContainer<'a> { .read() .await .root_path() - .join(art.path())? + .join(&art)? .read() .await .with_context(|| { anyhow!( "Reading artifact {}, so it can be copied to container", - art.path().display() + art.display() ) })?; @@ -426,7 +425,7 @@ impl<'a> PreparedContainer<'a> { .with_context(|| { anyhow!( "Copying artifact {} to container {} at {}", - art.path().display(), + art.display(), container.id(), destination.display() ) diff --git a/src/endpoint/scheduler.rs b/src/endpoint/scheduler.rs index d3e4857..0b404de 100644 --- a/src/endpoint/scheduler.rs +++ b/src/endpoint/scheduler.rs @@ -29,7 +29,7 @@ use uuid::Uuid; use crate::db::models as dbmodels; use crate::endpoint::Endpoint; use crate::endpoint::EndpointConfiguration; -use crate::filestore::Artifact; +use crate::filestore::ArtifactPath; use crate::filestore::StagingStore; use crate::job::JobResource; use crate::job::RunnableJob; @@ -146,7 +146,7 @@ impl std::fmt::Debug for JobHandle { } impl JobHandle { - pub async fn run(self) -> Result<Vec<Artifact>> { + pub async fn run(self) -> Result<Vec<ArtifactPath>> { let (log_sender, log_receiver) = tokio::sync::mpsc::unbounded_channel::<LogItem>(); let ep = self.endpoint.read().await; let endpoint = dbmodels::Endpoint::create_or_fetch(&self.db, ep.name())?; |