Add DispatchResult::Once|Stream enum and Dispatcher::dispatch() that branches on the registered op_type (ADR-049 §6): Query/Mutation → invoke() (unchanged Once path), Subscription → invoke_streaming() (Stream path). handle_stream matches on DispatchResult: the Once path writes one call.responded/call.error frame (no call.completed); the Stream path pumps each ResponseEnvelope to the wire via pump_stream (ResponseEnvelope.into() → call.responded for Ok, call.error for Err), then writes call.completed on natural stream end. An Err envelope is terminal — last_was_error suppresses call.completed after an error. The streaming branch clears context.deadline to None (subscriptions are unbounded — ADR-049 §6, call-protocol Timeouts). Abort (ADR-016) needs no new code: handle_abort removes the pending entry and dropping the pump task releases handler resources via Drop. dispatch_requested delegates to dispatch for backward compatibility with existing callers.
52 KiB
52 KiB