forked from TrueCloudLab/frostfs-api-go
[#302] pkg/netmap: Convert nil Selector
to nil message
Document that `Selector.ToV2` method return `nil` when called on `nil`. Document that `NewSelectorFromV2` function return `nil` when called on `nil`. Write corresponding unit tests. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
af1742b48a
commit
c47d1fb26b
2 changed files with 29 additions and 13 deletions
|
@ -161,11 +161,15 @@ func NewSelector() *Selector {
|
|||
}
|
||||
|
||||
// NewSelectorFromV2 converts v2 Selector to Selector.
|
||||
//
|
||||
// Nil netmap.Selector converts to nil.
|
||||
func NewSelectorFromV2(f *netmap.Selector) *Selector {
|
||||
return (*Selector)(f)
|
||||
}
|
||||
|
||||
// ToV2 converts Selector to v2 Selector.
|
||||
//
|
||||
// Nil Selector converts to nil.
|
||||
func (s *Selector) ToV2() *netmap.Selector {
|
||||
return (*netmap.Selector)(s)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue