diff --git a/manifest.json b/manifest.json deleted file mode 100644 index 1cba26e..0000000 --- a/manifest.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "schemaVersion": 2, - "mediaType": "application/vnd.docker.distribution.manifest.v2+json", - "config": { - "mediaType": "application/vnd.docker.container.image.v1+json", - "digest": "sha256:042a816809aac8d0f7d7cacac7965782ee2ecac3f21bcf9f24b1de1a7387b769" - }, - "layers": [ - { - "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip", - "size": 3370629, - "digest": "sha256:8921db27df2831fa6eaa85321205a2470c669b855f3ec95d5a3c2b46de0442c9" - } - ] -} \ No newline at end of file diff --git a/src/api/blobs.rs b/src/api/blobs.rs index 01572bf..c3978a4 100644 --- a/src/api/blobs.rs +++ b/src/api/blobs.rs @@ -1,5 +1,4 @@ -use actix_web::{HttpResponse, get, HttpRequest, post, web, head, delete}; -use tracing::{debug, trace}; +use actix_web::{HttpResponse, get, HttpRequest, web, head, delete}; use crate::app_state::AppState; @@ -37,6 +36,6 @@ pub async fn pull_digest(path: web::Path<(String, String)>, state: web::Data) -> HttpResponse { +pub async fn delete_digest(_req: HttpRequest, _state: web::Data) -> HttpResponse { todo!() } \ No newline at end of file diff --git a/src/api/manifests.rs b/src/api/manifests.rs index 2e7edfd..b7f0250 100644 --- a/src/api/manifests.rs +++ b/src/api/manifests.rs @@ -1,15 +1,15 @@ -use actix_web::{HttpResponse, HttpRequest, web, put, get, head}; +use actix_web::{HttpResponse, web, put, get, head}; use tracing::log::warn; -use tracing::{debug, trace, info}; +use tracing::{debug, info}; use crate::app_state::AppState; use crate::database::Database; use crate::dto::digest::Digest; -use crate::dto::manifest::{Manifest, ImageManifest}; +use crate::dto::manifest::Manifest; #[put("/{reference}")] -pub async fn upload_manifest(path: web::Path<(String, String)>, body: String, req: HttpRequest, state: web::Data) -> HttpResponse { +pub async fn upload_manifest(path: web::Path<(String, String)>, body: String, state: web::Data) -> HttpResponse { let (name, reference) = (path.0.to_owned(), path.1.to_owned()); // Calculate the sha256 digest for the manifest. @@ -54,7 +54,7 @@ pub async fn upload_manifest(path: web::Path<(String, String)>, body: String, re } #[get("/{reference}")] -pub async fn pull_manifest(path: web::Path<(String, String)>, req: HttpRequest, state: web::Data) -> HttpResponse { +pub async fn pull_manifest(path: web::Path<(String, String)>, state: web::Data) -> HttpResponse { let (name, reference) = (path.0.to_owned(), path.1.to_owned()); let database = &state.database; diff --git a/src/api/uploads.rs b/src/api/uploads.rs index 01034c7..0104377 100644 --- a/src/api/uploads.rs +++ b/src/api/uploads.rs @@ -27,7 +27,7 @@ pub async fn start_upload(path: web::Path<(String, )>) -> HttpResponse { #[patch("/{uuid}")] pub async fn chunked_upload_layer(body: Bytes, path: web::Path<(String, String)>, req: HttpRequest, state: web::Data) -> HttpResponse { let full_uri = req.uri().to_string(); - let (name, layer_uuid) = (path.0.to_owned(), path.1.to_owned()); + let (_name, layer_uuid) = (path.0.to_owned(), path.1.to_owned()); debug!("Read body of size: {}", body.len()); diff --git a/src/database/mod.rs b/src/database/mod.rs index 89ec77d..d6a8ddf 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -2,8 +2,7 @@ use std::io::Read; use async_trait::async_trait; use bytes::Bytes; -use sqlx::{sqlite::SqliteConnection, Sqlite, Pool}; -use tokio::sync::Mutex; +use sqlx::{Sqlite, Pool}; use tracing::debug; use chrono::{DateTime, Utc, NaiveDateTime}; @@ -67,7 +66,7 @@ impl Database for Pool { Ok(()) } - async fn has_digest(&self, digest: &str) -> bool { + async fn has_digest(&self, _digest: &str) -> bool { todo!() } @@ -94,7 +93,7 @@ impl Database for Pool { Ok(Some(bytes)) } - async fn digest_length(&self, digest: &str) -> usize { + async fn digest_length(&self, _digest: &str) -> usize { todo!() } @@ -144,7 +143,7 @@ impl Database for Pool { Ok(()) } - async fn unlink_manifest_layer(&self, repository: &str, layer_digest: &str) { + async fn unlink_manifest_layer(&self, _repository: &str, _layer_digest: &str) { todo!() } diff --git a/src/dto/digest.rs b/src/dto/digest.rs index 424fc08..89927c6 100644 --- a/src/dto/digest.rs +++ b/src/dto/digest.rs @@ -1,12 +1,10 @@ +#[allow(dead_code)] + pub struct Digest { algorithm: String, hex: String, } -pub enum DigestError { - InvalidDigestString(String), -} - impl Digest { /// Check if a string is a digest pub fn is_digest(s: &str) -> bool { @@ -18,17 +16,4 @@ impl Digest { false } - - pub fn from_string(s: &str) -> Result { - if let Some(idx) = s.find(":") { - let (algo, hex) = s.split_at(idx); - - return Ok(Self { - algorithm: algo.to_string(), - hex: hex.to_string(), - }) - } - - Err(DigestError::InvalidDigestString(String::from(s))) - } } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 2f4f4c6..eb6d1fa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,13 +3,10 @@ mod app_state; mod database; mod dto; -use std::sync::Arc; - use actix_web::{web, App, HttpServer}; use actix_web::middleware::Logger; use sqlx::sqlite::SqlitePoolOptions; -use tokio::sync::Mutex; use tracing::{debug, Level}; use app_state::AppState;