public class ElasticAlarmHistoryRepository extends Object implements AlarmHistoryRepository
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_LOOKBACK_PERIOD_MS |
Constructor and Description |
---|
ElasticAlarmHistoryRepository(io.searchbox.client.JestClient client,
IndexStrategy indexStrategy,
IndexSettings indexSettings) |
Modifier and Type | Method and Description |
---|---|
List<AlarmState> |
getActiveAlarmsAt(long time)
Retrieves the last known state of alarms which were active (and not yet deleted) at the given time.
|
List<AlarmState> |
getActiveAlarmsNow()
Retrieves the last known state of alarms which are currently active (and not yet deleted).
|
Optional<AlarmState> |
getAlarmWithDbIdAt(long id,
long time)
Retrieves the last known state of the alarm with the given database id, at or before the given time.
|
Optional<AlarmState> |
getAlarmWithReductionKeyIdAt(String reductionKey,
long time)
Similar to
AlarmHistoryRepository.getAlarmWithDbIdAt(long, long) , except the lookup is performed using the reduction key. |
List<AlarmState> |
getLastStateOfAllAlarms(long start,
long end)
Retrieves the last known state of all alarms which were recorded
in the given time period.
|
long |
getNumActiveAlarmsAt(long time)
Retrieves the number of alarms which were active at the given time.
|
long |
getNumActiveAlarmsNow()
Retrieves the number of alarms which are currently active.
|
List<AlarmState> |
getStatesForAlarmWithDbId(long id)
Retrieves all the known states for the alarm with the given database id.
|
List<AlarmState> |
getStatesForAlarmWithReductionKey(String reductionKey)
Retrieves all the known states for the alarm with the given database reduction key.
|
void |
setLookbackPeriodMs(long lookbackPeriodMs) |
public ElasticAlarmHistoryRepository(io.searchbox.client.JestClient client, IndexStrategy indexStrategy, IndexSettings indexSettings)
public Optional<AlarmState> getAlarmWithDbIdAt(long id, long time)
AlarmHistoryRepository
AlarmState.getDeletedTime()
.getAlarmWithDbIdAt
in interface AlarmHistoryRepository
id
- database id of the alarm to querytime
- timestamps in millisecondsOptional
if none was foundpublic Optional<AlarmState> getAlarmWithReductionKeyIdAt(String reductionKey, long time)
AlarmHistoryRepository
AlarmHistoryRepository.getAlarmWithDbIdAt(long, long)
, except the lookup is performed using the reduction key.getAlarmWithReductionKeyIdAt
in interface AlarmHistoryRepository
reductionKey
- reduction key of the alarm to querytime
- timestamps in millisecondsOptional
if none was foundpublic List<AlarmState> getStatesForAlarmWithDbId(long id)
AlarmHistoryRepository
getStatesForAlarmWithDbId
in interface AlarmHistoryRepository
id
- database id of the alarm to querypublic List<AlarmState> getStatesForAlarmWithReductionKey(String reductionKey)
AlarmHistoryRepository
getStatesForAlarmWithReductionKey
in interface AlarmHistoryRepository
reductionKey
- reduction key of the alarm to querypublic List<AlarmState> getActiveAlarmsAt(long time)
AlarmHistoryRepository
getActiveAlarmsAt
in interface AlarmHistoryRepository
time
- timestamp in millisecondspublic List<AlarmState> getLastStateOfAllAlarms(long start, long end)
AlarmHistoryRepository
getLastStateOfAllAlarms
in interface AlarmHistoryRepository
start
- timestamp in milliseconds (inclusive)end
- timestamp in milliseconds (inclusive)public long getNumActiveAlarmsAt(long time)
AlarmHistoryRepository
getNumActiveAlarmsAt
in interface AlarmHistoryRepository
time
- timestamp in millisecondspublic List<AlarmState> getActiveAlarmsNow()
AlarmHistoryRepository
getActiveAlarmsNow
in interface AlarmHistoryRepository
public long getNumActiveAlarmsNow()
AlarmHistoryRepository
getNumActiveAlarmsNow
in interface AlarmHistoryRepository
public void setLookbackPeriodMs(long lookbackPeriodMs)
Copyright © 2020. All rights reserved.