File tree 2 files changed +4
-12
lines changed
2 files changed +4
-12
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,6 @@ import (
12
12
const (
13
13
// Format for metricsChecked index key: metricsChecked|<bool>|<messageID>
14
14
metricsCheckedIndexKeyFmt = "metricsChecked|%t|%s"
15
- // Format for lastObservedAt index key: lastObservedAt|<timestamp>|<messageID>
16
- // timestamp is in the format "20060102150405" (YYYYMMDDHHMMSS)
17
- lastObservedAtIndexKeyFmt = "lastObservedAt|%s|%s"
18
15
)
19
16
20
17
// CreateOrUpdateIndex creates or updates indexes for a message
@@ -25,16 +22,10 @@ func CreateOrUpdateIndex(txn *badger.Txn, message *Message) error {
25
22
return fmt .Errorf ("failed to set metricsChecked index: %w" , err )
26
23
}
27
24
28
- // Index for lastObservedAt
29
- loaKey := fmt .Sprintf (lastObservedAtIndexKeyFmt , message .LastObservedAt .Format ("20060102150405" ), message .MessageID )
30
- if err := txn .Set ([]byte (loaKey ), []byte (message .MessageID )); err != nil {
31
- return fmt .Errorf ("failed to set lastObservedAt index: %w" , err )
32
- }
33
-
34
25
return nil
35
26
}
36
27
37
- // Helper function to parse index key and extract values
28
+ // parseMetricsCheckedIndexKey helper function to parse index key and extract values
38
29
func parseMetricsCheckedIndexKey (key []byte ) (bool , string , error ) {
39
30
keyStr := string (key ) // Convert byte slice to string
40
31
parts := strings .Split (keyStr , "|" )
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ import (
14
14
15
15
// Message represents the data structure for a message in the Observations table.
16
16
type Message struct {
17
- MessageID MessageID `json:"messageId"`
17
+ MessageID MessageID `json:"messageId"`
18
18
LastObservedAt time.Time `json:"lastObservedAt"`
19
- Observations []Observation `json:"guardians "`
19
+ Observations []Observation `json:"observations "`
20
20
MetricsChecked bool `json:"metricsChecked"`
21
21
}
22
22
@@ -44,6 +44,7 @@ type ObservationStatus int
44
44
45
45
const (
46
46
OnTime ObservationStatus = iota
47
+ // Late indicates that the observation was made 30 hours after the last observed timestamp
47
48
Late
48
49
)
49
50
You can’t perform that action at this time.
0 commit comments