[#156] netmap: Use default value for CBF if unset

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2020-11-27 12:41:56 +03:00 committed by Leonard Lyubich
parent 4e65fa41b8
commit 4e0a11b71a
2 changed files with 29 additions and 0 deletions

View file

@ -6,6 +6,8 @@ import (
"github.com/nspcc-dev/hrw"
)
const defaultCBF = 3
// Netmap represents netmap which contains preprocessed nodes.
type Netmap struct {
Nodes Nodes
@ -49,6 +51,10 @@ func (m *Netmap) GetContainerNodes(p *PlacementPolicy, pivot []byte) (ContainerN
c := NewContext(m)
c.setPivot(pivot)
if p.ContainerBackupFactor() == 0 {
p.SetContainerBackupFactor(defaultCBF)
}
if err := c.processFilters(p); err != nil {
return nil, err
}