Class ElasticAlarmHistoryRepository

    • Field Detail

      • DEFAULT_LOOKBACK_PERIOD_MS

        public static final long DEFAULT_LOOKBACK_PERIOD_MS
    • Constructor Detail

      • ElasticAlarmHistoryRepository

        public ElasticAlarmHistoryRepository​(io.searchbox.client.JestClient client,
                                             IndexStrategy indexStrategy,
                                             IndexSettings indexSettings)
    • Method Detail

      • getAlarmWithDbIdAt

        public java.util.Optional<AlarmState> getAlarmWithDbIdAt​(long id,
                                                                 long time)
        Description copied from interface: AlarmHistoryRepository
        Retrieves the last known state of the alarm with the given database id, at or before the given time. If the alarm was deleted at (or before) this time, the returned document will only include minimal information. To retrieve the complete state prior to the delete you can perform another call to this this function with a time less than AlarmState.getDeletedTime().
        Specified by:
        getAlarmWithDbIdAt in interface AlarmHistoryRepository
        Parameters:
        id - database id of the alarm to query
        time - timestamps in milliseconds
        Returns:
        the last known state of the alarm, or an empty Optional if none was found
      • getStatesForAlarmWithDbId

        public java.util.List<AlarmState> getStatesForAlarmWithDbId​(long id)
        Description copied from interface: AlarmHistoryRepository
        Retrieves all the known states for the alarm with the given database id.
        Specified by:
        getStatesForAlarmWithDbId in interface AlarmHistoryRepository
        Parameters:
        id - database id of the alarm to query
        Returns:
        all the known states for the alarm, or an empty list if none were found
      • getStatesForAlarmWithReductionKey

        public java.util.List<AlarmState> getStatesForAlarmWithReductionKey​(java.lang.String reductionKey)
        Description copied from interface: AlarmHistoryRepository
        Retrieves all the known states for the alarm with the given database reduction key.
        Specified by:
        getStatesForAlarmWithReductionKey in interface AlarmHistoryRepository
        Parameters:
        reductionKey - reduction key of the alarm to query
        Returns:
        all the known states for the alarm, or an empty list if none were found
      • getActiveAlarmsAt

        public java.util.List<AlarmState> getActiveAlarmsAt​(long time)
        Description copied from interface: AlarmHistoryRepository
        Retrieves the last known state of alarms which were active (and not yet deleted) at the given time.
        Specified by:
        getActiveAlarmsAt in interface AlarmHistoryRepository
        Parameters:
        time - timestamp in milliseconds
        Returns:
        list of alarms
      • getLastStateOfAllAlarms

        public java.util.List<AlarmState> getLastStateOfAllAlarms​(long start,
                                                                  long end)
        Description copied from interface: AlarmHistoryRepository
        Retrieves the last known state of all alarms which were recorded in the given time period.
        Specified by:
        getLastStateOfAllAlarms in interface AlarmHistoryRepository
        Parameters:
        start - timestamp in milliseconds (inclusive)
        end - timestamp in milliseconds (inclusive)
        Returns:
        list of alarms
      • getNumActiveAlarmsAt

        public long getNumActiveAlarmsAt​(long time)
        Description copied from interface: AlarmHistoryRepository
        Retrieves the number of alarms which were active at the given time.
        Specified by:
        getNumActiveAlarmsAt in interface AlarmHistoryRepository
        Parameters:
        time - timestamp in milliseconds
        Returns:
        number of active alarms
      • setLookbackPeriodMs

        public void setLookbackPeriodMs​(long lookbackPeriodMs)