2021-04-15 07:23:52 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2022-03-03 14:19:05 +00:00
|
|
|
"github.com/nspcc-dev/neofs-sdk-go/object"
|
2021-04-15 07:23:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// MergeSplitInfo ignores conflicts and rewrites `to` with non empty values
|
|
|
|
// from `from`.
|
2022-03-03 14:19:05 +00:00
|
|
|
func MergeSplitInfo(from, to *object.SplitInfo) *object.SplitInfo {
|
2021-04-15 07:23:52 +00:00
|
|
|
to.SetSplitID(from.SplitID()) // overwrite SplitID and ignore conflicts
|
|
|
|
|
|
|
|
if lp := from.LastPart(); lp != nil {
|
|
|
|
to.SetLastPart(lp)
|
|
|
|
}
|
|
|
|
|
|
|
|
if link := from.Link(); link != nil {
|
|
|
|
to.SetLink(link)
|
|
|
|
}
|
|
|
|
|
|
|
|
return to
|
|
|
|
}
|