forked from TrueCloudLab/frostfs-api-go
[#302] pkg/netmap: Convert nil Replica
to nil message
Document that `Replica.ToV2` method return `nil` when called on `nil`. Document that `ReplicaFromV2` 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
6fb7c79219
commit
fb591f5fac
2 changed files with 24 additions and 5 deletions
|
@ -13,11 +13,15 @@ func NewReplica() *Replica {
|
|||
}
|
||||
|
||||
// NewReplicaFromV2 converts v2 Replica to Replica.
|
||||
//
|
||||
// Nil netmap.Replica converts to nil.
|
||||
func NewReplicaFromV2(f *netmap.Replica) *Replica {
|
||||
return (*Replica)(f)
|
||||
}
|
||||
|
||||
// ToV2 converts Replica to v2 Replica.
|
||||
//
|
||||
// Nil Replica converts to nil.
|
||||
func (r *Replica) ToV2() *netmap.Replica {
|
||||
return (*netmap.Replica)(r)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue