Class HistoryWriter
java.lang.Object
com.inductiveautomation.historian.gateway.query.writing.HistoryWriter
- All Implemented Interfaces:
QueryController
- Direct Known Subclasses:
CalculationHistoryWriter,TallHistoryWriter
The history writer controls the flow of data from the QueryExecutor to the StreamingDatasetWriter. It also acts as
the query controller, providing access to the query settings.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceprotected classprotected classprotected class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ResultNodeprotected List<ResultNode>protected LoggerExprotected Object[]protected QualityCode[] -
Constructor Summary
ConstructorsConstructorDescriptionHistoryWriter(String queryId, StreamingDatasetWriter writer, TagHistoryQueryParams params) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidIncrements the block end by the block window size.protected voidprotected longprotected voidvoidexecute()protected voidlonggetBlockId(long time) Returns which block the time belongs to.longReturns the size of the blocks in milliseconds.protected List<ResultNode>protected LoggerExlongThe QueryId is an identifier for this particular query, so we can trace the route of the query across the various parts of SQLTags history.The parameters for the current query.longprotected longprotected voidprotected voidCreates the arrays rowData and rowQuality, which will get filled in, and then written from.protected voidprotected voidprotected voidinsertInList(ResultNode node) protected booleanprotected voidmarkCompletedTo(long time) protected voidregisterColumn(ResultNode column) voidsetQueryExecutor(HistoryQueryExecutor executor) voidsetWriter(StreamingDatasetWriter writer)
-
Field Details
-
scSet
-
columns
-
rowData
-
rowQuality
-
colList
-
log
-
-
Constructor Details
-
HistoryWriter
-
-
Method Details
-
calculateMaxRowLimit
protected long calculateMaxRowLimit() -
getLogger
-
getQueryId
The QueryId is an identifier for this particular query, so we can trace the route of the query across the various parts of SQLTags history. Any logging should include this id.- Specified by:
getQueryIdin interfaceQueryController
-
getQueryStart
public long getQueryStart()- Specified by:
getQueryStartin interfaceQueryController
-
getQueryEnd
public long getQueryEnd()- Specified by:
getQueryEndin interfaceQueryController
-
getBlockId
public long getBlockId(long time) Description copied from interface:QueryControllerReturns which block the time belongs to. Generally, will be some multiple of the block window on top of the start time. There is one special case that we accommodate: seed values. Those belong to a block BEFORE the start time. For that reason, we calculate everything off of the start time, and not the block end.- Specified by:
getBlockIdin interfaceQueryController
-
setQueryExecutor
-
registerColumn
-
getColumns
-
initLoader
- Throws:
Exception
-
initColumns
Creates the arrays rowData and rowQuality, which will get filled in, and then written from. If a HistoryWriter subclass returns a set of columns that are different than the natural set, this function should be overridden.- Throws:
Exception
-
getRowCount
protected long getRowCount() -
incrementRowCount
protected void incrementRowCount() -
getQueryParameters
Description copied from interface:QueryControllerThe parameters for the current query.- Specified by:
getQueryParametersin interfaceQueryController
-
getBlockSize
public long getBlockSize()Description copied from interface:QueryControllerReturns the size of the blocks in milliseconds. Will be 0 if the results should be raw data.- Specified by:
getBlockSizein interfaceQueryController- Returns:
- time in milliseconds covered by each block.
-
isRawQuery
protected boolean isRawQuery() -
calculateBlockSize
protected void calculateBlockSize() -
setWriter
-
execute
public void execute() -
initializeWriter
protected void initializeWriter() -
finalizeWriter
- Throws:
Exception
-
markCompletedTo
protected void markCompletedTo(long time) -
commitRows
- Throws:
Exception
-
advanceBlockEnd
protected void advanceBlockEnd()Increments the block end by the block window size. -
insertInList
-