pub struct InMemoryTurnClaims { /* private fields */ }Expand description
Claims in process memory, for tests that run several handlers over one in-memory store. Expiry is measured on this process’s monotonic clock.
Steering messages handed to a claim (TurnClaimStore::hand_steering)
are kept here too, in process memory: this store is only as shared as the
handlers holding it, which is why it is for tests and not for replicas.
Implementations§
Trait Implementations§
Source§impl Debug for InMemoryTurnClaims
impl Debug for InMemoryTurnClaims
Source§impl Default for InMemoryTurnClaims
impl Default for InMemoryTurnClaims
Source§fn default() -> InMemoryTurnClaims
fn default() -> InMemoryTurnClaims
Returns the “default value” for a type. Read more
Source§impl TurnClaimStore for InMemoryTurnClaims
impl TurnClaimStore for InMemoryTurnClaims
Source§fn claim<'a>(
&'a self,
scope: &'a str,
task_id: &'a str,
owner: &'a str,
token: &'a str,
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
fn claim<'a>( &'a self, scope: &'a str, task_id: &'a str, owner: &'a str, token: &'a str, ttl: Duration, ) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
Claims the task for one turn: inserts the claim, or takes over one
whose time to live has passed.
true when this call holds it now,
false when a live claim is held by any turn, this owner’s included.
A store that may run the claim a second time for one call, as the
PostgreSQL store does when the first run lost its connection, answers
true when the claim already carries token: that claim is this
call’s, taken by the run whose answer was lost. Read moreSource§fn release<'a>(
&'a self,
token: &'a str,
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn release<'a>( &'a self, token: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Deletes the claim
token names, if it still holds one. A claim taken
over since is not touched. Read moreSource§fn renew<'a>(
&'a self,
owner: &'a str,
tokens: &'a [String],
ttl: Duration,
) -> Pin<Box<dyn Future<Output = Result<Vec<HeldClaim>, A2aError>> + Send + 'a>>
fn renew<'a>( &'a self, owner: &'a str, tokens: &'a [String], ttl: Duration, ) -> Pin<Box<dyn Future<Output = Result<Vec<HeldClaim>, A2aError>> + Send + 'a>>
Extends the claims among
tokens that owner still holds to ttl
from now, and reports each one. A token missing from the answer was
taken over or released. Read moreSource§fn request_cancel<'a>(
&'a self,
scope: &'a str,
task_id: &'a str,
) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
fn request_cancel<'a>( &'a self, scope: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<bool, A2aError>> + Send + 'a>>
Marks the live claim on the task, if there is one, so its owner
cancels the turn at its next renewal. Whether a claim was marked. Read more
Source§fn sweep(
&self,
older_than: Duration,
) -> Pin<Box<dyn Future<Output = Result<u64, A2aError>> + Send + '_>>
fn sweep( &self, older_than: Duration, ) -> Pin<Box<dyn Future<Output = Result<u64, A2aError>> + Send + '_>>
Deletes claims that expired more than
older_than ago: left by a
replica that died and never continued. Bounded housekeeping, run by
the renewer now and then; a claim that expired is already free to
take, so this changes no decision. Read moreSource§fn hand_steering<'a>(
&'a self,
scope: &'a str,
task_id: &'a str,
message: &'a str,
capacity: usize,
) -> Pin<Box<dyn Future<Output = Result<Handed, A2aError>> + Send + 'a>>
fn hand_steering<'a>( &'a self, scope: &'a str, task_id: &'a str, message: &'a str, capacity: usize, ) -> Pin<Box<dyn Future<Output = Result<Handed, A2aError>> + Send + 'a>>
Stores a steering message (ADR 0036) for the replica that holds the
live claim on the task, unless that claim’s queue already holds
capacity messages. One atomic step: the claim is checked and the
message stored together, so a message is never stored for a claim that
was released first. message is the JSON the holder reads back from
peek_steering; the store does not read it. Read moreSource§fn peek_steering<'a>(
&'a self,
owner: &'a str,
tokens: &'a [String],
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<PendingSteering>, A2aError>> + Send + 'a>>
fn peek_steering<'a>( &'a self, owner: &'a str, tokens: &'a [String], limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<PendingSteering>, A2aError>> + Send + 'a>>
The steering messages stored for the live claims among
tokens that
owner holds, oldest first, at most limit. Reads only: a message
stays until ack_steering names it, so one that
does not fit its turn’s inbox now is offered again at the next look. Read moreSource§fn ack_steering<'a>(
&'a self,
seqs: &'a [i64],
) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
fn ack_steering<'a>( &'a self, seqs: &'a [i64], ) -> Pin<Box<dyn Future<Output = Result<(), A2aError>> + Send + 'a>>
Deletes the steering messages
seqs names, once they are in their
turns’ inboxes. Names that are already gone are ignored. Read moreSource§fn abandoned(
&self,
quiet: Duration,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
fn abandoned( &self, quiet: Duration, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
Tasks a turn left running and nobody runs:
submitted or working,
no live claim on them, and not written for quiet. At most limit,
as (scope, task_id), the oldest first. What the handler’s reaper
ends (handler::claims::reaper): a replica that died mid-turn, or
stopped its executor past the grace, left them so, and until
2026-10-29 nothing finished them (audit E-F1, run live). Read moreSource§fn abandoned_except_handed_off(
&self,
quiet: Duration,
hand_off_window: Duration,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
fn abandoned_except_handed_off( &self, quiet: Duration, hand_off_window: Duration, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
abandoned, leaving out a task handed back to its
caller less than hand_off_window ago (ADR 0054). The reaper calls
this, with HandlerLimits::hand_off_window. The default ignores the
window and asks abandoned, so a claim store of your own keeps
working; the SQL stores bind it, and their abandoned uses
HAND_OFF_WINDOW. Read moreSource§fn ended_unreleased(
&self,
quiet: Duration,
limit: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
fn ended_unreleased( &self, quiet: Duration, limit: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, String)>, A2aError>> + Send + '_>>
Tasks that are finished whose claim is still there and expired for
at least
quiet: a turn that did not end the way a turn ends. Read moreSource§fn steering_signals(&self) -> Option<Receiver<()>>
fn steering_signals(&self) -> Option<Receiver<()>>
A signal that
hand_steering stored a message,
from whichever replica, for the handler to look at once rather than at
its next poll; None when the store sends none. Read moreAuto Trait Implementations§
impl !Freeze for InMemoryTurnClaims
impl Forget for InMemoryTurnClaims
impl Move for InMemoryTurnClaims
impl RefUnwindSafe for InMemoryTurnClaims
impl Send for InMemoryTurnClaims
impl Sync for InMemoryTurnClaims
impl Unpin for InMemoryTurnClaims
impl UnsafeUnpin for InMemoryTurnClaims
impl UnwindSafe for InMemoryTurnClaims
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].