pub struct ResponseHandler { /* private fields */ }Expand description
Handles all response store operations: lookup, rehydration, and persistence.
Implementations§
Source§impl ResponseHandler
impl ResponseHandler
pub fn new(store: ResponseStore) -> Self
Sourcepub async fn get(&self, ctx: &RequestContext) -> ExecutorResult<ResponseData>
pub async fn get(&self, ctx: &RequestContext) -> ExecutorResult<ResponseData>
Retrieves the stored response for previous_response_id.
Reads previous_response_id from ctx.original_request.
§Errors
Returns ExecutorError if previous_response_id is absent, the response
is not found, the store is disabled, or the database query fails.
Sourcepub async fn validate_exists(&self, ctx: &RequestContext) -> ExecutorResult<()>
pub async fn validate_exists(&self, ctx: &RequestContext) -> ExecutorResult<()>
Validates that the response for previous_response_id exists.
Used in the store=false path where we only need to confirm the ID is
valid without loading any history.
§Errors
Returns ExecutorError if previous_response_id is absent, the response
is not found, or the store is disabled.
Sourcepub async fn rehydrate(
&self,
ctx: &RequestContext,
) -> ExecutorResult<Vec<InOutItem>>
pub async fn rehydrate( &self, ctx: &RequestContext, ) -> ExecutorResult<Vec<InOutItem>>
Loads all history items referenced by the previous response.
Reads previous_response_id from ctx.original_request. Returns an empty
vec if there is no previous response.
§Errors
Returns ExecutorError if the store is disabled or the database query fails.
Sourcepub async fn execute_turn(
&self,
ctx: RequestContext,
output_items: Vec<OutputItem>,
) -> ExecutorResult<()>
pub async fn execute_turn( &self, ctx: RequestContext, output_items: Vec<OutputItem>, ) -> ExecutorResult<()>
Persists a response record — only the new items from this turn.
Takes ctx and output_items by value so fields can be moved directly
into ResponseMetadata without cloning. Prior history must not be
re-inserted; the response store records item IDs for this response only.
§Errors
Returns ExecutorError if the store is disabled or the database operation fails.
Trait Implementations§
Source§impl Clone for ResponseHandler
impl Clone for ResponseHandler
Source§fn clone(&self) -> ResponseHandler
fn clone(&self) -> ResponseHandler
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ResponseHandler
impl !UnwindSafe for ResponseHandler
impl Freeze for ResponseHandler
impl Send for ResponseHandler
impl Sync for ResponseHandler
impl Unpin for ResponseHandler
impl UnsafeUnpin for ResponseHandler
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,
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