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 ParameterGroupIdDb
parameterGroupIdMap
protected ParameterIdDb
parameterIdMap
-
Constructor Summary
Constructors Constructor Description RealtimeArchiveFiller(ParameterArchive parameterArchive, YConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
flush()
long
getNumProcessedParameters()
protected long
processParameters(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 void
run()
protected void
shutDown()
protected void
startUp()
protected void
triggerShutdown()
void
updateItems(int subscriptionId, List<ParameterValue> items)
protected void
writeToArchive(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:
run
in classcom.google.common.util.concurrent.AbstractExecutionThreadService
- Throws:
Exception
-
updateItems
public void updateItems(int subscriptionId, List<ParameterValue> items)
- Specified by:
updateItems
in interfaceParameterConsumer
-
flush
public void flush()
-
startUp
protected void startUp()
- Overrides:
startUp
in classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
triggerShutdown
protected void triggerShutdown()
- Overrides:
triggerShutdown
in classcom.google.common.util.concurrent.AbstractExecutionThreadService
-
shutDown
protected void shutDown()
- Overrides:
shutDown
in 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.RocksDBException
IOException
-
writeToArchive
protected void writeToArchive(long segStart, Collection<PGSegment> pgList)
writes data into the archive- Parameters:
pgList
-
-
getNumProcessedParameters
public long getNumProcessedParameters()
-
-