diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:33 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2020-12-07 13:31:33 +0100 |
commit | 17e907e1863d8fecf25edac01d81d595b45a9b69 (patch) | |
tree | 55deefea0f5905eb942e8e35f9994c450044e538 /src/db | |
parent | 83b3b97fee854e19c63999e4daadf802784a1499 (diff) |
Add ArtifactPath, StoreRoot
This is the first step towards strong path typing for distinction
between artifact pathes.
It adds a type for Store root pathes and a type for artifact pathes.
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/db')
-rw-r--r-- | src/db/models/artifact.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/db/models/artifact.rs b/src/db/models/artifact.rs index b0a8dd3..31f80fb 100644 --- a/src/db/models/artifact.rs +++ b/src/db/models/artifact.rs @@ -1,5 +1,5 @@ -use std::path::Path; use std::path::PathBuf; +use crate::filestore::path::ArtifactPath; use anyhow::anyhow; use anyhow::Error; @@ -34,7 +34,7 @@ impl Artifact { PathBuf::from(&self.path) } - pub fn create(database_connection: &PgConnection, art_path: &Path, art_released: bool, job: &Job) -> Result<Artifact> { + pub fn create(database_connection: &PgConnection, art_path: &ArtifactPath, art_released: bool, job: &Job) -> Result<Artifact> { let path_str = art_path.to_str() .ok_or_else(|| anyhow!("Path is not valid UTF-8: {}", art_path.display())) .context("Writing artifact to database")?; |