Remove some comments
This commit is contained in:
parent
6df253c030
commit
4cb24d3cd3
|
@ -2,4 +2,5 @@
|
||||||
- [ ] Simple auth
|
- [ ] Simple auth
|
||||||
- [ ] postgresql
|
- [ ] postgresql
|
||||||
- [ ] prometheus metrics
|
- [ ] prometheus metrics
|
||||||
- [ ] streaming layer bytes into providers
|
- [x] streaming layer bytes into providers
|
||||||
|
- [x] streaming layer bytes from providers
|
|
@ -28,7 +28,7 @@ pub async fn start_upload(path: web::Path<(String, )>) -> HttpResponse {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[patch("/{uuid}")]
|
#[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 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());
|
||||||
|
|
||||||
|
|
|
@ -104,32 +104,10 @@ impl FilesystemDriver {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl StorageDriverStreamer for 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 {
|
fn supports_streaming(&self) -> bool {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn start_streaming_thread(&self) -> anyhow::Result<()> {
|
|
||||||
todo!()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn start_stream_channel(&self) -> mpsc::Sender<(String, Bytes)> {
|
fn start_stream_channel(&self) -> mpsc::Sender<(String, Bytes)> {
|
||||||
self.streamer_sender.clone()
|
self.streamer_sender.clone()
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,12 +14,7 @@ pub trait Streamer {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait StorageDriverStreamer {
|
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 supports_streaming(&self) -> bool;
|
||||||
fn start_streaming_thread(&self) -> anyhow::Result<()>;
|
|
||||||
fn start_stream_channel(&self) -> mpsc::Sender<(String, Bytes)>;
|
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 save_digest(&self, digest: &str, bytes: &Bytes, append: bool) -> anyhow::Result<()>;
|
||||||
async fn delete_digest(&self, digest: &str) -> anyhow::Result<()>;
|
async fn delete_digest(&self, digest: &str) -> anyhow::Result<()>;
|
||||||
async fn replace_digest(&self, uuid: &str, 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<()>;
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue