Package io.deephaven.engine.table.impl
Class OperationSnapshotControl
java.lang.Object
io.deephaven.engine.table.impl.OperationSnapshotControl
- All Implemented Interfaces:
ConstructSnapshot.SnapshotCompletedConsistently,ConstructSnapshot.SnapshotConsistent,ConstructSnapshot.SnapshotControl,ConstructSnapshot.UsePreviousValues
- Direct Known Subclasses:
OperationSnapshotControlEx
A simple implementation of
ConstructSnapshot.SnapshotControl that uses the last notification step of the
source table to determine whether to use previous values during initialization and to evaluate success.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanvoidsetListenerAndResult(TableUpdateListener listener, @NotNull NotificationStepReceiver resultTable) Set the listener that will eventually become the listener, if we have a successful snapshot.booleansnapshotCompletedConsistently(long afterClockValue, boolean usedPreviousValues) Ends a snapshot.booleansnapshotConsistent(long currentClockValue, boolean usingPreviousValues) Determine (from within a snapshot function) if the snapshot appears to still be consistent.usePreviousValues(long beforeClockValue) Starts a snapshot.
-
Constructor Details
-
OperationSnapshotControl
-
-
Method Details
-
getUpdateGraph
- Specified by:
getUpdateGraphin interfaceConstructSnapshot.SnapshotControl- Returns:
- The
UpdateGraphthat applies for this snapshot;nullfor snapshots of static data, which can skip all consistency-related considerations
-
usePreviousValues
Starts a snapshot.- Specified by:
usePreviousValuesin interfaceConstructSnapshot.UsePreviousValues- Parameters:
beforeClockValue- the logical clock value we are starting a snapshot on- Returns:
- true if we should use previous values, false if we should use current values.
-
snapshotConsistent
public boolean snapshotConsistent(long currentClockValue, boolean usingPreviousValues) Description copied from interface:ConstructSnapshot.SnapshotConsistentDetermine (from within a snapshot function) if the snapshot appears to still be consistent.
This should be no more restrictive than the associated
ConstructSnapshot.SnapshotCompletedConsistently.Can assume as a precondition that the clock step has not been observed to change since the last time the associated
ConstructSnapshot.UsePreviousValues.usePreviousValues(long)was invoked, and that the clock state has not been observed to change if previous values were used. SeeConstructSnapshot.clockConsistent(long, long, boolean).- Specified by:
snapshotConsistentin interfaceConstructSnapshot.SnapshotConsistent- Parameters:
currentClockValue- The current clock valueusingPreviousValues- Whether the snapshot function is using previous values- Returns:
- True if we can no longer expect that the snapshot function's result will be consistent
-
snapshotCompletedConsistently
@OverridingMethodsMustInvokeSuper public boolean snapshotCompletedConsistently(long afterClockValue, boolean usedPreviousValues) Ends a snapshot. Overriding methods must callsuperin order to ensure that the result's last notification step is properly set.- Specified by:
snapshotCompletedConsistentlyin interfaceConstructSnapshot.SnapshotCompletedConsistently- Specified by:
snapshotCompletedConsistentlyin interfaceConstructSnapshot.SnapshotControl- Parameters:
afterClockValue- Thelogical clockcycle we are ending a snapshot onusedPreviousValues- Whether we used previous values during the snapshot- Returns:
- true if the snapshot was successful, false if we should try again.
- Throws:
IllegalStateException- If the snapshot was successful (consistent), but the snapshot function failed to set the eventual listener or eventual result
-
isInInitialNotificationWindow
protected boolean isInInitialNotificationWindow()- Returns:
- Whether we are in the initial notification window and can continue with the snapshot
-
setListenerAndResult
public void setListenerAndResult(TableUpdateListener listener, @NotNull @NotNull NotificationStepReceiver resultTable) Set the listener that will eventually become the listener, if we have a successful snapshot.- Parameters:
listener- The listener that we will eventually forward all updates toresultTable- The table that will result from this operation
-