Package com.tnsai.quality.sandbox
Class ContainerSandboxFactory
java.lang.Object
com.tnsai.quality.sandbox.ContainerSandboxFactory
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionSPI default constructor — auto-detects available runtime.ContainerSandboxFactory(String runtime) Test / explicit constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleantrueif this factory's runtime is reachable on the current host (e.g.create(SandboxSpec spec) Create aSandboxfromspec.id()Stable backend identifier ("process","container","wasm","firecracker", …).intpriority()Higher thanprocess(10), lower than a futurefirecracker(100).
-
Constructor Details
-
ContainerSandboxFactory
public ContainerSandboxFactory()SPI default constructor — auto-detects available runtime. -
ContainerSandboxFactory
Test / explicit constructor.
-
-
Method Details
-
id
Description copied from interface:SandboxFactoryStable backend identifier ("process","container","wasm","firecracker", …). Used by callers pinning a specific backend.- Specified by:
idin interfaceSandboxFactory
-
priority
public int priority()Higher thanprocess(10), lower than a futurefirecracker(100).- Specified by:
priorityin interfaceSandboxFactory
-
available
public boolean available()Description copied from interface:SandboxFactorytrueif this factory's runtime is reachable on the current host (e.g.ContainerSandboxFactory.available()returnstruewhendockeris on the PATH). Factories that cannot probe cheaply (slow shell-out, network call) should returntrueand surface the failure atSandboxFactory.create(com.tnsai.quality.sandbox.SandboxSpec)time.- Specified by:
availablein interfaceSandboxFactory
-
create
Description copied from interface:SandboxFactoryCreate aSandboxfromspec. Implementations MUST reject specs they cannot honour (e.g. a backend that doesn't supportNetPolicy.AllowListthrows here rather than silently downgrading) — silent relaxation is the accidental-blast-radius footgun this layer exists to prevent.- Specified by:
createin interfaceSandboxFactory
-