Class ContainerSandboxFactory

java.lang.Object
com.tnsai.quality.sandbox.ContainerSandboxFactory
All Implemented Interfaces:
SandboxFactory

public final class ContainerSandboxFactory extends Object implements SandboxFactory
Container-runtime-backed SandboxFactory (TNS-296). Auto-detects docker or podman on the host PATH; higher priority than ProcessSandboxFactory when available because it provides real network isolation and resource caps.
Since:
0.10.0 (TNS-296)
  • Constructor Details

    • ContainerSandboxFactory

      public ContainerSandboxFactory()
      SPI default constructor — auto-detects available runtime.
    • ContainerSandboxFactory

      public ContainerSandboxFactory(String runtime)
      Test / explicit constructor.
  • Method Details

    • id

      public String id()
      Description copied from interface: SandboxFactory
      Stable backend identifier ("process", "container", "wasm", "firecracker", …). Used by callers pinning a specific backend.
      Specified by:
      id in interface SandboxFactory
    • priority

      public int priority()
      Higher than process (10), lower than a future firecracker (100).
      Specified by:
      priority in interface SandboxFactory
    • available

      public boolean available()
      Description copied from interface: SandboxFactory
      true if this factory's runtime is reachable on the current host (e.g. ContainerSandboxFactory.available() returns true when docker is on the PATH). Factories that cannot probe cheaply (slow shell-out, network call) should return true and surface the failure at SandboxFactory.create(com.tnsai.quality.sandbox.SandboxSpec) time.
      Specified by:
      available in interface SandboxFactory
    • create

      public Sandbox create(SandboxSpec spec)
      Description copied from interface: SandboxFactory
      Create a Sandbox from spec. Implementations MUST reject specs they cannot honour (e.g. a backend that doesn't support NetPolicy.AllowList throws here rather than silently downgrading) — silent relaxation is the accidental-blast-radius footgun this layer exists to prevent.
      Specified by:
      create in interface SandboxFactory