Class DiskStorage

java.lang.Object
nz.org.riskscape.engine.io.DiskStorage
All Implemented Interfaces:
nz.org.riskscape.engine.io.TupleStorage

public class DiskStorage extends Object implements nz.org.riskscape.engine.io.TupleStorage

TupleStorage backed by a directory on the filesystem.

  • Field Details

    • TUPLES_FILE_FORMAT

      public static final String TUPLES_FILE_FORMAT
      See Also:
    • TUPLES_FILE_PATTERN

      public static final Pattern TUPLES_FILE_PATTERN
  • Constructor Details

    • DiskStorage

      public DiskStorage(Path dataDir)

      Create disk storage that writes files in to the given directory

      Parameters:
      dataDir - directory to store tuples in
    • DiskStorage

      public DiskStorage()

      Create disk storage that writes out the to the JVM's temp dir.

    • DiskStorage

      public DiskStorage(Path dataDir, boolean useCompression, com.codahale.metrics.Counter counter)

      Create disk storage based on a given directory

      Parameters:
      dataDir - directory to store tuples in
      useCompression - if true, all readers and writers from this storage will use gzip compression. This can use less disk at the cost of CPU when reading in and out.
    • DiskStorage

      public DiskStorage(com.codahale.metrics.Counter counter)
    • DiskStorage

      public DiskStorage(Path dataDir, boolean useCompression)
  • Method Details

    • createTemporaryWriter

      public nz.org.riskscape.engine.io.TupleWriter createTemporaryWriter() throws IOException
      Specified by:
      createTemporaryWriter in interface nz.org.riskscape.engine.io.TupleStorage
      Throws:
      IOException
    • getReader

      public DiskStorageReader getReader(DiskStorageWriter writer) throws IOException
      Throws:
      IOException
    • getReader

      public nz.org.riskscape.engine.io.TupleReader getReader(nz.org.riskscape.engine.io.TupleWriter writer) throws IOException
      Specified by:
      getReader in interface nz.org.riskscape.engine.io.TupleStorage
      Throws:
      IOException
    • getDataDir

      public Path getDataDir()