Class 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.
    • Method Detail

      • run

        protected void run()
                    throws Exception
        Specified by:
        run in class com.google.common.util.concurrent.AbstractExecutionThreadService
        Throws:
        Exception
      • flush

        public void flush()
      • startUp

        protected void startUp()
        Overrides:
        startUp in class com.google.common.util.concurrent.AbstractExecutionThreadService
      • triggerShutdown

        protected void triggerShutdown()
        Overrides:
        triggerShutdown in class com.google.common.util.concurrent.AbstractExecutionThreadService
      • shutDown

        protected void shutDown()
        Overrides:
        shutDown in class com.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()