pub struct FileHeader { /* private fields */ }Expand description
Each dumped file* contains a FileHeader containing several metadata. The following metadata are included in a FileHeader:
- the internal file number of the appropriate file.
- the FileType of the appropriate file.
- the original filename of the appropriate file without the full path (just the filename, e.g. “my_texfile.txt” or “my_directory”)
- the file number of the parent directory of this file (if the file lies into the root directory, this is 0 because the first valid file number in zff is 1).
- the atime, mtime, ctime and btime.
- A HashMap to extend the metadata based on the operating system/filesystem. Some fields are predefined, see the full list in the wiki
Implementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn new<F: Into<String>>(
version: u8,
file_number: u64,
file_type: FileType,
filename: F,
parent_file_number: u64,
atime: u64,
mtime: u64,
ctime: u64,
btime: u64,
metadata_ext: HashMap<String, String>,
) -> FileHeader
pub fn new<F: Into<String>>( version: u8, file_number: u64, file_type: FileType, filename: F, parent_file_number: u64, atime: u64, mtime: u64, ctime: u64, btime: u64, metadata_ext: HashMap<String, String>, ) -> FileHeader
creates a new FileHeader with the given values.
Sourcepub fn file_number(&self) -> u64
pub fn file_number(&self) -> u64
returns the file number
Sourcepub fn parent_file_number(&self) -> u64
pub fn parent_file_number(&self) -> u64
returns the file number of the parent directory
Sourcepub fn metadata_ext(&self) -> &HashMap<String, String>
pub fn metadata_ext(&self) -> &HashMap<String, String>
returns the extended metadata HashMap as a reference.
Sourcepub fn transform_to_hardlink(&mut self)
pub fn transform_to_hardlink(&mut self)
transforms the inner FileType to a FileType::Hardlink. This does not work with a FileType::Symlink!
Sourcepub fn encode_encrypted_header_directly<K>(
&self,
key: K,
encryption_header: EncryptionHeader,
) -> Result<Vec<u8>>
pub fn encode_encrypted_header_directly<K>( &self, key: K, encryption_header: EncryptionHeader, ) -> Result<Vec<u8>>
encodes the file header to a Vec<u8>. The encryption flag of the appropriate object header has to be set to 2.
§Error
The method returns an error, if the encryption fails.
Sourcepub fn decode_encrypted_header_with_key<R, K>(
data: &mut R,
key: K,
encryption_header: EncryptionHeader,
) -> Result<FileHeader>
pub fn decode_encrypted_header_with_key<R, K>( data: &mut R, key: K, encryption_header: EncryptionHeader, ) -> Result<FileHeader>
decodes the encrypted header with the given key and crate::header::EncryptionHeader. The appropriate crate::header::EncryptionHeader has to be stored in the appropriate crate::header::ObjectHeader.
Trait Implementations§
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FileHeader
impl Debug for FileHeader
Source§impl HeaderCoding for FileHeader
impl HeaderCoding for FileHeader
Source§type Item = FileHeader
type Item = FileHeader
Source§fn identifier() -> u32
fn identifier() -> u32
Source§fn decode_content(data: Vec<u8>) -> Result<FileHeader>
fn decode_content(data: Vec<u8>) -> Result<FileHeader>
Source§fn header_size(&self) -> usize
fn header_size(&self) -> usize
Source§fn encode_directly(&self) -> Vec<u8> ⓘ
fn encode_directly(&self) -> Vec<u8> ⓘ
Source§fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
fn encode_for_key<K: Into<String>>(&self, key: K) -> Vec<u8> ⓘ
Source§fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
fn decode_header_length<R: Read>(data: &mut R) -> Result<u64>
Source§fn check_identifier<R: Read>(data: &mut R) -> bool
fn check_identifier<R: Read>(data: &mut R) -> bool
Source§impl PartialEq for FileHeader
impl PartialEq for FileHeader
impl Eq for FileHeader
impl StructuralPartialEq for FileHeader
Auto Trait Implementations§
impl Freeze for FileHeader
impl RefUnwindSafe for FileHeader
impl Send for FileHeader
impl Sync for FileHeader
impl Unpin for FileHeader
impl UnwindSafe for FileHeader
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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