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