Remove some comments

This commit is contained in:
SeanOMik 2023-04-20 22:18:53 -04:00
parent 6df253c030
commit 4cb24d3cd3
Signed by: SeanOMik
GPG Key ID: 568F326C7EB33ACB
4 changed files with 3 additions and 32 deletions

View File

@ -2,4 +2,5 @@
- [ ] Simple auth
- [ ] postgresql
- [ ] prometheus metrics
- [ ] streaming layer bytes into providers
- [x] streaming layer bytes into providers
- [x] streaming layer bytes from providers

View File

@ -28,7 +28,7 @@ pub async fn start_upload(path: web::Path<(String, )>) -> HttpResponse {
}
#[patch("/{uuid}")]
pub async fn chunked_upload_layer(/* body: Bytes */mut payload: web::Payload, path: web::Path<(String, String)>, req: HttpRequest, state: web::Data<AppState>) -> HttpResponse {
pub async fn chunked_upload_layer(mut payload: web::Payload, 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());

View File

@ -104,32 +104,10 @@ impl FilesystemDriver {
}
impl StorageDriverStreamer for FilesystemDriver {
fn write_payload(&self, digest: &str, payload: actix_web::web::Payload, append: bool) -> anyhow::Result<usize> {
Ok(tokio::runtime::Handle::current()
.block_on(self.write_payload(digest, payload, append))?)
/* block_on(|| async {
let path = self.get_digest_path(digest);
let mut file = fs::OpenOptions::new()
.write(true)
.append(append)
.create(true)
.open(path).await?;
file.write_all(&bytes).await?;
Ok(())
}); */
}
fn supports_streaming(&self) -> bool {
true
}
fn start_streaming_thread(&self) -> anyhow::Result<()> {
todo!()
}
fn start_stream_channel(&self) -> mpsc::Sender<(String, Bytes)> {
self.streamer_sender.clone()
}

View File

@ -14,12 +14,7 @@ pub trait Streamer {
}
pub trait StorageDriverStreamer {
/// Write an actix-web payload into the StorageDriver
/// Returns the amount of bytes written
fn write_payload(&self, digest: &str, payload: actix_web::web::Payload, append: bool) -> anyhow::Result<usize>;
fn supports_streaming(&self) -> bool;
fn start_streaming_thread(&self) -> anyhow::Result<()>;
fn start_stream_channel(&self) -> mpsc::Sender<(String, Bytes)>;
}
@ -31,7 +26,4 @@ pub trait StorageDriver: Send + StorageDriverStreamer/* : AsyncWrite + AsyncRead
async fn save_digest(&self, digest: &str, bytes: &Bytes, append: bool) -> anyhow::Result<()>;
async fn delete_digest(&self, digest: &str) -> anyhow::Result<()>;
async fn replace_digest(&self, uuid: &str, digest: &str) -> anyhow::Result<()>;
//async fn write_payload(&self, payload: Mutex<web::Payload>) -> anyhow::Result<()>;
//async fn write_stream<T, S: Stream<Item = T>>(&self, stream: S) -> anyhow::Result<()>;
}