pub struct FileHeader {
pub uid: u32,
pub gid: u32,
pub mode: u32,
pub symlink_target: String,
pub xattrs: Xattrs,
}Expand description
The metadata of one file content object, common to all header wire forms.
Fields§
§uid: u32The owner uid.
gid: u32The owner gid.
mode: u32Full logical st_mode; the file-type bits must name a regular file or
a symlink.
symlink_target: StringSymlink target; must be empty for regular files.
xattrs: XattrsThe file’s extended attributes.
Implementations§
Source§impl FileHeader
impl FileHeader
Sourcepub fn is_symlink(&self) -> bool
pub fn is_symlink(&self) -> bool
Whether the mode names a symlink.
Sourcepub fn parse(data: &[u8]) -> Result<FileHeader>
pub fn parse(data: &[u8]) -> Result<FileHeader>
Parse the uncompressed header form (uuuusa(ayay)).
Sourcepub fn serialize(&self) -> Result<Vec<u8>>
pub fn serialize(&self) -> Result<Vec<u8>>
Serialize the uncompressed header form (uuuusa(ayay)).
Sourcepub fn parse_stat_metadata(data: &[u8]) -> Result<FileHeader>
pub fn parse_stat_metadata(data: &[u8]) -> Result<FileHeader>
Parse the stat-metadata form (uuua(ayay)) – the layout dirmeta uses,
and the layout stored in the user.ostreemeta xattr of a bare-user
.file object. The three scalar fields are uid, gid, and the full
st_mode (big-endian); there is no rdev and no symlink-target field, so
the returned header has an empty target. A bare-user symlink carries a
symlink st_mode here and keeps its target in the file content, which
the caller supplies separately.
Sourcepub fn serialize_stat_metadata(&self) -> Result<Vec<u8>>
pub fn serialize_stat_metadata(&self) -> Result<Vec<u8>>
Serialize the stat-metadata form (uuua(ayay)) – uid, gid, and the
full st_mode (big-endian) followed by the sorted xattr array. This is
the layout stored in the user.ostreemeta xattr of a bare-user .file
object; a bare-user symlink carries its S_IFLNK mode here and keeps its
target in the file content. There is no rdev or symlink-target field.
The inverse of parse_stat_metadata.
Sourcepub fn parse_archive(data: &[u8]) -> Result<(FileHeader, u64)>
pub fn parse_archive(data: &[u8]) -> Result<(FileHeader, u64)>
Parse the archive header form (tuuuusa(ayay)), returning the header
and the uncompressed payload size.
Trait Implementations§
Source§impl Clone for FileHeader
impl Clone for FileHeader
Source§fn clone(&self) -> FileHeader
fn clone(&self) -> FileHeader
1.0.0 (const: unstable) · 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
impl Eq for FileHeader
Source§impl GvEncode for FileHeader
The encode path is purely mechanical: domain validation runs in the
serialize* entry points, which are the only callers.
impl GvEncode for FileHeader
The encode path is purely mechanical: domain validation runs in the
serialize* entry points, which are the only callers.
Source§impl GvType for FileHeader
The uncompressed header form, (uuuusa(ayay)).
impl GvType for FileHeader
The uncompressed header form, (uuuusa(ayay)).
Source§const SIGNATURE: &'static str = "(uuuusa(ayay))"
const SIGNATURE: &'static str = "(uuuusa(ayay))"
Source§const FIXED_SIZE: Option<usize> = None
const FIXED_SIZE: Option<usize> = None
None.