[#311] services/control: Implement NetmapSnapshot method

Implement methods required for signatures. Receive network map from netmap
storage, convert it to Control service message and return in response.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-14 19:32:23 +03:00 committed by Alex Vanin
parent 28777911fb
commit 3e882d963f
4 changed files with 113 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package control
import (
"crypto/ecdsa"
"github.com/nspcc-dev/neofs-node/pkg/core/netmap"
"github.com/nspcc-dev/neofs-node/pkg/services/control"
)
@ -31,6 +32,8 @@ type cfg struct {
allowedKeys [][]byte
healthChecker HealthChecker
netMapSrc netmap.Source
}
func defaultCfg() *cfg {
@ -73,3 +76,10 @@ func WithHealthChecker(hc HealthChecker) Option {
c.healthChecker = hc
}
}
// WithNetMapSource returns option to set network map storage.
func WithNetMapSource(netMapSrc netmap.Source) Option {
return func(c *cfg) {
c.netMapSrc = netMapSrc
}
}