Class LocalTableLocation

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

public abstract class LocalTableLocation
extends AbstractTableLocation<TableKey,​LocalColumnLocation>
implements DeephavenFormatTableLocation<LocalColumnLocation>
Base class for local table location implementations.
  • 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<LocalColumnLocation>
      Returns:
      a non-null ordered list of SortPairs
    • hasDataIndexFor

      public boolean hasDataIndexFor​(@NotNull com.illumon.dataobjects.ColumnDefinition<?>... columns)
      Description copied from interface: TableLocation
      Check if this location has a data index for the specified columns.
      Specified by:
      hasDataIndexFor in interface TableLocation<LocalColumnLocation>
      Parameters:
      columns - the set of columns to check for.
      Returns:
      true if the table has a Data Index for the specified columns
    • getDataIndex

      @Nullable public Table getDataIndex​(@NotNull com.illumon.dataobjects.ColumnDefinition<?>... columns)
      Description copied from interface: TableLocation
      Get the data index table for the specified set of columns. Note that the order of columns does not matter here.
      Specified by:
      getDataIndex in interface TableLocation<LocalColumnLocation>
      Parameters:
      columns - the key columns for the index
      Returns:
      the index table or null if one does not exist.
    • getColumnVersion

      public int getColumnVersion()
      Description copied from interface: TableLocation
      Get the column version for this location.
      Specified by:
      getColumnVersion in interface TableLocation<LocalColumnLocation>
      Returns:
      the column version
    • 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
    • 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.
    • setSnapshot

      public void setSnapshot​(@NotNull TableLocationMetadataIndex.TableLocationSnapshot snapshot)