forked from TrueCloudLab/frostfs-api-go
[#168] refs: Implement binary/JSON encoders/decoders on ContainerID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
7289ff6c64
commit
c0f3ac51d4
6 changed files with 103 additions and 4 deletions
|
@ -76,6 +76,17 @@ func (c *ContainerID) StableSize() int {
|
|||
return proto.BytesSize(containerIDValField, c.val)
|
||||
}
|
||||
|
||||
func (c *ContainerID) Unmarshal(data []byte) error {
|
||||
m := new(refs.ContainerID)
|
||||
if err := goproto.Unmarshal(data, m); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
*c = *ContainerIDFromGRPCMessage(m)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (o *ObjectID) StableMarshal(buf []byte) ([]byte, error) {
|
||||
if o == nil {
|
||||
return []byte{}, nil
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue