pub struct RecordSlot(/* private fields */);Expand description
A discovery slot whose publishers and conditional cleanup share a lock. Use the same slot path in every generation. Lock files remain persistent.
Implementations§
Source§impl RecordSlot
impl RecordSlot
Sourcepub fn new(path: impl Into<PathBuf>) -> Self
pub fn new(path: impl Into<PathBuf>) -> Self
Address an existing application-owned directory. This performs no I/O.
Sourcepub fn replace(&self, contents: &[u8]) -> Result<()>
pub fn replace(&self, contents: &[u8]) -> Result<()>
Atomically publish while excluding conditional cleanup by older owners.
Sourcepub fn repair(&self, contents: &[u8]) -> Result<bool>
pub fn repair(&self, contents: &[u8]) -> Result<bool>
Restore an owned record only if its contents differ. The caller must still be authorized to advertise this endpoint; a lock does not elect it.
Sourcepub fn remove_if_matches(&self, contents: &[u8]) -> Result<bool>
pub fn remove_if_matches(&self, contents: &[u8]) -> Result<bool>
Remove only the exact record still belonging to this owner. A successor’s publication cannot race between the comparison and unlink.
Trait Implementations§
Source§impl Clone for RecordSlot
impl Clone for RecordSlot
Auto Trait Implementations§
impl Freeze for RecordSlot
impl RefUnwindSafe for RecordSlot
impl Send for RecordSlot
impl Sync for RecordSlot
impl Unpin for RecordSlot
impl UnsafeUnpin for RecordSlot
impl UnwindSafe for RecordSlot
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