2021-04-15 07:23:52 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2021-11-10 07:08:33 +00:00
|
|
|
objectSDK "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`.
|
|
|
|
func MergeSplitInfo(from, to *objectSDK.SplitInfo) *objectSDK.SplitInfo {
|
|
|
|
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
|
|
|
|
}
|