forked from TrueCloudLab/frostfs-api-go
[#135] sdk/object: Add Release method to RawObject
Implement Release method that converts RawObject to read-only finalized Object instance. Remove ToV2 method overriding from Object. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
8e9d456038
commit
9b0eef0d43
2 changed files with 11 additions and 7 deletions
|
@ -117,13 +117,6 @@ func (o *Object) CutPayload() *Object {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// ToV2 converts object to v2 Object message.
|
|
||||||
func (o *Object) ToV2() *object.Object {
|
|
||||||
obj, _ := o.rwObject.ToV2(nil)
|
|
||||||
|
|
||||||
return obj
|
|
||||||
}
|
|
||||||
|
|
||||||
func (o *rwObject) v2Header() *object.Header {
|
func (o *rwObject) v2Header() *object.Header {
|
||||||
hV2 := new(object.Header)
|
hV2 := new(object.Header)
|
||||||
hV2.SetContainerID(o.cid.ToV2())
|
hV2.SetContainerID(o.cid.ToV2())
|
||||||
|
|
|
@ -38,6 +38,17 @@ func (o *RawObject) SetOwnerID(v *owner.ID) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release returns read-only Object instance.
|
||||||
|
func (o *RawObject) Release() *Object {
|
||||||
|
if o != nil {
|
||||||
|
return &Object{
|
||||||
|
rwObject: o.rwObject,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// SetPayloadChecksumSHA256 sets payload checksum as a SHA256 checksum.
|
// SetPayloadChecksumSHA256 sets payload checksum as a SHA256 checksum.
|
||||||
func (o *RawObject) SetPayloadChecksumSHA256(v [sha256.Size]byte) {
|
func (o *RawObject) SetPayloadChecksumSHA256(v [sha256.Size]byte) {
|
||||||
if o != nil {
|
if o != nil {
|
||||||
|
|
Loading…
Reference in a new issue