2021-04-15 07:23:52 +00:00
|
|
|
package util
|
|
|
|
|
|
|
|
import (
|
2023-07-06 12:36:41 +00:00
|
|
|
objectSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/object"
|
2021-04-15 07:23:52 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
// MergeSplitInfo ignores conflicts and rewrites `to` with non empty values
|
|
|
|
// from `from`.
|
2023-07-06 12:36:41 +00:00
|
|
|
func MergeSplitInfo(from, to *objectSDK.SplitInfo) *objectSDK.SplitInfo {
|
2021-04-15 07:23:52 +00:00
|
|
|
to.SetSplitID(from.SplitID()) // overwrite SplitID and ignore conflicts
|
|
|
|
|
2022-05-12 16:37:46 +00:00
|
|
|
if lp, ok := from.LastPart(); ok {
|
2021-04-15 07:23:52 +00:00
|
|
|
to.SetLastPart(lp)
|
|
|
|
}
|
|
|
|
|
2022-05-12 16:37:46 +00:00
|
|
|
if link, ok := from.Link(); ok {
|
2021-04-15 07:23:52 +00:00
|
|
|
to.SetLink(link)
|
|
|
|
}
|
|
|
|
|
|
|
|
return to
|
|
|
|
}
|