Package org.yamcs.parameterarchive
Class RealtimeArchiveFiller
- java.lang.Object
-
- com.google.common.util.concurrent.AbstractExecutionThreadService
-
- org.yamcs.parameterarchive.RealtimeArchiveFiller
-
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,ParameterConsumer
public class RealtimeArchiveFiller extends com.google.common.util.concurrent.AbstractExecutionThreadService implements ParameterConsumer
Realtime archive filler task - it works even if the data is not perfectly sorted We can save data in max two intervals at a time. The first interval we keep open only as long as the most recent timestamp received is not older than orderingThreshold ms from the interval end When we receive a new delivery, we sort the parameters into groups, all parameter from the same group having the same timestamp One group corresponds to a set of parameter,types and is written in a segment. We keep open max two segments for each group, one in each interval. If the group reaches its max size, we archive it and open another one.
-
-
Field Summary
Fields Modifier and Type Field Description protected ParameterGroupIdDbparameterGroupIdMapprotected ParameterIdDbparameterIdMap
-
Constructor Summary
Constructors Constructor Description RealtimeArchiveFiller(ParameterArchive parameterArchive, YConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidflush()longgetNumProcessedParameters()protected longprocessParameters(List<ParameterValue> items)adds the parameters to the pgSegments structure and return the highest timestamp or -1 if all parameters have been ignored (because they were too old) parameters older than ignoreOlderThan are ignored.protected voidrun()protected voidshutDown()protected voidstartUp()protected voidtriggerShutdown()voidupdateItems(int subscriptionId, List<ParameterValue> items)protected voidwriteToArchive(long segStart, Collection<PGSegment> pgList)writes data into the archive
-
-
-
Field Detail
-
parameterIdMap
protected final ParameterIdDb parameterIdMap
-
parameterGroupIdMap
protected final ParameterGroupIdDb parameterGroupIdMap
-
-
Constructor Detail
-
RealtimeArchiveFiller
public RealtimeArchiveFiller(ParameterArchive parameterArchive, YConfiguration config)
-
-
Method Detail
-
run
protected void run() throws Exception- Specified by:
runin classcom.google.common.util.concurrent.AbstractExecutionThreadService- Throws:
Exception
-
updateItems
public void updateItems(int subscriptionId, List<ParameterValue> items)- Specified by:
updateItemsin interfaceParameterConsumer
-
flush
public void flush()
-
startUp
protected void startUp()
- Overrides:
startUpin classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
triggerShutdown
protected void triggerShutdown()
- Overrides:
triggerShutdownin classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
shutDown
protected void shutDown()
- Overrides:
shutDownin classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
processParameters
protected long processParameters(List<ParameterValue> items) throws IOException, org.rocksdb.RocksDBException
adds the parameters to the pgSegments structure and return the highest timestamp or -1 if all parameters have been ignored (because they were too old) parameters older than ignoreOlderThan are ignored.- Parameters:
items-- Returns:
- Throws:
org.rocksdb.RocksDBExceptionIOException
-
writeToArchive
protected void writeToArchive(long segStart, Collection<PGSegment> pgList)writes data into the archive- Parameters:
pgList-
-
getNumProcessedParameters
public long getNumProcessedParameters()
-
-