forked from TrueCloudLab/frostfs-node
[#1793] node: Serve NetmapService.NetmapSnapshot
RPC
There is no more need to serve the same request on Control API. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
59de20fbba
commit
485a5418d2
33 changed files with 653 additions and 1238 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"net"
|
||||
"path/filepath"
|
||||
"sync"
|
||||
atomicstd "sync/atomic"
|
||||
"time"
|
||||
|
||||
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
|
||||
|
@ -134,6 +135,13 @@ type cfg struct {
|
|||
persistate *state.PersistentStorage
|
||||
|
||||
netMapSource netmapCore.Source
|
||||
|
||||
// current network map
|
||||
netMap atomicstd.Value // type netmap.NetMap
|
||||
}
|
||||
|
||||
func (c *cfg) ProcessCurrentNetMap(f func(netmap.NetMap)) {
|
||||
f(c.netMap.Load().(netmap.NetMap))
|
||||
}
|
||||
|
||||
type cfgGRPC struct {
|
||||
|
|
|
@ -286,6 +286,8 @@ func (c *cfg) netmapLocalNodeState(epoch uint64) (*netmapSDK.NodeInfo, error) {
|
|||
return nil, err
|
||||
}
|
||||
|
||||
c.netMap.Store(*nm)
|
||||
|
||||
nmNodes := nm.Nodes()
|
||||
for i := range nmNodes {
|
||||
if bytes.Equal(nmNodes[i].PublicKey(), c.binPublicKey) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue