pub struct StreamInvocation<B: StreamBridge> { /* private fields */ }Expand description
Caller-owned invocation and progress. Cancellation retains pending state writes/events; a started upstream send is never implicitly repeated.
Implementations§
Source§impl<B: StreamBridge> StreamInvocation<B>
impl<B: StreamBridge> StreamInvocation<B>
pub fn original_request(&self) -> &B::ClientRequest
pub fn target_request(&self) -> &B::NativeRequest
pub fn send_started(&self) -> bool
pub fn report(&self) -> &Report
pub fn native_metadata(&self) -> Option<&WireResponse<()>>
pub fn last_native_event(&self) -> Option<&B::NativeEvent>
pub fn native_result( &self, ) -> Option<&<<B as StreamBridge>::NativeEvent as NativeEvent>::Full>
pub fn client_result( &self, ) -> Option<&<<B as StreamBridge>::ClientEvent as NativeEvent>::Full>
pub fn rejected_response(&self) -> Option<&WireResponse<Bytes>>
pub async fn start<U: Upstream, S: StateStore>( &mut self, upstream: &U, target: &U::Target, state: &GenerationStateAccess<'_, S>, ) -> Result<StreamStart, TransformError>
Source§impl<B: StreamBridge> StreamInvocation<B>
impl<B: StreamBridge> StreamInvocation<B>
Sourcepub async fn collect<S: StateStore>(
&mut self,
state: &GenerationStateAccess<'_, S>,
) -> Result<GenerationOutcome<<<B as StreamBridge>::ClientEvent as NativeEvent>::Full>, TransformError>
pub async fn collect<S: StateStore>( &mut self, state: &GenerationStateAccess<'_, S>, ) -> Result<GenerationOutcome<<<B as StreamBridge>::ClientEvent as NativeEvent>::Full>, TransformError>
Collect the mapped stream into its concrete complete client wire response.
The host calls start once first. This does not perform another POST.
Sourcepub async fn next<S: StateStore>(
&mut self,
state: &GenerationStateAccess<'_, S>,
) -> Result<Option<StreamChunk<B::ClientEvent>>, TransformError>
pub async fn next<S: StateStore>( &mut self, state: &GenerationStateAccess<'_, S>, ) -> Result<Option<StreamChunk<B::ClientEvent>>, TransformError>
Returns the next encoded client event. No alias is persisted before it is yielded: an emitted ID is either the upstream’s own or a per-request alias, and the only state writes happen once, at the end of the stream. Cancellation retains a prepared event.
Source§impl StreamInvocation<GeminiToResponsesStream>
impl StreamInvocation<GeminiToResponsesStream>
pub async fn next_with_image_resources<S, R>(
&mut self,
state: &GenerationStateAccess<'_, S>,
resources: &GenerationResources<'_, R>,
progress: &mut ImageStreamProgress<R::PublishedHandle>,
) -> Result<Option<StreamChunk<StreamEvent>>, TransformError>where
R: ResourceAccess + ResourceSync,
R::Scope: ResourceSync,
R::PublishedHandle: ResourceSend,
S: StateStore + ResourceSync,
S::Scope: ResourceSync,
Source§impl StreamInvocation<ResponsesToGeminiStream>
impl StreamInvocation<ResponsesToGeminiStream>
pub async fn next_with_image_resources<S, R>(
&mut self,
state: &GenerationStateAccess<'_, S>,
resources: &GenerationResources<'_, R>,
progress: &mut ImageStreamProgress<R::PublishedHandle>,
) -> Result<Option<StreamChunk<GenerateContentResponseBody>>, TransformError>where
R: ResourceAccess + ResourceSync,
R::Scope: ResourceSync,
R::PublishedHandle: ResourceSend,
S: StateStore + ResourceSync,
S::Scope: ResourceSync,
Source§impl<B: StreamBridge<NativeEvent = StreamEvent, NativeRequest = GenerateContentRequestBody>> StreamInvocation<B>
impl<B: StreamBridge<NativeEvent = StreamEvent, NativeRequest = GenerateContentRequestBody>> StreamInvocation<B>
Sourcepub async fn start_websocket<'a, S: StateStore>(
&'a mut self,
session: &'a mut GenerationWsSession,
state: &GenerationStateAccess<'_, S>,
) -> Result<GenerationWsTurn<'a, B>, TransformError>
pub async fn start_websocket<'a, S: StateStore>( &'a mut self, session: &'a mut GenerationWsSession, state: &GenerationStateAccess<'_, S>, ) -> Result<GenerationWsTurn<'a, B>, TransformError>
Sends response.create at most once. The invocation and the connection must both have been prepared against this state.
pub async fn start_websocket_on_lane<'a, S: StateStore>( &'a mut self, session: &'a mut GenerationWsSession, lane: Option<String>, state: &GenerationStateAccess<'_, S>, ) -> Result<GenerationWsTurn<'a, B>, TransformError>
Source§impl<B: StreamBridge<ClientEvent = StreamEvent>> StreamInvocation<B>
impl<B: StreamBridge<ClientEvent = StreamEvent>> StreamInvocation<B>
Sourcepub fn responses_websocket_output(&mut self) -> Result<(), TransformError>
pub fn responses_websocket_output(&mut self) -> Result<(), TransformError>
Select bare, individually bounded JSON server messages before HTTP start. Each returned nonempty chunk is exactly one WebSocket Text payload.