diff options
author | Ilion Beyst <ilion.beyst@gmail.com> | 2022-06-17 19:01:40 +0200 |
---|---|---|
committer | Ilion Beyst <ilion.beyst@gmail.com> | 2022-06-17 19:01:40 +0200 |
commit | b90b3d3635f57bb84450d90544df536bf58e8588 (patch) | |
tree | 968e4a2834ea5c8dac04af39f69d2a4d5d605ced /planetwars-server/src/modules | |
parent | dde0bc820e47a372c9b1042249637c708a323188 (diff) | |
download | planetwars.dev-b90b3d3635f57bb84450d90544df536bf58e8588.tar.xz planetwars.dev-b90b3d3635f57bb84450d90544df536bf58e8588.zip |
store blobs in sha256 directory
Diffstat (limited to 'planetwars-server/src/modules')
-rw-r--r-- | planetwars-server/src/modules/registry.rs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/planetwars-server/src/modules/registry.rs b/planetwars-server/src/modules/registry.rs index d63621a..d10532a 100644 --- a/planetwars-server/src/modules/registry.rs +++ b/planetwars-server/src/modules/registry.rs @@ -62,7 +62,7 @@ async fn blob_check( Path((_repository_name, raw_digest)): Path<(String, String)>, ) -> impl IntoResponse { let digest = raw_digest.strip_prefix("sha256:").unwrap(); - let blob_path = PathBuf::from(REGISTRY_PATH).join(&digest); + let blob_path = PathBuf::from(REGISTRY_PATH).join("sha256").join(&digest); if blob_path.exists() { StatusCode::OK } else { @@ -162,9 +162,9 @@ async fn put_handler( } let digest = params.digest.strip_prefix("sha256:").unwrap(); // TODO: check the digest - let target_path = PathBuf::from(REGISTRY_PATH).join(&digest); + let target_path = PathBuf::from(REGISTRY_PATH).join("sha256").join(&digest); tokio::fs::rename(&upload_path, &target_path).await.unwrap(); - println!("DIGEST {}", digest); + Response::builder() .status(StatusCode::CREATED) .header( @@ -182,7 +182,9 @@ async fn put_manifest( Path((repository_name, reference)): Path<(String, String)>, mut stream: BodyStream, ) -> impl IntoResponse { - let repository_dir = PathBuf::from(REGISTRY_PATH).join(&repository_name); + let repository_dir = PathBuf::from(REGISTRY_PATH) + .join("manifests") + .join(&repository_name); tokio::fs::create_dir_all(&repository_dir).await.unwrap(); |