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

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

View file

@ -162,6 +162,17 @@ func (h *ShortHeader) StableSize() (size int) {
return size
}
func (h *ShortHeader) Unmarshal(data []byte) error {
m := new(object.ShortHeader)
if err := goproto.Unmarshal(data, m); err != nil {
return err
}
*h = *ShortHeaderFromGRPCMessage(m)
return nil
}
func (a *Attribute) StableMarshal(buf []byte) ([]byte, error) {
if a == nil {
return []byte{}, nil