[#1238] Adopt neofs-node for non pointer slices in SDK

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2022-03-15 15:11:35 +03:00 committed by Alex Vanin
parent 9fad29dfe0
commit 8f476f3c4d
41 changed files with 146 additions and 148 deletions

View file

@ -16,7 +16,7 @@ const (
defaultPrice = 0
)
func parseAttributes(c *config.Config) []*netmap.NodeAttribute {
func parseAttributes(c *config.Config) []netmap.NodeAttribute {
if nodeconfig.Relay(c) {
return nil
}
@ -44,7 +44,7 @@ func listWellKnownAttrDesc() map[string]wellKnownNodeAttrDesc {
}
}
func addWellKnownAttributes(attrs []*netmap.NodeAttribute) []*netmap.NodeAttribute {
func addWellKnownAttributes(attrs []netmap.NodeAttribute) []netmap.NodeAttribute {
mWellKnown := listWellKnownAttrDesc()
// check how user defined well-known attributes
@ -59,11 +59,10 @@ func addWellKnownAttributes(attrs []*netmap.NodeAttribute) []*netmap.NodeAttribu
}
// set default value of the attribute
a := netmap.NewNodeAttribute()
a.SetKey(key)
a.SetValue(desc.defaultVal)
attrs = append(attrs, a)
index := len(attrs)
attrs = append(attrs, netmap.NodeAttribute{})
attrs[index].SetKey(key)
attrs[index].SetValue(desc.defaultVal)
}
return attrs

View file

@ -468,7 +468,7 @@ func (c *usedSpaceService) AnnounceUsedSpace(ctx context.Context, req *container
}
for _, aV2 := range req.GetBody().GetAnnouncements() {
if err := c.processLoadValue(ctx, *containerSDK.NewAnnouncementFromV2(aV2), passedRoute, w); err != nil {
if err := c.processLoadValue(ctx, *containerSDK.NewAnnouncementFromV2(&aV2), passedRoute, w); err != nil {
return nil, err
}
}

View file

@ -354,7 +354,7 @@ func (n *netInfo) Dump(ver *refs.Version) (*netmapV2.NetworkInfo, error) {
}
var (
ps []*netmapV2.NetworkParameter
ps []netmapV2.NetworkParameter
netCfg netmapV2.NetworkConfig
)
@ -364,7 +364,7 @@ func (n *netInfo) Dump(ver *refs.Version) (*netmapV2.NetworkInfo, error) {
p.SetKey(key)
p.SetValue(value)
ps = append(ps, &p)
ps = append(ps, p)
return nil
}); err != nil {

View file

@ -260,7 +260,7 @@ func (s *reputationServer) AnnounceLocalTrust(ctx context.Context, req *v2reputa
}
for _, trust := range body.GetTrusts() {
err = s.processLocalTrust(body.GetEpoch(), apiToLocalTrust(trust, passedRoute[0].PublicKey()), passedRoute, w)
err = s.processLocalTrust(body.GetEpoch(), apiToLocalTrust(&trust, passedRoute[0].PublicKey()), passedRoute, w)
if err != nil {
return nil, fmt.Errorf("could not write one of local trusts: %w", err)
}