forked from TrueCloudLab/frostfs-node
[#1243] node/cfg: Add notification config
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
16543a1904
commit
5dba64fcc5
3 changed files with 19 additions and 5 deletions
|
@ -97,6 +97,8 @@ type cfg struct {
|
||||||
|
|
||||||
cfgObject cfgObject
|
cfgObject cfgObject
|
||||||
|
|
||||||
|
cfgNotifications cfgNotifications
|
||||||
|
|
||||||
metricsCollector *metrics.StorageMetrics
|
metricsCollector *metrics.StorageMetrics
|
||||||
|
|
||||||
workers []worker
|
workers []worker
|
||||||
|
@ -183,6 +185,12 @@ type cfgObject struct {
|
||||||
cfgLocalStorage cfgLocalStorage
|
cfgLocalStorage cfgLocalStorage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type cfgNotifications struct {
|
||||||
|
enabled bool
|
||||||
|
nw notificationWriter
|
||||||
|
defaultTopic string
|
||||||
|
}
|
||||||
|
|
||||||
type cfgLocalStorage struct {
|
type cfgLocalStorage struct {
|
||||||
localStorage *engine.StorageEngine
|
localStorage *engine.StorageEngine
|
||||||
|
|
||||||
|
|
|
@ -76,11 +76,11 @@ func initApp(c *cfg) {
|
||||||
initContainerService(c)
|
initContainerService(c)
|
||||||
initSessionService(c)
|
initSessionService(c)
|
||||||
initReputationService(c)
|
initReputationService(c)
|
||||||
|
initNotifications(c)
|
||||||
initObjectService(c)
|
initObjectService(c)
|
||||||
initProfiler(c)
|
initProfiler(c)
|
||||||
initMetrics(c)
|
initMetrics(c)
|
||||||
initControlService(c)
|
initControlService(c)
|
||||||
initNotifications(c)
|
|
||||||
|
|
||||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open())
|
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Open())
|
||||||
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
|
fatalOnErr(c.cfgObject.cfgLocalStorage.localStorage.Init())
|
||||||
|
|
|
@ -131,6 +131,15 @@ func initNotifications(c *cfg) {
|
||||||
panic("could not created object notificator: " + err.Error())
|
panic("could not created object notificator: " + err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.cfgNotifications = cfgNotifications{
|
||||||
|
enabled: true,
|
||||||
|
nw: notificationWriter{
|
||||||
|
l: c.log,
|
||||||
|
w: natsSvc,
|
||||||
|
},
|
||||||
|
defaultTopic: topic,
|
||||||
|
}
|
||||||
|
|
||||||
n := notificator.New(new(notificator.Prm).
|
n := notificator.New(new(notificator.Prm).
|
||||||
SetLogger(c.log).
|
SetLogger(c.log).
|
||||||
SetNotificationSource(
|
SetNotificationSource(
|
||||||
|
@ -139,10 +148,7 @@ func initNotifications(c *cfg) {
|
||||||
l: c.log,
|
l: c.log,
|
||||||
defaultTopic: topic,
|
defaultTopic: topic,
|
||||||
}).
|
}).
|
||||||
SetWriter(notificationWriter{
|
SetWriter(c.cfgNotifications.nw),
|
||||||
l: c.log,
|
|
||||||
w: natsSvc,
|
|
||||||
}),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
addNewEpochAsyncNotificationHandler(c, func(e event.Event) {
|
addNewEpochAsyncNotificationHandler(c, func(e event.Event) {
|
||||||
|
|
Loading…
Reference in a new issue