[#344] netmap: Add method Clone

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2025-03-07 13:59:38 +03:00
parent f70c0c9081
commit 749b4e9ab5
6 changed files with 141 additions and 0 deletions

View file

@ -563,6 +563,17 @@ func (x *NodeInfo) SetStatus(state NodeState) {
x.m.SetState(netmap.NodeState(state))
}
// Clone returns a copy of NodeInfo.
func (x *NodeInfo) Clone() *NodeInfo {
if x == nil {
return nil
}
return &NodeInfo{
hash: x.hash,
m: *x.m.Clone(),
}
}
// String implements fmt.Stringer.
//
// String is designed to be human-readable, and its format MAY differ between