Package org.yamcs.archive
Class CcsdsTmIndex
- java.lang.Object
-
- com.google.common.util.concurrent.AbstractService
-
- org.yamcs.AbstractYamcsService
-
- org.yamcs.archive.CcsdsTmIndex
-
- All Implemented Interfaces:
com.google.common.util.concurrent.Service
,TmIndexService
,YamcsService
,StreamSubscriber
public class CcsdsTmIndex extends AbstractYamcsService implements TmIndexService
Completeness index of CCSDS telemetry. The structure of the rocksdb records:key: tbsIndex[4 bytes], apid[2bytes], start time[8 bytes], start seq count[2 bytes] value: end time[8bytes], end seq count[2 bytes], num packets [4 bytes]
FIXME: because the sequence count wraps around, there is a bug in case packets with the same timestamp and wrapped around sequence counts are received - see testApidIndexSameTimeAndWraparound for failing test. the old TokyoCabinet based indexer didn't use the sequence count as part of the key but allowed multiple records with the same key. To replicate this in RocksDB, one would need to have the RocksDB entries composed of all records with the same startime
-
-
Field Summary
-
Fields inherited from class org.yamcs.AbstractYamcsService
config, log, serviceName, yamcsInstance
-
-
Constructor Summary
Constructors Constructor Description CcsdsTmIndex()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteRecords(long start, long stop)
protected void
doStart()
protected void
doStop()
IndexIterator
getIterator(List<org.yamcs.protobuf.Yamcs.NamedObjectId> names, long start, long stop)
return an iterator that provides all the index entries between start and stopstatic String
getWhereCondition(String timeColumnName, TimeInterval interval)
void
init(String yamcsInstance, String serviceName, YConfiguration args)
Initialize this service.void
onTuple(Stream stream, Tuple tuple)
void
printApidDb()
void
printApidDb(short apid, long start, long stop)
CompletableFuture<Void>
rebuild(TimeInterval interval)
void
streamClosed(Stream stream)
-
Methods inherited from class org.yamcs.AbstractYamcsService
getConfig, getYamcsInstance
-
Methods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Methods inherited from interface org.yamcs.YamcsService
getSpec, init
-
-
-
-
Method Detail
-
init
public void init(String yamcsInstance, String serviceName, YConfiguration args) throws InitException
Description copied from interface:YamcsService
Initialize this service. This is called before the service is started. All operations should finish fast.- Specified by:
init
in interfaceYamcsService
- Overrides:
init
in classAbstractYamcsService
- Parameters:
yamcsInstance
- The yamcs instance, or null if this is a global service.serviceName
- The service name.args
- The configured arguments for this service. IfYamcsService.getSpec()
is implemented then this contains the arguments after being validated (including any defaults).- Throws:
InitException
- When something goes wrong during the execution of this method.
-
doStart
protected void doStart()
- Specified by:
doStart
in classcom.google.common.util.concurrent.AbstractService
-
doStop
protected void doStop()
- Specified by:
doStop
in classcom.google.common.util.concurrent.AbstractService
-
onTuple
public void onTuple(Stream stream, Tuple tuple)
- Specified by:
onTuple
in interfaceStreamSubscriber
-
deleteRecords
public void deleteRecords(long start, long stop)
- Specified by:
deleteRecords
in interfaceTmIndexService
-
printApidDb
public void printApidDb() throws org.rocksdb.RocksDBException
- Throws:
org.rocksdb.RocksDBException
-
printApidDb
public void printApidDb(short apid, long start, long stop) throws org.rocksdb.RocksDBException
- Throws:
org.rocksdb.RocksDBException
-
getIterator
public IndexIterator getIterator(List<org.yamcs.protobuf.Yamcs.NamedObjectId> names, long start, long stop)
Description copied from interface:TmIndexService
return an iterator that provides all the index entries between start and stop- Specified by:
getIterator
in interfaceTmIndexService
- Parameters:
names
- can be used to filter which entries are returned. If null, everything is returned.- Returns:
-
streamClosed
public void streamClosed(Stream stream)
- Specified by:
streamClosed
in interfaceStreamSubscriber
-
rebuild
public CompletableFuture<Void> rebuild(TimeInterval interval) throws YarchException
- Throws:
YarchException
-
getWhereCondition
public static String getWhereCondition(String timeColumnName, TimeInterval interval)
-
-