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.