[#312] cmd/node: Implement HealthStatus method on node application
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
f327024ee7
commit
147399f547
2 changed files with 14 additions and 3 deletions
|
@ -184,6 +184,8 @@ type cfg struct {
|
||||||
|
|
||||||
cfgControlService cfgControlService
|
cfgControlService cfgControlService
|
||||||
|
|
||||||
|
netStatus *atomic.Int32
|
||||||
|
|
||||||
healthStatus *atomic.Int32
|
healthStatus *atomic.Int32
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +344,8 @@ func initCfg(path string) *cfg {
|
||||||
cfgObject: cfgObject{
|
cfgObject: cfgObject{
|
||||||
pool: initObjectPool(viperCfg),
|
pool: initObjectPool(viperCfg),
|
||||||
},
|
},
|
||||||
healthStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)),
|
netStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)),
|
||||||
|
healthStatus: atomic.NewInt32(int32(control.HealthStatus_HEALTH_STATUS_UNDEFINED)),
|
||||||
}
|
}
|
||||||
|
|
||||||
initLocalStorage(c)
|
initLocalStorage(c)
|
||||||
|
|
|
@ -69,9 +69,17 @@ func initControlService(c *cfg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cfg) setNetmapStatus(st control.NetmapStatus) {
|
func (c *cfg) setNetmapStatus(st control.NetmapStatus) {
|
||||||
c.healthStatus.Store(int32(st))
|
c.netStatus.Store(int32(st))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *cfg) NetmapStatus() control.NetmapStatus {
|
func (c *cfg) NetmapStatus() control.NetmapStatus {
|
||||||
return control.NetmapStatus(c.healthStatus.Load())
|
return control.NetmapStatus(c.netStatus.Load())
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cfg) setHealthStatus(st control.HealthStatus) {
|
||||||
|
c.healthStatus.Store(int32(st))
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *cfg) HealthStatus() control.HealthStatus {
|
||||||
|
return control.HealthStatus(c.healthStatus.Load())
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue