Record Class FsMount

java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.FsMount
Record Components:
hostPath - source path on the host
sandboxPath - target path inside the sandbox
readOnly - true = sandbox cannot mutate the host files; false = sandbox writes propagate back to the host

public record FsMount(Path hostPath, Path sandboxPath, boolean readOnly) extends Record
Filesystem mount point for a sandbox (TNS-296). Maps a host path into the sandbox's filesystem at sandboxPath.

readOnly defaults to true on the mount factory methods because read-only is the safer default — code running in the sandbox must not be able to corrupt the host filesystem unless the caller explicitly says otherwise.

Since:
0.10.0 (TNS-296)
  • Constructor Summary

    Constructors
    Constructor
    Description
    FsMount(Path hostPath, Path sandboxPath, boolean readOnly)
    Creates an instance of a FsMount record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the hostPath record component.
    boolean
    Returns the value of the readOnly record component.
    static FsMount
    readOnly(Path hostPath, Path sandboxPath)
    Read-only mount — the safer default.
    static FsMount
    readWrite(Path hostPath, Path sandboxPath)
    Read-write mount — sandbox writes propagate back to the host.
    Returns the value of the sandboxPath record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • FsMount

      public FsMount(Path hostPath, Path sandboxPath, boolean readOnly)
      Creates an instance of a FsMount record class.
      Parameters:
      hostPath - the value for the hostPath record component
      sandboxPath - the value for the sandboxPath record component
      readOnly - the value for the readOnly record component
  • Method Details

    • readOnly

      public static FsMount readOnly(Path hostPath, Path sandboxPath)
      Read-only mount — the safer default.
    • readWrite

      public static FsMount readWrite(Path hostPath, Path sandboxPath)
      Read-write mount — sandbox writes propagate back to the host.
    • 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.
    • hostPath

      public Path hostPath()
      Returns the value of the hostPath record component.
      Returns:
      the value of the hostPath record component
    • sandboxPath

      public Path sandboxPath()
      Returns the value of the sandboxPath record component.
      Returns:
      the value of the sandboxPath record component
    • readOnly

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