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