2021-11-08 10:04:45 +00:00
|
|
|
package object
|
|
|
|
|
|
|
|
import (
|
|
|
|
"github.com/nspcc-dev/neofs-api-go/v2/object"
|
2022-01-25 16:20:32 +00:00
|
|
|
oid "github.com/nspcc-dev/neofs-sdk-go/object/id"
|
2021-11-08 10:04:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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())
|
|
|
|
}
|
|
|
|
|
2022-01-25 16:20:32 +00:00
|
|
|
func (s *SplitInfo) LastPart() *oid.ID {
|
|
|
|
return oid.NewIDFromV2(
|
2021-11-08 10:04:45 +00:00
|
|
|
(*object.SplitInfo)(s).GetLastPart())
|
|
|
|
}
|
|
|
|
|
2022-01-25 16:20:32 +00:00
|
|
|
func (s *SplitInfo) SetLastPart(v *oid.ID) {
|
2021-11-08 10:04:45 +00:00
|
|
|
(*object.SplitInfo)(s).SetLastPart(v.ToV2())
|
|
|
|
}
|
|
|
|
|
2022-01-25 16:20:32 +00:00
|
|
|
func (s *SplitInfo) Link() *oid.ID {
|
|
|
|
return oid.NewIDFromV2(
|
2021-11-08 10:04:45 +00:00
|
|
|
(*object.SplitInfo)(s).GetLink())
|
|
|
|
}
|
|
|
|
|
2022-01-25 16:20:32 +00:00
|
|
|
func (s *SplitInfo) SetLink(v *oid.ID) {
|
2021-11-08 10:04:45 +00:00
|
|
|
(*object.SplitInfo)(s).SetLink(v.ToV2())
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SplitInfo) Marshal() ([]byte, error) {
|
2022-05-05 08:00:13 +00:00
|
|
|
return (*object.SplitInfo)(s).StableMarshal(nil), nil
|
2021-11-08 10:04:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *SplitInfo) Unmarshal(data []byte) error {
|
|
|
|
return (*object.SplitInfo)(s).Unmarshal(data)
|
|
|
|
}
|
2022-03-14 13:52:45 +00:00
|
|
|
|
|
|
|
// MarshalJSON implements json.Marshaler.
|
|
|
|
func (s *SplitInfo) MarshalJSON() ([]byte, error) {
|
|
|
|
return (*object.SplitInfo)(s).MarshalJSON()
|
|
|
|
}
|
|
|
|
|
|
|
|
// UnmarshalJSON implements json.Unmarshaler.
|
|
|
|
func (s *SplitInfo) UnmarshalJSON(data []byte) error {
|
|
|
|
return (*object.SplitInfo)(s).UnmarshalJSON(data)
|
|
|
|
}
|