forked from TrueCloudLab/frostfs-api-go
[#50] util: Use protowire for util/proto helpers
* Use methods to calculate size Signed-off-by: Airat Arifullin a.arifullin@yadro.com
This commit is contained in:
parent
67b18d3550
commit
9a7b47d769
2 changed files with 26 additions and 50 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
refs "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/refs/grpc"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/message"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/util/proto"
|
||||
"google.golang.org/protobuf/encoding/protowire"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -116,7 +117,7 @@ func (o *ObjectID) StableSize() int {
|
|||
// ObjectIDNestedListMarshal writes protobuf repeated ObjectID field
|
||||
// with fNum number to buf.
|
||||
func ObjectIDNestedListMarshal(fNum int64, buf []byte, ids []ObjectID) (off int) {
|
||||
prefix, _ := proto.NestedStructurePrefix(fNum)
|
||||
prefix := protowire.EncodeTag(protowire.Number(fNum), protowire.BytesType)
|
||||
for i := range ids {
|
||||
off += binary.PutUvarint(buf[off:], prefix)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue