pub struct FileClaimRegistry { /* private fields */ }Expand description
Shared registry of file claims for one swarm (or multi-writer) run.
Implementations§
Source§impl FileClaimRegistry
impl FileClaimRegistry
pub fn new() -> Self
Sourcepub fn set_listener(&self, listener: Option<ConflictListener>)
pub fn set_listener(&self, listener: Option<ConflictListener>)
Install (or replace) the conflict listener.
Sourcepub fn claim_key(path: &Path) -> String
pub fn claim_key(path: &Path) -> String
Normalize a path for claim keys: absolute, no trailing slash noise.
Sourcepub fn try_claim(
&self,
agent_id: &str,
agent_label: &str,
path: &Path,
) -> ClaimResult
pub fn try_claim( &self, agent_id: &str, agent_label: &str, path: &Path, ) -> ClaimResult
Try to claim path for agent_id. Same agent re-claim is a no-op success.
pub fn set_stale_listener(&self, listener: Option<StaleListener>)
Sourcepub fn note_read(&self, agent_id: &str, path: &Path) -> Option<FileStaleEvent>
pub fn note_read(&self, agent_id: &str, path: &Path) -> Option<FileStaleEvent>
Record a read. If another agent wrote since this reader last saw the path, return a stale event (and notify the listener).
Sourcepub fn release_agent(&self, agent_id: &str)
pub fn release_agent(&self, agent_id: &str)
Drop every claim held by agent_id (worker finished).
Sourcepub fn snapshot(&self) -> Vec<(String, String)>
pub fn snapshot(&self) -> Vec<(String, String)>
Snapshot of current claims (path → owner label), sorted by path.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl Clone for FileClaimRegistry
impl Clone for FileClaimRegistry
Source§impl Debug for FileClaimRegistry
impl Debug for FileClaimRegistry
Auto Trait Implementations§
impl Freeze for FileClaimRegistry
impl RefUnwindSafe for FileClaimRegistry
impl Send for FileClaimRegistry
impl Sync for FileClaimRegistry
impl Unpin for FileClaimRegistry
impl UnsafeUnpin for FileClaimRegistry
impl UnwindSafe for FileClaimRegistry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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> ⓘ
Converts
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> ⓘ
Converts
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