Package org.yamcs.yarch
Class AbstractTableWalker
- java.lang.Object
-
- org.yamcs.yarch.AbstractTableWalker
-
- All Implemented Interfaces:
TableWalker
- Direct Known Subclasses:
RdbTableWalker
public abstract class AbstractTableWalker extends Object implements TableWalker
Iterator through a table.Iterates through partitions, can support partition filter (by time and/or value) and and also ranges on primary key.
This class expects raw (byte[]) input for the primary key ranges.
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
ascending
protected boolean
follow
protected Log
log
protected long
numRecordsRead
protected boolean
running
protected TableDefinition
tableDefinition
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
close()
protected boolean
iAscendingFinished(byte[] key, byte[] value, byte[] rangeEnd)
protected boolean
isDescendingFinished(byte[] key, byte[] value, byte[] rangeStart)
protected boolean
isRunning()
void
setPartitionFilter(TimeInterval partitionTimeFilter, Set<Object> partitionValueFilter)
void
setPrimaryIndexRange(DbRange range)
void
walk(TableVisitor visitor)
protected abstract boolean
walkInterval(PartitionManager.Interval interval, DbRange range, TableVisitor visitor)
Runs the data in a time interval (corresponding to a time partition) sending data only that conform with the start and end filters.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.yamcs.yarch.TableWalker
setSecondaryIndexRange
-
-
-
-
Field Detail
-
log
protected Log log
-
tableDefinition
protected TableDefinition tableDefinition
-
ascending
protected final boolean ascending
-
follow
protected final boolean follow
-
numRecordsRead
protected long numRecordsRead
-
running
protected volatile boolean running
-
-
Constructor Detail
-
AbstractTableWalker
protected AbstractTableWalker(YarchDatabaseInstance ydb, TableDefinition tableDefinition, boolean ascending, boolean follow)
-
-
Method Detail
-
walk
public void walk(TableVisitor visitor)
- Specified by:
walk
in interfaceTableWalker
-
iAscendingFinished
protected boolean iAscendingFinished(byte[] key, byte[] value, byte[] rangeEnd)
-
isDescendingFinished
protected boolean isDescendingFinished(byte[] key, byte[] value, byte[] rangeStart)
-
setPartitionFilter
public void setPartitionFilter(TimeInterval partitionTimeFilter, Set<Object> partitionValueFilter)
- Specified by:
setPartitionFilter
in interfaceTableWalker
-
setPrimaryIndexRange
public void setPrimaryIndexRange(DbRange range)
- Specified by:
setPrimaryIndexRange
in interfaceTableWalker
-
walkInterval
protected abstract boolean walkInterval(PartitionManager.Interval interval, DbRange range, TableVisitor visitor) throws YarchException
Runs the data in a time interval (corresponding to a time partition) sending data only that conform with the start and end filters. Returns true if the stop condition is met- Returns:
- returns true if the end condition has been reached.
- Throws:
YarchException
-
isRunning
protected boolean isRunning()
-
close
public void close()
- Specified by:
close
in interfaceTableWalker
-
-