Package org.yamcs.yarch
Class AbstractTableReaderStream
- java.lang.Object
-
- org.yamcs.yarch.Stream
-
- org.yamcs.yarch.AbstractTableReaderStream
-
- All Implemented Interfaces:
Runnable,DbReaderStream
- Direct Known Subclasses:
RdbTableReaderStream
public abstract class AbstractTableReaderStream extends Stream implements Runnable, DbReaderStream
Implements skeleton for table streamer that uses PartitionManager to handle partitioning.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.yamcs.yarch.Stream
Stream.ExceptionHandler
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanascendingprotected booleanfollowprotected PartitionManagerpartitionManagerprotected TableDefinitiontableDefinition-
Fields inherited from class org.yamcs.yarch.Stream
log, name, outputDefinition, QUITTING, RUNNING, SETUP, state, subscribers, ydb
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractTableReaderStream(YarchDatabaseInstance ydb, PartitionManager partitionManager, boolean ascending, boolean follow)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description booleanaddInFilter(ColumnExpression cexpr, boolean negation, Set<Object> values)currently adds only filters on value based partitionsbooleanaddRelOpFilter(ColumnExpression cexpr, RelOp relOp, Object value)protected intcompare(byte[] a1, byte[] a2)protected TupledataToTuple(byte[] k, byte[] v)voiddoClose()protected booleanemitIfNotPastStart(byte[] key, byte[] value, byte[] rangeStart, boolean strictStart)protected booleanemitIfNotPastStop(byte[] key, byte[] value, byte[] rangeEnd, boolean strictEnd)TableDefinitiongetTableDefinition()voidrun()protected abstract booleanrunPartitions(List<Partition> partitions, IndexFilter range)Runs the partitions sending data only that conform with the start and end filters. returns true if the stop condition is met All the partitions are from the same time interval-
Methods inherited from class org.yamcs.yarch.Stream
addSubscriber, close, doStart, emitTuple, exceptionHandler, getColumnDefinition, getDataCount, getDefinition, getName, getState, getSubscriberCount, getSubscribers, isRunning, quitting, removeSubscriber, setName, start, toString
-
-
-
-
Field Detail
-
tableDefinition
protected TableDefinition tableDefinition
-
partitionManager
protected final PartitionManager partitionManager
-
ascending
protected final boolean ascending
-
follow
protected final boolean follow
-
-
Constructor Detail
-
AbstractTableReaderStream
protected AbstractTableReaderStream(YarchDatabaseInstance ydb, PartitionManager partitionManager, boolean ascending, boolean follow)
-
-
Method Detail
-
runPartitions
protected abstract boolean runPartitions(List<Partition> partitions, IndexFilter range) throws IOException
Runs the partitions sending data only that conform with the start and end filters. returns true if the stop condition is met All the partitions are from the same time interval- Returns:
- returns true if the end condition has been reached.
- Throws:
IOException
-
emitIfNotPastStop
protected boolean emitIfNotPastStop(byte[] key, byte[] value, byte[] rangeEnd, boolean strictEnd)
-
emitIfNotPastStart
protected boolean emitIfNotPastStart(byte[] key, byte[] value, byte[] rangeStart, boolean strictStart)
-
addRelOpFilter
public boolean addRelOpFilter(ColumnExpression cexpr, RelOp relOp, Object value) throws StreamSqlException
- Specified by:
addRelOpFilterin interfaceDbReaderStream- Throws:
StreamSqlException
-
dataToTuple
protected Tuple dataToTuple(byte[] k, byte[] v)
-
addInFilter
public boolean addInFilter(ColumnExpression cexpr, boolean negation, Set<Object> values) throws StreamSqlException
currently adds only filters on value based partitions- Specified by:
addInFilterin interfaceDbReaderStream- Throws:
StreamSqlException
-
getTableDefinition
public TableDefinition getTableDefinition()
-
compare
protected int compare(byte[] a1, byte[] a2)
-
-