[#872] cmd/neofs-node: Don't lose local container size estimations

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-09-30 20:39:42 +03:00 committed by Alex Vanin
parent 4d7915a366
commit f08636c518

View file

@ -228,16 +228,6 @@ func (*morphLoadWriter) Close() error {
return nil return nil
} }
type nopLoadWriter struct{}
func (nopLoadWriter) Put(containerSDK.UsedSpaceAnnouncement) error {
return nil
}
func (nopLoadWriter) Close() error {
return nil
}
type remoteLoadAnnounceProvider struct { type remoteLoadAnnounceProvider struct {
key *ecdsa.PrivateKey key *ecdsa.PrivateKey
@ -251,15 +241,10 @@ type remoteLoadAnnounceProvider struct {
} }
func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadcontroller.WriterProvider, error) { func (r *remoteLoadAnnounceProvider) InitRemote(srv loadroute.ServerInfo) (loadcontroller.WriterProvider, error) {
if srv == nil { if srv == nil || r.netmapKeys.IsLocalKey(srv.PublicKey()) {
return r.deadEndProvider, nil return r.deadEndProvider, nil
} }
if r.netmapKeys.IsLocalKey(srv.PublicKey()) {
// if local => return no-op writer
return loadcontroller.SimpleWriterProvider(new(nopLoadWriter)), nil
}
var info client.NodeInfo var info client.NodeInfo
err := client.NodeInfoFromRawNetmapElement(&info, srv) err := client.NodeInfoFromRawNetmapElement(&info, srv)