Class RealtimeArchiveFiller
- All Implemented Interfaces:
ParameterConsumer
It can save data in max two intervals at a time. The first interval is kept open only as long as the most recent timestamp received is not older than orderingThreshold ms from the interval end
When new parameters are received, they are sorted into groups with all parameter from the same group having the same timestamp.
Max two segments are kept open for each group, one in each interval.
If the group reaches its max size, it is archived and a new one opened.
-
Field Summary
Modifier and TypeFieldDescriptionprotected long
protected final Log
protected int
protected final ParameterGroupIdDb
protected final ParameterIdDb
-
Constructor Summary
ConstructorDescriptionRealtimeArchiveFiller
(ParameterArchive parameterArchive, YConfiguration config) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
abort()
Called when risking running out of memory, drop all datalong
getSegments
(int parameterId, int parameterGroupId, boolean ascending) Return the list of segments for the (parameterId, parameterGroupId) currently in memory.getSegments
(ParameterId[] pids, int parameterGroupId, boolean ascending) protected void
processParameters
(long t, org.yamcs.parameterarchive.BasicParameterList pvList) void
shutDown()
protected void
start()
void
updateItems
(int subscriptionId, List<ParameterValue> items)
-
Field Details
-
log
-
parameterIdMap
-
parameterGroupIdMap
-
collectionStart
protected long collectionStart -
maxSegmentSize
protected int maxSegmentSize
-
-
Constructor Details
-
RealtimeArchiveFiller
-
-
Method Details
-
start
protected void start() -
shutDown
- Throws:
InterruptedException
-
processParameters
protected void processParameters(long t, org.yamcs.parameterarchive.BasicParameterList pvList) -
abort
protected void abort()Called when risking running out of memory, drop all data -
getSegments
public List<ParameterValueSegment> getSegments(int parameterId, int parameterGroupId, boolean ascending) Return the list of segments for the (parameterId, parameterGroupId) currently in memory. If there is no data, an empty list is returned.If ascending is false, the list of segments is sorted by descending start time but the data inside the segments is still sorted in ascending order.
The segments are references to the data that is being added, that means they are modified by external threads.
Some segments may just being written to the archive, so care has to be taken by the caller to eliminate duplicate data when using the return of this method combined with reading data from archive. The
SegmentIterator
does that.- Parameters:
parameterId
-parameterGroupId
-ascending
-- Returns:
-
getSegments
public List<MultiParameterValueSegment> getSegments(ParameterId[] pids, int parameterGroupId, boolean ascending) -
updateItems
- Specified by:
updateItems
in interfaceParameterConsumer
-
getNumProcessedParameters
public long getNumProcessedParameters()
-