pub struct FileMetadata {
pub hashes: Hashes,
pub size: u64,
pub created_by: String,
pub add_time: Timestamp,
pub compression: Compression,
pub message: Option<String>,
}Expand description
The dvs metadata for a given file
Fields§
§hashes: Hashes§size: u64§created_by: String§add_time: Timestamp§compression: Compression§message: Option<String>Implementations§
Source§impl FileMetadata
impl FileMetadata
pub fn from_hashes( hashes: Hashes, size: u64, compression: Compression, message: Option<String>, ) -> Self
pub fn from_file( path: impl AsRef<Path>, compression: Compression, message: Option<String>, ) -> Result<Self>
Sourcepub fn save(
&self,
operation_id: Uuid,
source_file: impl AsRef<Path>,
backend: &dyn Backend,
paths: &DvsPaths,
relative_path: impl AsRef<Path>,
on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>,
) -> Result<(Outcome, Option<u64>)>
pub fn save( &self, operation_id: Uuid, source_file: impl AsRef<Path>, backend: &dyn Backend, paths: &DvsPaths, relative_path: impl AsRef<Path>, on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>, ) -> Result<(Outcome, Option<u64>)>
Returns whether the file already existed in the dvs folder and therefore is an update and the compressed size if applicable. Copies the source file to storage and saves metadata atomically (both succeed or neither).
Trait Implementations§
Source§impl Clone for FileMetadata
impl Clone for FileMetadata
Source§fn clone(&self) -> FileMetadata
fn clone(&self) -> FileMetadata
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FileMetadata
impl Debug for FileMetadata
Source§impl<'de> Deserialize<'de> for FileMetadata
impl<'de> Deserialize<'de> for FileMetadata
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for FileMetadata
impl PartialEq for FileMetadata
Auto Trait Implementations§
impl Freeze for FileMetadata
impl RefUnwindSafe for FileMetadata
impl Send for FileMetadata
impl Sync for FileMetadata
impl Unpin for FileMetadata
impl UnsafeUnpin for FileMetadata
impl UnwindSafe for FileMetadata
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more