Class WritableLocalTableLocation
- All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable,DeephavenFormatTableLocation,IWritableLocalTableLocation,TableLocation,TableLocationKey,TableLocationState,NamedImplementation
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.illumon.iris.db.v2.locations.TableLocation
TableLocation.Format, TableLocation.ListenerNested 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 class com.illumon.iris.db.v2.locations.local.LocalTableLocation
CHECKPOINT_RECORD_FILE_NAMEFields inherited from class com.illumon.iris.db.v2.locations.AbstractTableLocation
cachedGroupings, NO_GROUPING_SENTINELFields inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
subscriptionsFields inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
COMPARATOR, NULL_PARTITIONFields inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
NULL_SIZE, NULL_TIME, REMOVE_SIZE -
Constructor Summary
ConstructorsConstructorDescriptionWritableLocalTableLocation(TableKey tableKey, TableLocationKey tableLocationKey, File directory, TableDataRefreshService refreshService) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidRefresh and activate update pushing from the implementing class.protected voidDeactivate pushed updates from the implementing class.Get a name for the implementing class.Access the checkpoint record in use by writers of this location.voidgetWriterCheckpointRecordSnapshot(ByteArrayOutputStream snapshotOutput) Read the current state of this location's writer checkpoint record into a snapshot buffer.booleanprotected <T> booleanmatchSubscriptionToken(T token) Verify that a notification pertains to a currently-active subscription.voidrefresh()Initialize or refresh state information.voidForce a re-initialization of the reader checkpoint, after upgrading the checkpoint file.voidRead the concurrent consumer fields from the checkpoint record file into the internal reader checkpoint record.Clear and refresh the writer checkpoint record from the persistent checkpoint record file.final voidtruncate()Truncate this location's data and metadata, and advertise the change.final voidtruncate(CheckpointRecord.SourceFileSizeRecord sourceFileSizeRecord, CheckpointRecord.Flag truncationFlag, String... excludeFiles) Truncate this location's data and reset metadata to NULL_SIZE size and unknown table definition, and advertise the change.voidFor simple callers that don't already have snapshot buffers, fill and write a newly-allocated snapshot buffer from this location's checkpoint record to this location's checkpoint record file.voidwriteCheckpointRecordSnapshot(ByteArrayOutputStream snapshotInput) Write a snapshot buffer to this location's checkpoint record file.Methods inherited from class com.illumon.iris.db.v2.locations.local.LocalTableLocation
ensureReaderCheckpointInitialized, getCheckpointRecordFile, getCheckpointRecordFile, getColumnVersion, getDataIndexImpl, getDirectory, getReaderCheckpointRecord, getSortedColumns, getTableDefinition, hasDataIndexFor, makeColumnLocation, readCheckpointRecordForImporters, readCheckpointRecordForImporters, readCheckpointRecordForImporters, readCheckpointRecordForImportersFromFile, readCheckpointRecordForImportersFromFile, readCheckpointRecordForImportersFromFile, readCheckpointRecordForSerialConsumers, setSnapshot, writeCheckpointRecordMethods inherited from class com.illumon.iris.db.v2.locations.AbstractTableLocation
clearColumnLocations, deliverInitialSnapshot, getColumnLocation, getColumnPartition, getDataIndex, getInternalPartition, getLastModifiedTimeMillis, getSize, getStateLock, getTableKey, getVisit, handleUpdate, handleUpdate, toString, visitMethods inherited from class com.illumon.iris.db.v2.locations.SubscriptionAggregator
activationFailed, activationSuccessful, checkHasSubscribers, postActivationHook, subscribe, supportsSubscriptions, unsubscribeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.illumon.iris.db.v2.locations.DeephavenFormatTableLocation
getColumnVersion, getFormatMethods inherited from interface com.illumon.iris.db.v2.locations.local.IWritableLocalTableLocation
getDirectoryMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocation
append, as, clearColumnLocations, getColumnLocation, getColumnLocation, getDataIndex, getSortedColumns, getTableKey, getVisit, handleUpdate, hasDataIndexFor, subscribe, supportsSubscriptions, toGenericString, toStringDetailed, toStringHelper, unsubscribe, visitMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocationKey
getColumnPartition, getInternalPartition, writeToMethods inherited from interface com.illumon.iris.db.v2.locations.TableLocationState
copyStateValuesTo, getLastModifiedTimeMillis, getSize, getSizeStr, getStateLock, writeStateValuesTo
-
Constructor Details
-
WritableLocalTableLocation
public WritableLocalTableLocation(@NotNull TableKey tableKey, @NotNull TableLocationKey tableLocationKey, @NotNull File directory, @NotNull TableDataRefreshService refreshService)
-
-
Method Details
-
truncate
public final void truncate()Truncate this location's data and metadata, and advertise the change. This is disruptive for concurrent data readers and/or writers.- Specified by:
truncatein interfaceIWritableLocalTableLocation
-
truncate
public final void truncate(@Nullable CheckpointRecord.SourceFileSizeRecord sourceFileSizeRecord, CheckpointRecord.Flag truncationFlag, String... excludeFiles) Truncate this location's data and reset metadata to NULL_SIZE size and unknown table definition, and advertise the change. This is disruptive for concurrent data readers and/or writers.- Specified by:
truncatein interfaceIWritableLocalTableLocation- Parameters:
sourceFileSizeRecord- use this to keep track of the binary file location that triggered the truncatetruncationFlag- flag indicating the type of truncation to write in the checkpoint recordexcludeFiles- files to leave on disk when deleting data from this location
-
refreshAfterUpgrade
public void refreshAfterUpgrade()Force a re-initialization of the reader checkpoint, after upgrading the checkpoint file. It is expected that this happens only if there is no column data and the size is 0. -
getImplementationName
Description copied from interface:NamedImplementationGet a name for the implementing class. Useful for abstract classes that implement
LogOutputAppendableor overridetoString.The default implementation is correct, but not suitable for high-frequency usage.
- Specified by:
getImplementationNamein interfaceIWritableLocalTableLocation- Specified by:
getImplementationNamein interfaceNamedImplementation- Returns:
- A name for the implementing class
-
isWritable
public boolean isWritable()- Specified by:
isWritablein interfaceIWritableLocalTableLocation
-
refresh
public void refresh()Description copied from interface:TableLocationInitialize or refresh state information.- Specified by:
refreshin interfaceIWritableLocalTableLocation- Specified by:
refreshin interfaceTableLocation
-
activateUnderlyingDataSource
protected void activateUnderlyingDataSource()Description copied from class:SubscriptionAggregatorRefresh and activate update pushing from the implementing class.
If the implementation will deliver notifications in a different thread than the one that calls this method, then this method must be asynchronous - that is, it must not block pending delivery of results. This requirement holds even if that other thread has nothing to do with the initial activation request!
Listeners should guard against duplicate notifications, especially if the implementation delivers synchronous notifications.
The implementation should call activationSuccessful() when done activating and delivering initial refresh results, unless activationFailed() was called instead.
Must be called under the subscription lock.
- Overrides:
activateUnderlyingDataSourcein classSubscriptionAggregator<TableLocation.Listener>
-
deactivateUnderlyingDataSource
protected void deactivateUnderlyingDataSource()Description copied from class:SubscriptionAggregatorDeactivate pushed updates from the implementing class. Must be called under the subscription lock.- Overrides:
deactivateUnderlyingDataSourcein classSubscriptionAggregator<TableLocation.Listener>
-
matchSubscriptionToken
protected <T> boolean matchSubscriptionToken(T token) Description copied from class:SubscriptionAggregatorVerify that a notification pertains to a currently-active subscription. Must be called under the subscription lock.- Overrides:
matchSubscriptionTokenin classSubscriptionAggregator<TableLocation.Listener>- Parameters:
token- A subscription-related object that the subclass can use to match a notification- Returns:
- True iff notification delivery should proceed
-
refreshReaderCheckpointRecord
public void refreshReaderCheckpointRecord()Read the concurrent 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.- Overrides:
refreshReaderCheckpointRecordin classLocalTableLocation
-
getWriterCheckpointRecord
Access the checkpoint record in use by writers of this location. This is for advanced use only.- Specified by:
getWriterCheckpointRecordin interfaceIWritableLocalTableLocation- Returns:
- The checkpoint record used for writing data to this location
-
resetWriterCheckpointRecord
Clear and refresh the writer checkpoint record from the persistent checkpoint record file.- Specified by:
resetWriterCheckpointRecordin interfaceIWritableLocalTableLocation- Returns:
- The writer checkpoint record
-
getWriterCheckpointRecordSnapshot
Read the current state of this location's writer checkpoint record into a snapshot buffer.- Specified by:
getWriterCheckpointRecordSnapshotin interfaceIWritableLocalTableLocation- Parameters:
snapshotOutput- The snapshot buffer to write to
-
writeCheckpointRecordSnapshot
Write a snapshot buffer to this location's checkpoint record file.- Specified by:
writeCheckpointRecordSnapshotin interfaceIWritableLocalTableLocation- Parameters:
snapshotInput- The snapshot buffer to read from
-
writeCheckpointRecord
public void writeCheckpointRecord()For simple callers that don't already have snapshot buffers, fill and write a newly-allocated snapshot buffer from this location's checkpoint record to this location's checkpoint record file.- Specified by:
writeCheckpointRecordin interfaceIWritableLocalTableLocation
-