Package com.illumon.iris.db.v2.locations
Interface TableLocation<CLT extends ColumnLocation>
- All Superinterfaces:
com.fishlib.base.log.LogOutputAppendable
,NamedImplementation
,TableLocationKey
,TableLocationState
- All Known Subinterfaces:
DeephavenFormatTableLocation<CLT>
,IWritableLocalTableLocation
,ParquetFormatTableLocation<CLT>
- All Known Implementing Classes:
AbstractTableLocation
,DeferredTableLocation
,DeferredTableLocation.DataDriven
,DeferredTableLocation.SnapshotDriven
,LocalTableLocation
,ReadOnlyLocalTableLocation
,ReadOnlyParquetTableLocation
,WritableLocalTableLocation
public interface TableLocation<CLT extends ColumnLocation> extends TableLocationKey, TableLocationState
=====================================================================================================================
Building block for Iris DB file-based tables, with helper methods for discovering locations and their sizes.
================================================= INTERFACE =========================================================
A location specifies the column and size data location for a splayed table. The location may be either:
(1) the sole location of a stand-alone splayed table, or
(2) a single location of a nested partitioned table, in which case it belongs to an internal partition and a column partition.
================================================== LAYOUTS ==========================================================
There are exactly two layouts in use for file-based tables:
---------------------------------------------------------------------------------------------------------------------
Splayed: (stand-alone)
---------------------------------------------------------------------------------------------------------------------
Such tables have exactly one location.
The layout looks like:
L0 ROOT (e.g. /db/<namespace type>/<namespace name>/Tables)
L1 <table name>
L2 COLUMN FILES [<column name>.[dat, ovr, bytes, sym, sym.bytes]], SIZE FILE [table.size]
---------------------------------------------------------------------------------------------------------------------
Nested Partitioned:
---------------------------------------------------------------------------------------------------------------------
Such tables are horizontally partitioned at two levels:
- The first ("internal") partitioning divides data into manageable fragments or distinct streams.
- The second ("column") partitioning specifies a String column (named by the table's definition, by convention nearly-always "Date").
The locations in use by such a table are identical to those used by a splayed table, except that they are contained within a column partition, which is in turn contained within an internal partition.
The layout looks like:
L0 ROOT (e.g. /db/<namespace type>/<namespace name>/Partitions)
L1 "Internal" Partitions (e.g. "0", "1", ...)
L2 "Column" Partitions (e.g. "2011-10-13", "2011-10-14", ...)
L3 <table name>
L4 COLUMN FILES [<column name>.[dat, ovr, bytes, sym, sym.bytes]], METADATA FILE [table.size]
================================================== COMMENTS =========================================================
Future work may allow more fields from TableLocationKey or TableLocationState to be accessed as columns.
=====================================================================================================================
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
TableLocation.Format
Enumeration of possible table location formats.static interface
TableLocation.Listener
Listener interface for anything that wants to know about changes to a location.Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
TableLocationKey.ComparatorImpl, TableLocationKey.KeyedObjectKeyImpl<VALUE_TYPE>, TableLocationKey.SelfKeyedObjectKeyImpl<VALUE_TYPE extends TableLocationKey>
-
Field Summary
Fields inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
COMPARATOR, NULL_PARTITION
Fields inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
NULL_SIZE, NULL_TIME, REMOVE_SIZE
-
Method Summary
Modifier and Type Method Description default com.fishlib.base.log.LogOutput
append(com.fishlib.base.log.LogOutput logOutput)
CLT
getColumnLocation(CharSequence name)
int
getColumnVersion()
Get the column version for this location.Table
getDataIndex(com.illumon.dataobjects.ColumnDefinition<?>... columns)
Get the data index table for the specified set of columns.TableLocation.Format
getFormat()
Get the format that was used to persist this table location.List<SortPair>
getSortedColumns()
Get an ordered list of columns this location is sorted by.TableKey
getTableKey()
long
getVisit()
return the last value set invisit(long)
boolean
hasDataIndexFor(com.illumon.dataobjects.ColumnDefinition<?>... columns)
Check if this location has a data index for the specified columns.void
refresh()
Initialize or refresh state information.void
subscribe(TableLocation.Listener listener)
Subscribe to pushed location updates.boolean
supportsSubscriptions()
Does this location support subscriptions? That is, can this location ever have ticking data?default String
toGenericString()
Format the table key without implementation specific bits.default String
toStringDetailed()
Optional toString path with more implementation detail.default String
toStringHelper()
void
unsubscribe(TableLocation.Listener listener)
Unsubscribe from pushed location updates.TableLocation<CLT>
visit(long stamp)
Mark this table location as visited, with the given (time)stamp.Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
getColumnPartition, getInternalPartition, writeTo
Methods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getLastModifiedTimeMillis, getSize, getSizeStr, getStateLock, writeStateValuesTo
-
Method Details
-
visit
Mark this table location as visited, with the given (time)stamp.- Parameters:
stamp
- a monotonically increasing value indicating when this location was visited.- Returns:
- returns itself for chaining
-
getVisit
long getVisit()return the last value set invisit(long)
- Returns:
- the last value set in visit()
-
getTableKey
- Returns:
- A TableKey instance for the enclosing table
-
getFormat
Get the format that was used to persist this table location.- Returns:
- The format for this table location
-
supportsSubscriptions
boolean supportsSubscriptions()Does this location support subscriptions? That is, can this location ever have ticking data?- Returns:
- True if this location supports subscriptions
-
subscribe
Subscribe to pushed location updates. Subscribing more than once with the same listener without an intervening unsubscribe is an error, and may result in undefined behavior.
This is a possibly asynchronous operation - listener will receive 1 or more handleUpdate callbacks, followed by 0 or 1 handleException callbacks during invocation and continuing after completion, on a thread determined by the implementation. Don't hold a lock that prevents notification delivery while subscribing!
This method only guarantees eventually consistent state. To force a state update, use refresh() after subscription completes.
- Parameters:
listener
- A listener
-
unsubscribe
Unsubscribe from pushed location updates.- Parameters:
listener
- The listener to forget about
-
refresh
void refresh()Initialize or refresh state information. -
getSortedColumns
Get an ordered list of columns this location is sorted by.- Returns:
- a non-null ordered list of
SortPair
s
-
hasDataIndexFor
boolean hasDataIndexFor(@NotNull com.illumon.dataobjects.ColumnDefinition<?>... columns)Check if this location has a data index for the specified columns.- Parameters:
columns
- the set of columns to check for.- Returns:
- true if the table has a Data Index for the specified columns
-
getDataIndex
Get the data index table for the specified set of columns. Note that the order of columns does not matter here.- Parameters:
columns
- the key columns for the index- Returns:
- the index table or null if one does not exist.
-
getColumnLocation
- Parameters:
name
- The column name- Returns:
- The ColumnLocation for the defined column under this table location
-
getColumnVersion
int getColumnVersion()Get the column version for this location.- Returns:
- the column version
-
append
@FinalDefault default com.fishlib.base.log.LogOutput append(@NotNull com.fishlib.base.log.LogOutput logOutput)- Specified by:
append
in interfacecom.fishlib.base.log.LogOutputAppendable
- Specified by:
append
in interfaceTableLocationKey
-
toStringHelper
- Specified by:
toStringHelper
in interfaceTableLocationKey
-
toGenericString
Format the table key without implementation specific bits.- Returns:
- a formatted string
-
toStringDetailed
Optional toString path with more implementation detail.- Returns:
- detailed conversion to string
-