WIP create a handler to download a file chunk by chunk.

This commit is contained in:
Florian THIERRY
2026-07-14 00:13:47 +02:00
parent 850dbca6cf
commit c24df944c5
14 changed files with 413 additions and 83 deletions
+6
View File
@@ -0,0 +1,6 @@
pub enum VideoError {
VideoDoesNotExists,
FolderDoesNotExists,
FolderBrowsingTechnicalIssue,
FileReadingTechnicalIssue
}
+3 -1
View File
@@ -1 +1,3 @@
pub mod model;
pub mod error;
pub mod model;
pub mod port;
+8 -2
View File
@@ -1,3 +1,5 @@
use uuid::Uuid;
pub enum VideoFormat {
AVI,
MKV,
@@ -6,7 +8,11 @@ pub enum VideoFormat {
UNKNOWN
}
pub trait VideoFile {}
pub struct Video {
filename: String,
format: VideoFormat
pub id: Uuid,
pub filename: String,
pub file: Box<dyn VideoFile>,
pub format: VideoFormat,
}
+16
View File
@@ -0,0 +1,16 @@
use uuid::Uuid;
use crate::video::error::VideoError;
use crate::video::model::Video;
pub trait VideoPort: Send + Sync {
fn list_root(&self) -> Result<Vec<Video>, VideoError>;
fn list_folder(&self, folder_id: Uuid) -> Result<Vec<Video>, VideoError>;
fn get_video_stream(&self, video_id: Uuid) -> Result<Video, VideoError>;
fn clone_box(&self) -> Box<dyn VideoPort>;
}
impl Clone for Box<dyn VideoPort> {
fn clone(&self) -> Self {
self.clone_box()
}
}