Strict APE check for EC & fix sign EC part put requests #1451

Merged
fyrchik merged 5 commits from dstepanov-yadro/frostfs-node:fix/ec_ape_strict into master 2024-11-06 08:18:11 +00:00
Showing only changes of commit b4adf43557 - Show all commits

View file

@ -3,6 +3,7 @@ package placement
import ( import (
"crypto/sha256" "crypto/sha256"
"fmt" "fmt"
"slices"
"sync" "sync"
cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id" cid "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/container/id"
@ -44,7 +45,7 @@ func (c *ContainerNodesCache) ContainerNodes(nm *netmapSDK.NetMap, cnr cid.ID, p
raw, ok := c.containerCache.Get(cnr) raw, ok := c.containerCache.Get(cnr)
c.mtx.Unlock() c.mtx.Unlock()
if ok { if ok {
return raw, nil return c.cloneResult(raw), nil
} }
} else { } else {
c.lastEpoch = nm.Epoch() c.lastEpoch = nm.Epoch()
@ -65,5 +66,13 @@ func (c *ContainerNodesCache) ContainerNodes(nm *netmapSDK.NetMap, cnr cid.ID, p
c.containerCache.Add(cnr, cn) c.containerCache.Add(cnr, cn)
} }
c.mtx.Unlock() c.mtx.Unlock()
return cn, nil return c.cloneResult(cn), nil
}
func (c *ContainerNodesCache) cloneResult(nodes [][]netmapSDK.NodeInfo) [][]netmapSDK.NodeInfo {
result := make([][]netmapSDK.NodeInfo, len(nodes))
for repIdx := range nodes {

slices.Clone?

`slices.Clone`?

fixed

fixed
result[repIdx] = slices.Clone(nodes[repIdx])
}
return result
} }