FileUploading::new
This commit is contained in:
parent
9c2fdd95c6
commit
cf84eed717
2 changed files with 14 additions and 10 deletions
|
|
@ -66,11 +66,6 @@ impl FileChecked {
|
|||
|
||||
debug!("patch uri: {location}");
|
||||
|
||||
Ok(FileUploading {
|
||||
path: self.path,
|
||||
size,
|
||||
uri: location,
|
||||
offset: 0,
|
||||
})
|
||||
Ok(FileUploading::new(self.path, size, location))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,10 +15,10 @@ use super::{Alias, SharryAlias};
|
|||
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct FileUploading {
|
||||
pub(super) path: PathBuf,
|
||||
pub(super) size: usize,
|
||||
pub(super) uri: String,
|
||||
pub(super) offset: usize,
|
||||
path: PathBuf,
|
||||
size: usize,
|
||||
uri: String,
|
||||
offset: usize,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
|
|
@ -36,6 +36,15 @@ pub enum ChunkState {
|
|||
}
|
||||
|
||||
impl FileUploading {
|
||||
pub(super) fn new(path: PathBuf, size: usize, uri: String) -> Self {
|
||||
Self {
|
||||
path,
|
||||
size,
|
||||
uri,
|
||||
offset: 0,
|
||||
}
|
||||
}
|
||||
|
||||
fn read_chunk(&self, chunk_size: usize) -> io::Result<Vec<u8>> {
|
||||
let offset = u64::try_from(self.offset).map_err(io::Error::other)?;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue