forked from TrueCloudLab/frostfs-api-go
[#168] object: Implement binary/JSON encoders/decoders on Attribute
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
ce0d70fa02
commit
0caff85fb7
6 changed files with 103 additions and 4 deletions
|
@ -213,6 +213,17 @@ func (a *Attribute) StableSize() (size int) {
|
|||
return size
|
||||
}
|
||||
|
||||
func (a *Attribute) Unmarshal(data []byte) error {
|
||||
m := new(object.Header_Attribute)
|
||||
if err := goproto.Unmarshal(data, m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*a = *AttributeFromGRPCMessage(m)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *SplitHeader) StableMarshal(buf []byte) ([]byte, error) {
|
||||
if h == nil {
|
||||
return []byte{}, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue