pub struct EnvelopeRouter;Expand description
Handles routing of envelopes between clients and workers.
Implementations§
Source§impl EnvelopeRouter
impl EnvelopeRouter
Sourcepub async fn route_request(
state: Arc<GatewayState>,
envelope: PeerRpcEnvelope,
timeout: Duration,
) -> PeerRpcResponse
pub async fn route_request( state: Arc<GatewayState>, envelope: PeerRpcEnvelope, timeout: Duration, ) -> PeerRpcResponse
Routes an inbound client request envelope to a worker.
Resolves the target worker, registers a pending request channel, forwards the envelope, and awaits the response from the worker.
Sourcepub fn handle_worker_response(
state: Arc<GatewayState>,
tenant_id: &TenantId,
response: PeerRpcResponse,
) -> GatewayResult<()>
pub fn handle_worker_response( state: Arc<GatewayState>, tenant_id: &TenantId, response: PeerRpcResponse, ) -> GatewayResult<()>
Dispatches a response received from a worker to the waiting client’s task.
Sourcepub fn handle_worker_response_from(
state: Arc<GatewayState>,
tenant_id: &TenantId,
worker: &WorkerConnection,
response: PeerRpcResponse,
) -> GatewayResult<()>
pub fn handle_worker_response_from( state: Arc<GatewayState>, tenant_id: &TenantId, worker: &WorkerConnection, response: PeerRpcResponse, ) -> GatewayResult<()>
Dispatches a response only when it came from the selected worker connection.
Sourcepub async fn route_mesh_request(
state: Arc<GatewayState>,
request: MeshPeerRequest,
timeout: Duration,
) -> MeshPeerResponse
pub async fn route_mesh_request( state: Arc<GatewayState>, request: MeshPeerRequest, timeout: Duration, ) -> MeshPeerResponse
Routes a mesh relay request to the target worker socket.
Sourcepub fn handle_worker_mesh_response(
state: Arc<GatewayState>,
tenant_id: &TenantId,
response: MeshPeerResponse,
) -> GatewayResult<()>
pub fn handle_worker_mesh_response( state: Arc<GatewayState>, tenant_id: &TenantId, response: MeshPeerResponse, ) -> GatewayResult<()>
Dispatches a mesh response received from a worker to the waiting relay task.
Sourcepub fn handle_worker_mesh_response_from(
state: Arc<GatewayState>,
tenant_id: &TenantId,
worker: &WorkerConnection,
response: MeshPeerResponse,
) -> GatewayResult<()>
pub fn handle_worker_mesh_response_from( state: Arc<GatewayState>, tenant_id: &TenantId, worker: &WorkerConnection, response: MeshPeerResponse, ) -> GatewayResult<()>
Dispatches a mesh response only when it came from the selected worker connection.
Auto Trait Implementations§
impl Freeze for EnvelopeRouter
impl RefUnwindSafe for EnvelopeRouter
impl Send for EnvelopeRouter
impl Sync for EnvelopeRouter
impl Unpin for EnvelopeRouter
impl UnsafeUnpin for EnvelopeRouter
impl UnwindSafe for EnvelopeRouter
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
Mutably borrows from an owned value. Read more