forked from TrueCloudLab/frostfs-api-go
[#168] session: Implement binary/JSON encoders/decoders on XHeader
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
85d4713348
commit
7e3e9e1cba
4 changed files with 45 additions and 4 deletions
|
@ -177,6 +177,17 @@ func (x *XHeader) StableSize() (size int) {
|
|||
return size
|
||||
}
|
||||
|
||||
func (x *XHeader) Unmarshal(data []byte) error {
|
||||
m := new(session.XHeader)
|
||||
if err := goproto.Unmarshal(data, m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*x = *XHeaderFromGRPCMessage(m)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (l *TokenLifetime) StableMarshal(buf []byte) ([]byte, error) {
|
||||
if l == nil {
|
||||
return []byte{}, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue