forked from TrueCloudLab/frostfs-api-go
[#145] sdk/object: Implement Object deserialization function
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
1ac6f2eeeb
commit
0b9ddd10f8
1 changed files with 11 additions and 0 deletions
|
@ -37,3 +37,14 @@ func (o *Object) ToV2() *object.Object {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
// FromBytes restores Object instance from a binary representation.
|
||||
func FromBytes(data []byte) (*Object, error) {
|
||||
oV2 := new(object.Object)
|
||||
|
||||
if err := oV2.StableUnmarshal(data); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return NewFromV2(oV2), nil
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue