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 write(
&self,
paths: &DvsPaths,
relative_path: impl AsRef<Path>,
) -> Result<()>
pub fn write( &self, paths: &DvsPaths, relative_path: impl AsRef<Path>, ) -> Result<()>
Writes the metadata file, creating its directory if needed.
Sourcepub fn save(
&mut self,
operation_id: Uuid,
source_file: impl AsRef<Path>,
backend: &Backend,
paths: &DvsPaths,
relative_path: impl AsRef<Path>,
on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>,
) -> Result<(Outcome, Option<StoreResult>)>
pub fn save( &mut self, operation_id: Uuid, source_file: impl AsRef<Path>, backend: &Backend, paths: &DvsPaths, relative_path: impl AsRef<Path>, on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>, ) -> Result<(Outcome, Option<StoreResult>)>
Returns whether the file already existed in the dvs folder and therefore is an update and what storage reported, if it stored anything. Copies the source file to storage and saves metadata atomically (both succeed or neither).
Sourcepub fn store_and_write(
&mut self,
operation_id: Uuid,
source_file: impl AsRef<Path>,
backend: &Backend,
paths: &DvsPaths,
relative_path: impl AsRef<Path>,
on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>,
) -> Result<StoreResult>
pub fn store_and_write( &mut self, operation_id: Uuid, source_file: impl AsRef<Path>, backend: &Backend, paths: &DvsPaths, relative_path: impl AsRef<Path>, on_bytes: Option<&(dyn Fn(u64) + Send + Sync)>, ) -> Result<StoreResult>
Stores the file then writes the metadata, atomically: either both succeed or neither is left behind. Returns what storage reported.
Trait Implementations§
Source§impl Clone for FileMetadata
impl Clone for FileMetadata
Source§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