Package com.illumon.iris.db.v2.replay
Class Replayer
java.lang.Object
com.illumon.iris.db.v2.replay.Replayer
- All Implemented Interfaces:
LiveTable,ReplayerInterface,Runnable
- Direct Known Subclasses:
DataDrivenReplayer,FixedStepReplayer
Replay historical data as simulated real-time data.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionSimulated time.longSimulated time in nanoseconds.Gets a handle to the replayer.static TimeProvidergetTimeProvider(ReplayerInterface replayer) Gets a time provider for the replayer.booleanisDone()Has the replayer finished replaying all data.voidrefresh()Refresh the simulated live tables.voidregisterTimeSource(Index index, ColumnSource<DBDateTime> timestampSource) Register the time column and index from a new table to replay.Prepares a historical table for replaying.replayGrouped(Table dataSource, String timeColumn, String groupingColumn) Prepares a grouped historical table for replaying.replayGroupedLastBy(Table dataSource, String timeColumn, String... groupingColumns) Prepares a grouped historical table for replaying as a last-by table.voidSchedule a task to execute.voidsetTime(long updatedTime) Sets the current replay time.voidshutdown()Shuts down the replayer.voidstart()Starts replaying data.voidwaitDone(long maxTimeMillis) Wait a specified interval for the replayer to complete.
-
Field Details
-
startTime
-
endTime
-
-
Constructor Details
-
Replayer
Creates a new replayer.- Parameters:
startTime- start timeendTime- end time
-
-
Method Details
-
start
public void start()Starts replaying data.- Specified by:
startin interfaceReplayerInterface
-
isDone
public boolean isDone()Has the replayer finished replaying all data.- Specified by:
isDonein interfaceReplayerInterface- Returns:
- true if the replayer has finished replaying all data; false otherwise.
-
shutdown
Shuts down the replayer.- Specified by:
shutdownin interfaceReplayerInterface- Throws:
IOException- problem shutting down the replayer.
-
waitDone
public void waitDone(long maxTimeMillis) Wait a specified interval for the replayer to complete. If the replayer has not completed by the end of the interval, the method returns.- Specified by:
waitDonein interfaceReplayerInterface- Parameters:
maxTimeMillis- maximum number of milliseconds to wait.- Throws:
QueryCancellationException- thread was interrupted.
-
schedule
Schedule a task to execute.- Specified by:
schedulein interfaceReplayerInterface- Parameters:
task- task to executedelay- delay in milliseconds before first executing the taskperiod- frequency in milliseconds to execute the task.
-
getTimeProvider
Gets a time provider for the replayer. The time provider returns the current replay time.- Parameters:
replayer- replayer- Returns:
- time provider that returns the current replay time.
-
currentTimeNanos
public long currentTimeNanos()Simulated time in nanoseconds.- Returns:
- simulated time in nanoseconds.
-
currentTime
Simulated time.- Specified by:
currentTimein interfaceReplayerInterface- Returns:
- simulated time.
-
setTime
public void setTime(long updatedTime) Sets the current replay time.- Specified by:
setTimein interfaceReplayerInterface- Parameters:
updatedTime- new replay time.
-
replay
Prepares a historical table for replaying.- Specified by:
replayin interfaceReplayerInterface- Parameters:
dataSource- historical table to replaytimeColumn- column in the table containing timestamps- Returns:
- dynamic, replayed version of the table.
-
replayGrouped
Prepares a grouped historical table for replaying. This method can be faster than the ungrouped replay, but the performance increase comes with a cost. Within a group, the data ordering is maintained. Between groups, data ordering is not maintained for a time interval.- Specified by:
replayGroupedin interfaceReplayerInterface- Parameters:
dataSource- historical table to replaytimeColumn- column in the table containing timestamps- Returns:
- dynamic, replayed version of the table.
-
replayGroupedLastBy
public DynamicTable replayGroupedLastBy(Table dataSource, String timeColumn, String... groupingColumns) Prepares a grouped historical table for replaying as a last-by table.- Specified by:
replayGroupedLastByin interfaceReplayerInterface- Parameters:
dataSource- historical table to replaytimeColumn- column in the table containing timestampsgroupingColumns- columns used as the key in computing last-by- Returns:
- dynamic, replayed version of the last-by table.
-
registerTimeSource
Register the time column and index from a new table to replay. Most users will usereplay,replayGrouped, orreplayGroupedLastByinstead of this function.- Parameters:
index- table indextimestampSource- column source containing time information.
-
refresh
public void refresh()Refresh the simulated live tables. -
getHandle
Gets a handle to the replayer.- Specified by:
getHandlein interfaceReplayerInterface- Returns:
- handle to the replayer.
-