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 Summary
Fields Modifier and Type Field Description static String
DEFAULT_USER_NAMESPACES_DIR_NAME
static String
PARTITION_DIR_NAME
static String
SYSTEM_NAMESPACES_DIR_NAME
-
Constructor Summary
Constructors Constructor Description LocalTablePathManager()
Default constructor, expects the root location to be set in property OnDiskDatabase.rootDirectory.LocalTablePathManager(File dbroot)
Constructor for an arbitrary root location.LocalTablePathManager(File dbroot, String userNamespacesDirectoryName)
Constructor for an arbitrary root location.LocalTablePathManager(String dbroot)
Constructor for an arbitrary root location. -
Method Summary
Modifier and Type Method Description boolean
equals(Object o)
List<File>
getAllExistingTableLocations(TableKey key)
Find all existing locations for a table key.File
getDbRoot()
Get the root for this LocalTablePathManager.static File
getDefaultDbRoot()
Get the default database root.static LocalTablePathManager
getDefaultInstance()
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.static LocalTablePathManager
getInstance(String dbroot)
Return a LocalTablePathManager with the specified dbroot.File
getIntradayRoot()
Deprecated.File
getLocation(FullTableLocationKey table)
get the directory that should contain table files for the given table identifier.File
getMetadataLocation(TableKey key)
File
getTableRoot(TableKey tableKey)
Get the root folder for the given TableKey.File
getWritablePartitionsRoot(String namespace, TableType tableType)
int
hashCode()
File
pathFor(TableType tableType)
Compute the root path for the given tableType.
-
Field Details
-
SYSTEM_NAMESPACES_DIR_NAME
- See Also:
- Constant Field Values
-
DEFAULT_USER_NAMESPACES_DIR_NAME
- See Also:
- Constant Field Values
-
PARTITION_DIR_NAME
- See Also:
- Constant Field Values
-
-
Constructor Details
-
LocalTablePathManager
public LocalTablePathManager()Default constructor, expects the root location to be set in property OnDiskDatabase.rootDirectory. -
LocalTablePathManager
Constructor for an arbitrary root location.- Parameters:
dbroot
- database root location- Throws:
IllegalArgumentException
- if the given location is not a valid directory
-
LocalTablePathManager
Constructor for an arbitrary root location.- Parameters:
dbroot
- database root location- Throws:
IllegalArgumentException
- if the given location is not a valid directory
-
LocalTablePathManager
Constructor for an arbitrary root location.- Parameters:
dbroot
- database root locationuserNamespacesDirectoryName
- name of the user namespace root folder- Throws:
IllegalArgumentException
- if the given location is not a valid directory
-
-
Method Details
-
getDefaultInstance
- Returns:
- The default instance
-
getInstance
Return a LocalTablePathManager with the specified dbroot. If this is null or matches the default dbroot, return the singleton default as ingetDefaultInstance()
.- Parameters:
dbroot
- optional database root location- Returns:
- a LocalTablePathManager with the specified dbroot value.
-
getDefaultDbRoot
Get the default database root.- Returns:
- the value for db root used by default instances.
-
getDbRoot
Get the root for this LocalTablePathManager.- Returns:
- The directory under which all files will be found.
-
pathFor
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
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
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
-
getIntradayRoot
Deprecated. -
getExistingLocations
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
-
getAllExistingTableLocations
Find all existing locations for a table key. -
equals
-
hashCode
public int hashCode()
-