Module DispatchSideCarRequest

Module DispatchSideCarRequest 

Source
Expand description

§DispatchSideCarRequest (Track)

§RESPONSIBILITIES

This module provides the primary dispatcher for requests originating from Cocoon sidecars via gRPC. It routes RPC calls to the correct effect-based implementation.

§Core Functions:

  • Receive gRPC requests from Cocoon sidecars
  • Route requests to the effect creation system
  • Execute effects through the ApplicationRunTime
  • Return results or errors to the sidecar

§ARCHITECTURAL ROLE

DispatchSideCarRequest acts as the sidecar gateway in Track’s dispatch layer:

Cocoon (Sidecar) ──► DispatchSideCarRequest ──► CreateEffectForRequest ──► ApplicationRunTime ──► Providers

§KEY COMPONENTS

  • Fn: Main dispatch function (public async fn Fn<R:Runtime>)

§ERROR HANDLING

  • Effect creation failures are caught and logged
  • Unknown methods are reported with context
  • Errors are propagated to the sidecar with descriptive messages

§LOGGING

  • All incoming sidecar requests are logged at debug level with sidecar ID
  • Effect creation failures are logged at error level
  • Log format: “[Track/SideCarRequest] Dispatching sidecar request from ‘{}’: {}”

§PERFORMANCE CONSIDERATIONS

  • Direct effect execution without intermediate overhead
  • Minimal locking to avoid blocking
  • Async operations for non-blocking dispatch

§TODO

  • Add request timeout handling
  • Implement request cancellation support (VS Code compatibility)
  • Add request metrics and telemetry
  • Add sidecar authentication/authorization

Functions§

DispatchSideCarRequest
The primary dispatcher for requests originating from a Cocoon sidecar via gRPC. This routes RPC calls to the correct effect-based implementation.