pub struct M2dir { /* private fields */ }Expand description
A single m2dir directory on the filesystem.
Holds the root path and provides helpers to derive entry paths, metadata paths, and a new filename for a delivery.
Implementations§
Source§impl M2dir
impl M2dir
Sourcepub fn from_path(path: impl Into<M2dirPath>) -> Self
pub fn from_path(path: impl Into<M2dirPath>) -> Self
Builds an M2dir from a path without checking the marker.
Sourcepub fn marker_path(&self) -> M2dirPath
pub fn marker_path(&self) -> M2dirPath
Returns the path to the .m2dir marker file.
Sourcepub fn flags_path(&self, id: &str) -> M2dirPath
pub fn flags_path(&self, id: &str) -> M2dirPath
Returns the path to the .flags metadata file for the given
entry id.
Sourcepub fn entry_path(
&self,
bytes: &[u8],
nonce_bytes: &[u8],
) -> (String, M2dirPath)
pub fn entry_path( &self, bytes: &[u8], nonce_bytes: &[u8], ) -> (String, M2dirPath)
Computes the filename and final on-disk path for a new entry
holding bytes. The filename is <date>,<checksum>.<nonce>
per the m2dir specification.
nonce_bytes should be 4 freshly-generated random bytes
supplied by the caller.
Sourcepub fn tmp_path(&self, pid: u32, counter: u32) -> M2dirPath
pub fn tmp_path(&self, pid: u32, counter: u32) -> M2dirPath
Returns the path of a temporary file inside this m2dir, used during the write-then-rename delivery sequence.
Sourcepub fn parse_filename_id(filename: &str) -> Option<&str>
pub fn parse_filename_id(filename: &str) -> Option<&str>
Splits a filename into its <checksum>.<nonce> tail (used as
the entry id).
Trait Implementations§
impl Eq for M2dir
Source§impl Ord for M2dir
impl Ord for M2dir
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for M2dir
impl PartialOrd for M2dir
impl StructuralPartialEq for M2dir
Auto Trait Implementations§
impl Freeze for M2dir
impl RefUnwindSafe for M2dir
impl Send for M2dir
impl Sync for M2dir
impl Unpin for M2dir
impl UnsafeUnpin for M2dir
impl UnwindSafe for M2dir
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