Skip to main content

InMemoryTurnClaims

Struct InMemoryTurnClaims 

Source
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§

Source§

impl InMemoryTurnClaims

Source

pub fn new() -> InMemoryTurnClaims

No claims.

Source

pub fn holds(&self, token: &str) -> bool

Whether token still holds a claim.

Trait Implementations§

Source§

impl Debug for InMemoryTurnClaims

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for InMemoryTurnClaims

Source§

fn default() -> InMemoryTurnClaims

Returns the “default value” for a type. Read more
Source§

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>>

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 more
Source§

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 more
Source§

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 more
Source§

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 + '_>>

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more
Source§

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 more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FutureExt for T

§

fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
§

fn with_current_context(self) -> WithContext<Self> ⓘ

Attaches the current Context to this type, returning a WithContext wrapper. Read more
§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

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].
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more