Class RealtimeArchiveFiller

java.lang.Object
org.yamcs.parameterarchive.RealtimeArchiveFiller
All Implemented Interfaces:
ParameterConsumer

public class RealtimeArchiveFiller extends Object
Realtime archive filler task - it works even if the data is not perfectly sorted

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 Details

    • log

      protected final Log log
    • parameterIdMap

      protected final ParameterIdDb parameterIdMap
    • parameterGroupIdMap

      protected final ParameterGroupIdDb parameterGroupIdMap
    • collectionStart

      protected long collectionStart
    • maxSegmentSize

      protected int maxSegmentSize
  • Constructor Details

  • Method Details

    • start

      protected void start()
    • shutDown

      public void shutDown() throws InterruptedException
      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

      public void updateItems(int subscriptionId, List<ParameterValue> items)
      Specified by:
      updateItems in interface ParameterConsumer
    • getNumProcessedParameters

      public long getNumProcessedParameters()