pub struct SidecarTransport { /* private fields */ }Expand description
Owns the spawned sidecar child, the framed BARE stdio I/O tasks, the pending-response map, the event fan-out, and the callback dispatch table.
Implementations§
Source§impl SidecarTransport
impl SidecarTransport
Sourcepub async fn spawn(
binary_path: Option<String>,
) -> Result<Arc<Self>, TransportError>
pub async fn spawn( binary_path: Option<String>, ) -> Result<Arc<Self>, TransportError>
Spawn the native sidecar binary and start the stdio I/O tasks.
Does NOT run the handshake. Product clients drive Authenticate and any follow-up setup using
request_wire once the transport is live.
Sourcepub fn next_request_id(&self) -> RequestId
pub fn next_request_id(&self) -> RequestId
Allocate the next positive host request id.
Sourcepub async fn request_wire(
&self,
ownership: OwnershipScope,
payload: RequestPayload,
) -> Result<ResponsePayload, TransportError>
pub async fn request_wire( &self, ownership: OwnershipScope, payload: RequestPayload, ) -> Result<ResponsePayload, TransportError>
Issue a host request using generated wire protocol types and await a generated response.
Sourcepub async fn request_wire_bounded(
&self,
ownership: OwnershipScope,
payload: RequestPayload,
max_frame_bytes: usize,
) -> Result<ResponsePayload, TransportError>
pub async fn request_wire_bounded( &self, ownership: OwnershipScope, payload: RequestPayload, max_frame_bytes: usize, ) -> Result<ResponsePayload, TransportError>
Issue a host request using generated wire protocol types with a caller-specific frame limit.
Sourcepub fn subscribe_wire_events(&self) -> Receiver<(OwnershipScope, EventPayload)>
pub fn subscribe_wire_events(&self) -> Receiver<(OwnershipScope, EventPayload)>
Subscribe to structured/lifecycle/process events using generated wire protocol types.
Sourcepub fn register_wire_callback(
&self,
key: &'static str,
callback: WireSidecarCallback,
)
pub fn register_wire_callback( &self, key: &'static str, callback: WireSidecarCallback, )
Register a callback that answers a class of sidecar-initiated requests using generated wire protocol types.
Sourcepub fn max_frame_bytes(&self) -> usize
pub fn max_frame_bytes(&self) -> usize
Return the currently negotiated max frame size.
Sourcepub fn set_max_frame_bytes(&self, max_frame_bytes: usize)
pub fn set_max_frame_bytes(&self, max_frame_bytes: usize)
Update the negotiated max frame size after authentication.
Sourcepub fn kill_child(&self)
pub fn kill_child(&self)
Kill the child sidecar process if this transport still owns one.