Class LocalTablePathManager

java.lang.Object
com.illumon.iris.db.v2.locations.local.LocalTablePathManager

public class LocalTablePathManager
extends Object
Manage the layout of an on disk database. All decisions about where files and folders are located should be encapsulated here. This is taking ownership of DbTableLocation's role (a dumping ground of parallel ways in which we find data). This should be the main resource for OnDiskDatabase and OnDiskQueryDatabase for pathing decisions. See also LocalTableDataService and LocalTableLocation.
  • Field Details

  • Constructor Details

    • LocalTablePathManager

      public LocalTablePathManager()
      Default constructor, expects the root location to be set in property OnDiskDatabase.rootDirectory.
    • LocalTablePathManager

      public LocalTablePathManager​(@NotNull String dbroot)
      Constructor for an arbitrary root location.
      Parameters:
      dbroot - database root location
      Throws:
      IllegalArgumentException - if the given location is not a valid directory
    • LocalTablePathManager

      public LocalTablePathManager​(@NotNull File dbroot)
      Constructor for an arbitrary root location.
      Parameters:
      dbroot - database root location
      Throws:
      IllegalArgumentException - if the given location is not a valid directory
    • LocalTablePathManager

      public LocalTablePathManager​(@NotNull File dbroot, @NotNull String userNamespacesDirectoryName)
      Constructor for an arbitrary root location.
      Parameters:
      dbroot - database root location
      userNamespacesDirectoryName - name of the user namespace root folder
      Throws:
      IllegalArgumentException - if the given location is not a valid directory
  • Method Details

    • getDefaultInstance

      public static LocalTablePathManager getDefaultInstance()
      Returns:
      The default instance
    • getInstance

      public static LocalTablePathManager getInstance​(@Nullable String dbroot)
      Return a LocalTablePathManager with the specified dbroot. If this is null or matches the default dbroot, return the singleton default as in getDefaultInstance().
      Parameters:
      dbroot - optional database root location
      Returns:
      a LocalTablePathManager with the specified dbroot value.
    • getDefaultDbRoot

      public static File getDefaultDbRoot()
      Get the default database root.
      Returns:
      the value for db root used by default instances.
    • getDbRoot

      public File getDbRoot()
      Get the root for this LocalTablePathManager.
      Returns:
      The directory under which all files will be found.
    • pathFor

      public File pathFor​(TableType tableType)
      Compute the root path for the given tableType.
      Parameters:
      tableType - the type of table we'll be computing paths for
      Returns:
      the root for files for the given table type
    • getLocation

      public File getLocation​(FullTableLocationKey table)
      get the directory that should contain table files for the given table identifier.
      Parameters:
      table - The table identifier for the table.
      Returns:
      The directory that should contain table files for the given table identifier.
    • getTableRoot

      public File getTableRoot​(TableKey tableKey)
      Get the root folder for the given TableKey. This will be above partitioning folders for partitioned tables. TODO: it is likely that the consumer of this result should be using this (LocalTablePathManager) class to compute further locations.
      Parameters:
      tableKey - the TableKey defining the location
      Returns:
      The root of the table specified by tableKey
    • getWritablePartitionsRoot

      public File getWritablePartitionsRoot​(String namespace, TableType tableType)
    • getIntradayRoot

      @Deprecated public File getIntradayRoot()
      Deprecated.
    • getExistingLocations

      public List<FullTableLocationKey> getExistingLocations​(FullTableLocationKey tableLocationKey)
      Gets a collection of all column locations for all existing intraday table files for this FullTableLocationKey, which might be an AggregateTableLocationKey. This will search all internal partition directories for data for this key if it is an aggregate, else the single location will be returned if it exists.
      Returns:
      Collection of existing FullTableLocationKeys for existing intraday table files for this TableLocationKey
    • getMetadataLocation

      public File getMetadataLocation​(TableKey key)
    • getAllExistingTableLocations

      public List<File> getAllExistingTableLocations​(TableKey key)
      Find all existing locations for a table key.
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object