Class LocalTableLocation

All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, DeephavenFormatTableLocation, TableLocation, TableLocationKey, TableLocationState, NamedImplementation
Direct Known Subclasses:
ReadOnlyLocalTableLocation, WritableLocalTableLocation

public abstract class LocalTableLocation extends AbstractTableLocation<TableKey,LocalColumnLocation> implements DeephavenFormatTableLocation
Base class for local table location implementations.
  • Field Details

    • CHECKPOINT_RECORD_FILE_NAME

      public static final String CHECKPOINT_RECORD_FILE_NAME
  • Method Details

    • getDirectory

      public File getDirectory()
    • getSortedColumns

      @NotNull public List<SortPair> getSortedColumns()
      Description copied from interface: TableLocation
      Get an ordered list of columns this location is sorted by.
      Specified by:
      getSortedColumns in interface TableLocation
      Returns:
      a non-null ordered list of SortPairs
    • hasDataIndexFor

      public boolean hasDataIndexFor(@NotNull String... columns)
      Description copied from interface: TableLocation
      Check if this location has a data index for the specified columns.
      Specified by:
      hasDataIndexFor in interface TableLocation
      Parameters:
      columns - the set of columns to check for.
      Returns:
      true if the table has a Data Index for the specified columns
    • getDataIndexImpl

      protected Table getDataIndexImpl(@NotNull String... columns)
      Description copied from class: AbstractTableLocation
      Load the data index from the location implementaiton. Implementations of this method should not perform any result caching.
      Specified by:
      getDataIndexImpl in class AbstractTableLocation<TableKey,LocalColumnLocation>
      Parameters:
      columns - the columns to load an index for.
      Returns:
      the data index table, or an empty table or null if none existed.
    • getColumnVersion

      public int getColumnVersion()
      Description copied from interface: DeephavenFormatTableLocation
      Get the column version for this location.
      Specified by:
      getColumnVersion in interface DeephavenFormatTableLocation
      Returns:
      the column version
    • setSnapshot

      public void setSnapshot(@NotNull TableLocationMetadataIndex.TableLocationSnapshot snapshot)
      Set the location snapshot data from the metadata index.
      Parameters:
      snapshot - the metadata index for this location.
    • getTableDefinition

      public TableDefinition getTableDefinition()
      Get the TableDefinition for the data written at this location.
      Returns:
      the TableDefinition for this location
    • makeColumnLocation

      @NotNull protected LocalColumnLocation makeColumnLocation(@NotNull String name)
      Specified by:
      makeColumnLocation in class AbstractTableLocation<TableKey,LocalColumnLocation>
    • ensureReaderCheckpointInitialized

      public void ensureReaderCheckpointInitialized()

      Ensure that the checkpoint record for this location has been read sufficiently to allow access to metadata, such as sorted columns, version, and column version.

    • getCheckpointRecordFile

      public File getCheckpointRecordFile()
      Get the checkpoint record file.
      Returns:
      The checkpoint record file
    • getReaderCheckpointRecord

      public CheckpointRecord getReaderCheckpointRecord()
      Access the checkpoint record in use by readers of this location. This is for advanced use only.
      Returns:
      The checkpoint record used for reading data from this location
    • getCheckpointRecordFile

      @InternalUseOnly public static File getCheckpointRecordFile(@NotNull File directory)
      Compute the checkpoint record file for the supplied directory.
      Parameters:
      directory - The directory
      Returns:
      The checkpoint record file
    • readCheckpointRecordForImporters

      public CheckpointRecord readCheckpointRecordForImporters()
      Read the supplied directory's entire checkpoint record file into a newly-allocated checkpoint record. If the file cannot be found, an empty record will be returned. This is intended for use by import, merge, and validation code, or other miscellaneous data-related jobs.
      Returns:
      The newly-allocated checkpoint record
    • readCheckpointRecordForImporters

      public static CheckpointRecord readCheckpointRecordForImporters(@NotNull File directory)
      Read the supplied directory's entire checkpoint record file into a newly-allocated checkpoint record. If the file cannot be found, an empty record will be returned. This is intended for use by import, merge, and validation code.
      Parameters:
      directory - The directory
      Returns:
      The newly-allocated checkpoint record
    • readCheckpointRecordForImporters

      public static CheckpointRecord readCheckpointRecordForImporters(@NotNull File directory, boolean requireFileToExist)
      Read the supplied directory's entire checkpoint record file into a newly-allocated checkpoint record. If the file cannot be found, an empty record will be returned (unless requireFileToExist is true). This is intended for use by import, merge, and validation code.
      Parameters:
      directory - The directory
      requireFileToExist - if true, throw a TableDataException if the checkpoint file does not exist
      Returns:
      The newly-allocated checkpoint record
      Throws:
      TableDataException - if requireFileToExist is true and the checkpoint file does not exist
    • readCheckpointRecordForImportersFromFile

      @NotNull public static CheckpointRecord readCheckpointRecordForImportersFromFile(@NotNull File file)
      Read the entire supplied checkpoint record file into a newly-allocated checkpoint record. If the file cannot be found, an empty record will be returned. This is intended for use by import, merge, and validation code.
      Parameters:
      file - The file
      Returns:
      The newly-allocated checkpoint record
    • readCheckpointRecordForImportersFromFile

      @NotNull public static CheckpointRecord readCheckpointRecordForImportersFromFile(@NotNull File file, boolean requireFileToExist)
      Read the entire supplied checkpoint record file into a newly-allocated checkpoint record. If the file cannot be found, an empty record will be returned (unless requireFileToExist is true). This is intended for use by import, merge, and validation code.
      Parameters:
      file - The file
      requireFileToExist - if true, throw a TableDataException if the checkpoint file does not exist
      Returns:
      The newly-allocated checkpoint record
      Throws:
      TableDataException - if requireFileToExist is true and the checkpoint file does not exist
    • readCheckpointRecordForSerialConsumers

      public static void readCheckpointRecordForSerialConsumers(@NotNull File checkpointRecordFile, @NotNull CheckpointRecord checkpointRecord) throws IOException
      Read the serial consumer fields of the specified checkpoint record file into the supplied checkpoint record. Note that the record is cleared before read. If the file no longer exists, the record will remain cleared.
      Parameters:
      checkpointRecordFile - The file to read
      checkpointRecord - The record to fill
      Throws:
      IOException
    • writeCheckpointRecord

      public static void writeCheckpointRecord(@NotNull CheckpointRecord checkpointRecord, @NotNull File directory)
      Write the supplied checkpoint record to the destination directory's checkpoint record file.
      Parameters:
      checkpointRecord - The checkpoint record to read from
      directory - The directory
    • refreshReaderCheckpointRecord

      public void refreshReaderCheckpointRecord()
      Read the serial consumer fields from the checkpoint record file into the internal reader checkpoint record. Note that the record is cleared before read. If the file no longer exists, the record will remain cleared.