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