frostfs-sdk-go/object/splitinfo.go
Evgenii Stratonikov 39d3317ef6 [#64] object: move package from neofs-api-go
Also, remove deprecated method.

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
2021-11-09 09:57:37 +03:00

66 lines
1.4 KiB
Go

package object
import (
"github.com/nspcc-dev/neofs-api-go/v2/object"
)
type SplitInfo object.SplitInfo
// NewSplitInfoFromV2 wraps v2 SplitInfo message to SplitInfo.
//
// Nil object.SplitInfo converts to nil.
func NewSplitInfoFromV2(v2 *object.SplitInfo) *SplitInfo {
return (*SplitInfo)(v2)
}
// NewSplitInfo creates and initializes blank SplitInfo.
//
// Defaults:
// - splitID: nil;
// - lastPart nil;
// - link: nil.
func NewSplitInfo() *SplitInfo {
return NewSplitInfoFromV2(new(object.SplitInfo))
}
// ToV2 converts SplitInfo to v2 SplitInfo message.
//
// Nil SplitInfo converts to nil.
func (s *SplitInfo) ToV2() *object.SplitInfo {
return (*object.SplitInfo)(s)
}
func (s *SplitInfo) SplitID() *SplitID {
return NewSplitIDFromV2(
(*object.SplitInfo)(s).GetSplitID())
}
func (s *SplitInfo) SetSplitID(v *SplitID) {
(*object.SplitInfo)(s).SetSplitID(v.ToV2())
}
func (s *SplitInfo) LastPart() *ID {
return NewIDFromV2(
(*object.SplitInfo)(s).GetLastPart())
}
func (s *SplitInfo) SetLastPart(v *ID) {
(*object.SplitInfo)(s).SetLastPart(v.ToV2())
}
func (s *SplitInfo) Link() *ID {
return NewIDFromV2(
(*object.SplitInfo)(s).GetLink())
}
func (s *SplitInfo) SetLink(v *ID) {
(*object.SplitInfo)(s).SetLink(v.ToV2())
}
func (s *SplitInfo) Marshal() ([]byte, error) {
return (*object.SplitInfo)(s).StableMarshal(nil)
}
func (s *SplitInfo) Unmarshal(data []byte) error {
return (*object.SplitInfo)(s).Unmarshal(data)
}