-
Notifications
You must be signed in to change notification settings - Fork 53
/
init.go
47 lines (41 loc) · 1.53 KB
/
init.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package jetstream
import (
"github.com/nats-io/nats.go"
"github.com/rancher/opni/pkg/alerting/shared"
"github.com/rancher/opni/pkg/util"
)
func NewRouterObjectStore(js nats.JetStreamContext) nats.ObjectStore {
return util.Must(js.CreateObjectStore(&nats.ObjectStoreConfig{
Bucket: shared.RouterStorage,
Description: "track constructed and synced routing trees",
Storage: nats.FileStorage,
}))
}
func NewIncidentKeyStore(js nats.JetStreamContext) nats.KeyValue {
return util.Must(js.CreateKeyValue(&nats.KeyValueConfig{
Bucket: shared.GeneralIncidentStorage,
Description: "track internal incident changes over time for each condition id",
Storage: nats.FileStorage,
}))
}
func NewStatusCache(js nats.JetStreamContext) nats.KeyValue {
return util.Must(js.CreateKeyValue(&nats.KeyValueConfig{
Bucket: shared.StatusBucketPerCondition,
Description: "track last known internal status for each condition id",
Storage: nats.FileStorage,
}))
}
func NewConditionKeyStore(js nats.JetStreamContext) nats.KeyValue {
return util.Must(js.CreateKeyValue(&nats.KeyValueConfig{
Bucket: shared.AlertingConditionBucket,
Description: "track last known internal status for each condition id",
Storage: nats.FileStorage,
}))
}
func NewEndpointKeyStore(js nats.JetStreamContext) nats.KeyValue {
return util.Must(js.CreateKeyValue(&nats.KeyValueConfig{
Bucket: shared.AlertingEndpointBucket,
Description: "track last known internal status for each condition id",
Storage: nats.FileStorage,
}))
}