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 boolean
ascending
protected boolean
follow
protected PartitionManager
partitionManager
protected TableDefinition
tableDefinition
-
Fields inherited from class org.yamcs.yarch.Stream
log, name, outputDefinition, QUITTING, RUNNING, SETUP, state, subscribers, ydb
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTableReaderStream(YarchDatabaseInstance ydb, PartitionManager partitionManager, boolean ascending, boolean follow)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
addInFilter(ColumnExpression cexpr, boolean negation, Set<Object> values)
currently adds only filters on value based partitionsboolean
addRelOpFilter(ColumnExpression cexpr, RelOp relOp, Object value)
protected int
compare(byte[] a1, byte[] a2)
protected Tuple
dataToTuple(byte[] k, byte[] v)
void
doClose()
protected boolean
emitIfNotPastStart(byte[] key, byte[] value, byte[] rangeStart, boolean strictStart)
protected boolean
emitIfNotPastStop(byte[] key, byte[] value, byte[] rangeEnd, boolean strictEnd)
TableDefinition
getTableDefinition()
void
run()
protected abstract boolean
runPartitions(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:
addRelOpFilter
in 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:
addInFilter
in interfaceDbReaderStream
- Throws:
StreamSqlException
-
getTableDefinition
public TableDefinition getTableDefinition()
-
compare
protected int compare(byte[] a1, byte[] a2)
-
-