pub struct ResponseStore { /* private fields */ }Expand description
Responses this server has run and retained, and the sessions they belong to.
LIMITATION(registre#410): ResponseStore is per-process, so a task run on one
instance cannot be read back from another.
Implementations§
Source§impl ResponseStore
impl ResponseStore
Sourcepub fn put(&self, session_id: &str, response: Response)
pub fn put(&self, session_id: &str, response: Response)
Retain a finished response and record it against its session.
Sourcepub fn session_ids(&self) -> Vec<String>
pub fn session_ids(&self) -> Vec<String>
Every session this server holds.
Sourcepub fn session_turns(&self, session_id: &str) -> Option<Vec<Response>>
pub fn session_turns(&self, session_id: &str) -> Option<Vec<Response>>
The responses making up one session, oldest first.
Sourcepub fn cancel(&self, id: &str) -> bool
pub fn cancel(&self, id: &str) -> bool
Ask a running task to stop.
Returns whether the task was still running. A terminal task is left exactly as it is: a client retrying a cancel after a dropped connection must not be punished for having succeeded the first time, and a terminal status must never change afterwards.
Sourcepub fn is_cancelled(&self, id: &str) -> bool
pub fn is_cancelled(&self, id: &str) -> bool
Whether this task was asked to stop.
Sourcepub fn settle(&self, response: Response)
pub fn settle(&self, response: Response)
Replace a stored response, unless a cancel already settled it.
Cancellation wins: a task that finished after the client asked it to
stop must not report completed, or the cancel silently did nothing.
Sourcepub fn running_in(&self, session_id: &str) -> Vec<String>
pub fn running_in(&self, session_id: &str) -> Vec<String>
The ids of a session’s responses that are still running.
Sourcepub fn delete_session(&self, session_id: &str) -> bool
pub fn delete_session(&self, session_id: &str) -> bool
Forget a session and every response in it.
Returns whether it existed, so the caller can answer session_not_found
rather than reporting a delete that removed nothing.
Sourcepub fn session_of(&self, response_id: &str) -> Option<String>
pub fn session_of(&self, response_id: &str) -> Option<String>
The session a response belongs to.
Trait Implementations§
Source§impl Debug for ResponseStore
impl Debug for ResponseStore
Source§impl Default for ResponseStore
impl Default for ResponseStore
Source§fn default() -> ResponseStore
fn default() -> ResponseStore
Auto Trait Implementations§
impl !Freeze for ResponseStore
impl RefUnwindSafe for ResponseStore
impl Send for ResponseStore
impl Sync for ResponseStore
impl Unpin for ResponseStore
impl UnsafeUnpin for ResponseStore
impl UnwindSafe for ResponseStore
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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