Skip to content

routing

Structs

  • AutostartFlags - Inputs to [prepare_network_runtime] that gate autostart behaviour.
  • NetworkRuntime - Runtime-side network artifacts that must live while the wrapped process runs.
  • ResolvedAuthority - Resolved Authority for the current run. URL is what gets fed into the

Functions


Struct

Inputs to [prepare_network_runtime] that gate autostart behaviour.

Fields:

  • sidecar_autostart: bool - true when the selection resolved to local autostart.
  • no_autostart: bool
  • template_path: Option<std::path::PathBuf>
  • startup_timeout: std::time::Duration
  • authority_url: Option<String> - Effective Authority URL — set by resolve_authority and threaded
  • use_http_proxy_sidecar: bool - When true, the autostarted sidecar is started in HTTP proxy

Trait Implementations:

  • Debug
    • fn fmt(self: &Self, f: & mut $crate::fmt::Formatter) -> $crate::fmt::Result
  • Clone
    • fn clone(self: &Self) -> AutostartFlags

Struct

Runtime-side network artifacts that must live while the wrapped process runs.

Methods:

  • fn env_overrides(self: &Self) -> &BTreeMap<String, String> - Returns environment values to merge into wrapped process launch env.
  • fn sidecar_endpoint(self: &Self) -> &SidecarEndpoint - Endpoint the wrapped process should reach the sidecar through.

Struct

Resolved Authority for the current run. URL is what gets fed into the sidecar’s [authority].url; supervisor is held inside NetworkRuntime for kill-on-Drop.

Fields:

  • url: String
  • supervisor: Option<crate::authority::AuthoritySupervisor>

firma_run::routing::prepare_network_runtime

Section titled “firma_run::routing::prepare_network_runtime”

Function

Prepare network runtime artifacts for a sandbox launch.

When flags.sidecar_autostart == true (local selection), autostarts a per-run sidecar via [SidecarSupervisor] and substitutes its endpoint into the returned [NetworkRuntime]. The supervisor is held inside the returned struct so [Drop] tears the sidecar down when the wrapped process exits.

  • [RunError::SidecarUnreachable] when the endpoint is unreachable and autostart is disabled.
  • [RunError::SidecarReadyTimeout] / [RunError::SidecarStartupFailed] when the autostarted sidecar fails to come up.
  • [RunError::UnsupportedPlatform] when autostart is required on a platform that does not support it.
  • [RunError::Backend] for adapter socket failures.
fn prepare_network_runtime(handle: &crate::backend::SandboxHandle, sidecar_endpoint: &crate::config::SidecarEndpoint, identity: &crate::identity::RunIdentity, flags: &AutostartFlags, authority: ResolvedAuthority) -> Result<NetworkRuntime, crate::error::RunError>

Function

Step 0: resolve the Authority before any sidecar work.

CLI > persisted > prompt (only when both empty and TTY). On Local selection, probe [::1]:50051; on miss, spawn an AuthoritySupervisor. Local mode is a dev convenience path and intentionally uses plaintext loopback (http://), not TLS/mTLS. EADDRINUSE recovery: on any spawn error, re-probe once; if the port is now reachable, drop the (failed) supervisor handle and proceed without one.

Propagates any RunError raised by selection or spawn paths.

fn resolve_authority(identity: &crate::identity::RunIdentity, runtime_dir: &std::path::Path, flags: &AutostartFlags, cli: &crate::authority::AuthorityCli, profile_name: &str, user_config_path: &std::path::Path, firma_exe: &std::path::Path, prompt: & mut dyn crate::authority::AuthorityPromptIo) -> Result<ResolvedAuthority, crate::error::RunError>