Record Class SandboxSpec

java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.SandboxSpec
Record Components:
image - backend-specific image / runtime identifier ("python:3.12-slim", "node:20", "wasm:pyodide", or empty for ProcessSandbox which uses the host's interpreter)
env - environment variables to set inside the sandbox; the framework SCRUBS the host environment by default — only what's listed here is visible to sandboxed code
fsMounts - host paths exposed inside the sandbox
networkPolicy - network access policy
resourceLimits - per-sandbox resource caps
workingDir - working directory inside the sandbox; empty = backend default (/tmp/sandbox on most backends)
warmable - hint that a SandboxPool may keep this sandbox alive between executions to skip cold-start cost

public record SandboxSpec(String image, Map<String,String> env, List<FsMount> fsMounts, NetPolicy networkPolicy, ResourceLimits resourceLimits, Optional<String> workingDir, boolean warmable) extends Record
Declarative specification of a sandbox instance (TNS-296). Backends accept this record as their configuration source; consumers build it once and reuse it across Sandbox.execute(com.tnsai.quality.sandbox.Command) calls.
Since:
0.10.0 (TNS-296)
  • Constructor Details

    • SandboxSpec

      public SandboxSpec(String image, Map<String,String> env, List<FsMount> fsMounts, NetPolicy networkPolicy, ResourceLimits resourceLimits, Optional<String> workingDir, boolean warmable)
      Creates an instance of a SandboxSpec record class.
      Parameters:
      image - the value for the image record component
      env - the value for the env record component
      fsMounts - the value for the fsMounts record component
      networkPolicy - the value for the networkPolicy record component
      resourceLimits - the value for the resourceLimits record component
      workingDir - the value for the workingDir record component
      warmable - the value for the warmable record component
  • Method Details

    • builder

      public static SandboxSpec.Builder builder()
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • image

      public String image()
      Returns the value of the image record component.
      Returns:
      the value of the image record component
    • env

      public Map<String,String> env()
      Returns the value of the env record component.
      Returns:
      the value of the env record component
    • fsMounts

      public List<FsMount> fsMounts()
      Returns the value of the fsMounts record component.
      Returns:
      the value of the fsMounts record component
    • networkPolicy

      public NetPolicy networkPolicy()
      Returns the value of the networkPolicy record component.
      Returns:
      the value of the networkPolicy record component
    • resourceLimits

      public ResourceLimits resourceLimits()
      Returns the value of the resourceLimits record component.
      Returns:
      the value of the resourceLimits record component
    • workingDir

      public Optional<String> workingDir()
      Returns the value of the workingDir record component.
      Returns:
      the value of the workingDir record component
    • warmable

      public boolean warmable()
      Returns the value of the warmable record component.
      Returns:
      the value of the warmable record component