[#249] pkg/netmap: Add CBF field in placement context

If CBF value is not set, then netmap package uses default CBF
value. However it modifies placement policy structure in
`GetContainerNodes()` because policy passed as a pointer.

Instead package can store CBF value in internal context and use
it without policy modification.

Signed-off-by: Alex Vanin <alexey@nspcc.ru>
This commit is contained in:
Alex Vanin 2021-01-26 18:01:02 +03:00 committed by Alex Vanin
parent 98284f0bfa
commit c35e15a758
4 changed files with 18 additions and 6 deletions

View file

@ -50,10 +50,7 @@ func (m *Netmap) GetPlacementVectors(cnt ContainerNodes, pivot []byte) ([]Nodes,
func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerNodes, error) {
c := NewContext(m)
c.setPivot(pivot)
if p.ContainerBackupFactor() == 0 {
p.SetContainerBackupFactor(defaultCBF)
}
c.setCBF(p.ContainerBackupFactor())
if err := c.processFilters(p); err != nil {
return nil, err