pub struct ConcurrencyControl { /* private fields */ }Expand description
Opt-in runtime enforcement of concurrency-anomaly gating for a coordination
group. Attach one to crate::SharedInfra to have the isolated parallel
swarm gate its merge barrier; absent, coordination behaves exactly as before
(purely additive, matching the empty-default-gate-list stance in
car-engine).
Carries the gate policy and a monotonic logical
clock used to stamp each op’s read_at/commit_at, so the detector can tell
which generate windows overlapped.
Implementations§
Source§impl ConcurrencyControl
impl ConcurrencyControl
Sourcepub fn new(policy: ConcurrencyGatePolicy) -> Self
pub fn new(policy: ConcurrencyGatePolicy) -> Self
Build with an explicit gate policy.
Sourcepub fn with_default_policy() -> Self
pub fn with_default_policy() -> Self
Build with the default policy: abort on L0 (causal-cascade), require
approval on L1 (stale-generation), auto-remediate the rest.
Sourcepub fn policy(&self) -> &ConcurrencyGatePolicy
pub fn policy(&self) -> &ConcurrencyGatePolicy
The gate policy in force.
Sourcepub fn tick(&self) -> u64
pub fn tick(&self) -> u64
Next logical timestamp on the shared monotonic clock. Agents stamp
read_at before they run and commit_at when they finish, so two agents
that ran concurrently get overlapping [read_at, commit_at] windows.
Sourcepub async fn guard(
&self,
ops: &[AgentOp],
log: &Arc<TokioMutex<EventLog>>,
) -> ConcurrencyGuard
pub async fn guard( &self, ops: &[AgentOp], log: &Arc<TokioMutex<EventLog>>, ) -> ConcurrencyGuard
Analyze ops, gate the report under this control’s policy, emit the
audit event, and return a ConcurrencyGuard telling the caller what to
do at the commit barrier. Pure aside from the single log append.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ConcurrencyControl
impl RefUnwindSafe for ConcurrencyControl
impl Send for ConcurrencyControl
impl Sync for ConcurrencyControl
impl Unpin for ConcurrencyControl
impl UnsafeUnpin for ConcurrencyControl
impl UnwindSafe for ConcurrencyControl
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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> ⓘ
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