forked from TrueCloudLab/frostfs-api-go
[#302] pkg/netmap: Document default values set in NewPlacementPolicy
Document field values of instance constructed via `NewPlacementPolicy`. Assert the values in corresponding unit test. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
2176cb9f2b
commit
6fb7c79219
2 changed files with 32 additions and 0 deletions
|
@ -8,6 +8,12 @@ import (
|
|||
type PlacementPolicy netmap.PlacementPolicy
|
||||
|
||||
// NewPlacementPolicy creates and returns new PlacementPolicy instance.
|
||||
//
|
||||
// Defaults:
|
||||
// - backupFactor: 0;
|
||||
// - replicas nil;
|
||||
// - selectors nil;
|
||||
// - filters nil.
|
||||
func NewPlacementPolicy() *PlacementPolicy {
|
||||
return NewPlacementPolicyFromV2(new(netmap.PlacementPolicy))
|
||||
}
|
||||
|
@ -31,6 +37,10 @@ func (p *PlacementPolicy) Replicas() []*Replica {
|
|||
rs := (*netmap.PlacementPolicy)(p).
|
||||
GetReplicas()
|
||||
|
||||
if rs == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
res := make([]*Replica, 0, len(rs))
|
||||
|
||||
for i := range rs {
|
||||
|
@ -73,6 +83,10 @@ func (p *PlacementPolicy) Selectors() []*Selector {
|
|||
rs := (*netmap.PlacementPolicy)(p).
|
||||
GetSelectors()
|
||||
|
||||
if rs == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
res := make([]*Selector, 0, len(rs))
|
||||
|
||||
for i := range rs {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue