[#168] object: Implement binary/JSON encoders/decoders on Attribute

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2020-11-13 15:31:15 +03:00 committed by Alex Vanin
parent ce0d70fa02
commit 0caff85fb7
6 changed files with 103 additions and 4 deletions

View file

@ -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