pub struct Contest { /* private fields */ }Expand description
Fleet-shared contest handle. Cheap to clone.
Implementations§
Source§impl Contest
impl Contest
pub fn new(fleet: Arc<Fleet>) -> Self
Sourcepub fn reset_ring(&self) -> Result<()>
pub fn reset_ring(&self) -> Result<()>
Clear the shared contest ring.
Intended for owner-controlled boot-time cleanup before peer processes publish claims. It is not a runtime coordination tool.
Sourcepub fn try_claim<T: ContestType>(
&self,
subject: impl Into<String>,
owner: impl Into<ContestOwner>,
ttl: Duration,
) -> Result<Claim>
pub fn try_claim<T: ContestType>( &self, subject: impl Into<String>, owner: impl Into<ContestOwner>, ttl: Duration, ) -> Result<Claim>
Try to become the first active claimant for a typed subject.
The caller supplies an owner label only for observability. Orbit does not interpret it.
Sourcepub fn try_claim_at<T: ContestType>(
&self,
subject: impl Into<String>,
owner: impl Into<ContestOwner>,
ttl: Duration,
now_ms: u64,
) -> Result<Claim>
pub fn try_claim_at<T: ContestType>( &self, subject: impl Into<String>, owner: impl Into<ContestOwner>, ttl: Duration, now_ms: u64, ) -> Result<Claim>
Same as Self::try_claim, but with an explicit clock value.
Useful for deterministic tests and embedders with their own
time source.
Sourcepub fn try_claim_subject(
&self,
subject: ContestSubject,
owner: impl Into<ContestOwner>,
ttl: Duration,
) -> Result<Claim>
pub fn try_claim_subject( &self, subject: ContestSubject, owner: impl Into<ContestOwner>, ttl: Duration, ) -> Result<Claim>
Try to claim a pre-built subject.
Sourcepub fn try_claim_subject_at(
&self,
subject: ContestSubject,
owner: impl Into<ContestOwner>,
ttl: Duration,
now_ms: u64,
) -> Result<Claim>
pub fn try_claim_subject_at( &self, subject: ContestSubject, owner: impl Into<ContestOwner>, ttl: Duration, now_ms: u64, ) -> Result<Claim>
Same as Self::try_claim_subject, but with an explicit clock.
Sourcepub fn guard_holder(&self, holder: Holder) -> Guard
pub fn guard_holder(&self, holder: Holder) -> Guard
Turn an observed holder into a drop-released guard.
This is useful for re-entrant owners: a process may observe that it already owns the active claim, continue carrying the same responsibility, and release the original claim when the guard leaves scope.
Sourcepub fn release_holder(&self, holder: &Holder) -> Result<NetId64>
pub fn release_holder(&self, holder: &Holder) -> Result<NetId64>
Release a holder observed through a yield path.
This is useful for re-entrant owners: a process may keep probing under its own still-active claim, then release that original claim when the guarded work succeeds.