Remove some compiler warnings, most were dead_code warnings
This commit is contained in:
parent
38c83f4ac7
commit
3c0259d49c
|
@ -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"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -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<App
|
|||
}
|
||||
|
||||
#[delete("/{digest}")]
|
||||
pub async fn delete_digest(req: HttpRequest, state: web::Data<AppState>) -> HttpResponse {
|
||||
pub async fn delete_digest(_req: HttpRequest, _state: web::Data<AppState>) -> HttpResponse {
|
||||
todo!()
|
||||
}
|
|
@ -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<AppState>) -> HttpResponse {
|
||||
pub async fn upload_manifest(path: web::Path<(String, String)>, body: String, state: web::Data<AppState>) -> 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<AppState>) -> HttpResponse {
|
||||
pub async fn pull_manifest(path: web::Path<(String, String)>, state: web::Data<AppState>) -> HttpResponse {
|
||||
let (name, reference) = (path.0.to_owned(), path.1.to_owned());
|
||||
|
||||
let database = &state.database;
|
||||
|
|
|
@ -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<AppState>) -> 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());
|
||||
|
||||
|
|
|
@ -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<Sqlite> {
|
|||
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<Sqlite> {
|
|||
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<Sqlite> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
async fn unlink_manifest_layer(&self, repository: &str, layer_digest: &str) {
|
||||
async fn unlink_manifest_layer(&self, _repository: &str, _layer_digest: &str) {
|
||||
todo!()
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Self, DigestError> {
|
||||
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)))
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue