pub struct Metadata {
pub mode: u32,
pub uid: u32,
pub gid: u32,
pub atime: i64,
pub mtime: i64,
pub atime_nsec: i64,
pub mtime_nsec: i64,
pub acls: WireAcls,
}Fields§
§mode: u32§uid: u32§gid: u32§atime: i64§mtime: i64§atime_nsec: i64§mtime_nsec: i64§acls: WireAclsThe source’s POSIX ACLs — or WireAcls::Unknown when they were never read (capture off,
or the source could not read them). Only ever Captured when the master asked via
ExtendedMetadataCapture.
Implementations§
Source§impl Metadata
impl Metadata
Sourcepub fn with_acls(self, acls: &Acls) -> Self
pub fn with_acls(self, acls: &Acls) -> Self
Attach a source entry’s POSIX ACLs, carrying the kernel’s bytes VERBATIM.
The bytes are never rebuilt or reordered. POSIX.1e requires canonical entry order
(USER_OBJ, named users by ascending uid, GROUP_OBJ, named groups by ascending gid,
MASK, OTHER) and the kernel rejects anything else with EINVAL — passing through what
the source kernel already validated sidesteps that entirely. The format is defined
little-endian (__le16/__le32), so it is portable across hosts as-is. Any future code
that CONSTRUCTS an ACL (id remapping, a synthesized entry) must sort canonically itself.
This is a builder rather than a field the From impls fill because neither of them has an
fd to read from: every site that SHOULD carry ACLs is therefore a visible call, and a site
that does not stays WireAcls::Unknown — which the destination reads as “leave the
destination’s ACLs alone”, never as a clear.
Sourcepub fn captured_acls(&self) -> Option<Acls>
pub fn captured_acls(&self) -> Option<Acls>
The ACLs this wire metadata carries, in the shape the destination applier takes — or
None when they are WireAcls::Unknown and the destination must not touch the
destination entry’s ACLs.
A Some holding all-None fields means “the source had no ACL”, which is a request to
CLEAR, not to leave the destination alone. That is safe to hand the applier because the
source only reads ACLs when the master asked it to, and the master derives that request
from the very same preserve settings it hands the destination — see
ExtendedMetadataCapture::for_preserve.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Metadata
impl<'de> Deserialize<'de> for Metadata
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>,
Source§impl From<&FileMeta> for Metadata
impl From<&FileMeta> for Metadata
Source§fn from(meta: &FileMeta) -> Self
fn from(meta: &FileMeta) -> Self
Build a wire Metadata from an fd-pinned common::safedir::FileMeta
snapshot (obtained via fstat/fstatat during a TOCTOU-safe walk),
reading every field through the shared preserve::Metadata trait so it
stays in lock-step with the &std::fs::Metadata conversion above.
ACLs stay WireAcls::Unknown here too: a FileMeta is a detached snapshot, not the fd
it came from, so it cannot answer an ACL probe. See Metadata::with_acls.
Source§impl From<&Metadata> for Metadata
impl From<&Metadata> for Metadata
Source§fn from(metadata: &Metadata) -> Self
fn from(metadata: &Metadata) -> Self
ACLs stay WireAcls::Unknown: a stat snapshot carries no fd, and reading an ACL by
path would answer from whatever inode the name resolves to now rather than the one this
snapshot describes. Call sites that should carry ACLs add them with
Metadata::with_acls; a site that cannot (the source failed to read them) correctly
leaves them Unknown, which the destination reads as “do not touch”, never as a clear.
Source§impl Metadata for Metadata
impl Metadata for Metadata
fn uid(&self) -> u32
fn gid(&self) -> u32
fn atime(&self) -> i64
fn atime_nsec(&self) -> i64
fn mtime(&self) -> i64
fn mtime_nsec(&self) -> i64
fn permissions(&self) -> Permissions
fn ctime(&self) -> i64
fn ctime_nsec(&self) -> i64
fn size(&self) -> u64
Source§impl Metadata for &Metadata
impl Metadata for &Metadata
fn uid(&self) -> u32
fn gid(&self) -> u32
fn atime(&self) -> i64
fn atime_nsec(&self) -> i64
fn mtime(&self) -> i64
fn mtime_nsec(&self) -> i64
fn permissions(&self) -> Permissions
fn ctime(&self) -> i64
fn ctime_nsec(&self) -> i64
fn size(&self) -> u64
Auto Trait Implementations§
impl Forget for Metadata
impl Freeze for Metadata
impl Move for Metadata
impl RefUnwindSafe for Metadata
impl Send for Metadata
impl Sync for Metadata
impl Unpin for Metadata
impl UnsafeUnpin for Metadata
impl UnwindSafe for Metadata
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request