[#53] session: refactor missed Marshal declarations

Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
Evgenii Stratonikov 2021-11-08 15:25:13 +03:00 committed by Alex Vanin
parent 7627f8376a
commit 49a24e4b3e
2 changed files with 4 additions and 16 deletions

View file

@ -115,12 +115,8 @@ func (x *ContainerContext) IsForSetEACL() bool {
} }
// Marshal marshals ContainerContext into a protobuf binary form. // Marshal marshals ContainerContext into a protobuf binary form.
func (x *ContainerContext) Marshal(bs ...[]byte) ([]byte, error) { func (x *ContainerContext) Marshal() ([]byte, error) {
var buf []byte return x.ToV2().StableMarshal(nil)
if len(bs) > 0 {
buf = bs[0]
}
return x.ToV2().StableMarshal(buf)
} }
// Unmarshal unmarshals protobuf binary representation of ContainerContext. // Unmarshal unmarshals protobuf binary representation of ContainerContext.

View file

@ -250,17 +250,9 @@ func GetContainerContext(t *Token) *ContainerContext {
} }
// Marshal marshals Token into a protobuf binary form. // Marshal marshals Token into a protobuf binary form.
// func (t *Token) Marshal() ([]byte, error) {
// Buffer is allocated when the argument is empty.
// Otherwise, the first buffer is used.
func (t *Token) Marshal(bs ...[]byte) ([]byte, error) {
var buf []byte
if len(bs) > 0 {
buf = bs[0]
}
return (*session.SessionToken)(t). return (*session.SessionToken)(t).
StableMarshal(buf) StableMarshal(nil)
} }
// Unmarshal unmarshals protobuf binary representation of Token. // Unmarshal unmarshals protobuf binary representation of Token.