[#315] control: Implement SetNetmapStatus on Server

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-15 14:51:34 +03:00 committed by Alex Vanin
parent f39d08bda7
commit 619f8826e1
2 changed files with 51 additions and 0 deletions

View file

@ -29,6 +29,11 @@ type HealthChecker interface {
HealthStatus() control.HealthStatus
}
// NodeState is an interface of storage node network state.
type NodeState interface {
SetNetmapStatus(control.NetmapStatus) error
}
// Option of the Server's constructor.
type Option func(*cfg)
@ -40,6 +45,8 @@ type cfg struct {
healthChecker HealthChecker
netMapSrc netmap.Source
nodeState NodeState
}
func defaultCfg() *cfg {
@ -89,3 +96,10 @@ func WithNetMapSource(netMapSrc netmap.Source) Option {
c.netMapSrc = netMapSrc
}
}
// WithNodeState returns option to set node network state component.
func WithNodeState(state NodeState) Option {
return func(c *cfg) {
c.nodeState = state
}
}