diff --git a/object/grpc/service.go b/object/grpc/service.go index 74dc168b..44b5f4a5 100644 --- a/object/grpc/service.go +++ b/object/grpc/service.go @@ -109,7 +109,7 @@ func (m *PutRequest_Body_Init) SetHeader(v *Header) { } // SetCopiesNumber sets number of the copies to save. -func (m *PutRequest_Body_Init) SetCopiesNumber(v []uint32) { +func (m *PutRequest_Body_Init) SetCopiesNumber(v uint32) { m.CopiesNumber = v } diff --git a/object/grpc/service.pb.go b/object/grpc/service.pb.go index 6ba4090c..207b0b08 100644 Binary files a/object/grpc/service.pb.go and b/object/grpc/service.pb.go differ diff --git a/object/marshal.go b/object/marshal.go index 7a89b97b..b918e698 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -516,7 +516,7 @@ func (r *PutObjectPartInit) StableMarshal(buf []byte) []byte { offset += proto.NestedStructureMarshal(putReqInitObjectIDField, buf[offset:], r.id) offset += proto.NestedStructureMarshal(putReqInitSignatureField, buf[offset:], r.sig) offset += proto.NestedStructureMarshal(putReqInitHeaderField, buf[offset:], r.hdr) - proto.RepeatedUInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) + proto.UInt32Marshal(putReqInitCopiesNumField, buf[offset:], r.copyNum) return buf } @@ -529,9 +529,7 @@ func (r *PutObjectPartInit) StableSize() (size int) { size += proto.NestedStructureSize(putReqInitObjectIDField, r.id) size += proto.NestedStructureSize(putReqInitSignatureField, r.sig) size += proto.NestedStructureSize(putReqInitHeaderField, r.hdr) - - arrSize, _ := proto.RepeatedUInt32Size(putReqInitCopiesNumField, r.copyNum) - size += arrSize + size += proto.UInt32Size(putReqInitCopiesNumField, r.copyNum) return size } diff --git a/object/test/generate.go b/object/test/generate.go index 32d7a3cb..0816ffc5 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -216,7 +216,7 @@ func GeneratePutObjectPartInit(empty bool) *object.PutObjectPartInit { m := new(object.PutObjectPartInit) if !empty { - m.SetCopiesNumber([]uint32{234}) + m.SetCopiesNumber(234) m.SetObjectID(refstest.GenerateObjectID(false)) } diff --git a/object/types.go b/object/types.go index a40de57d..f076b74e 100644 --- a/object/types.go +++ b/object/types.go @@ -128,7 +128,7 @@ type PutObjectPartInit struct { hdr *Header - copyNum []uint32 + copyNum uint32 } type PutObjectPartChunk struct { @@ -894,15 +894,15 @@ func (r *PutObjectPartInit) SetHeader(v *Header) { r.hdr = v } -func (r *PutObjectPartInit) GetCopiesNumber() []uint32 { +func (r *PutObjectPartInit) GetCopiesNumber() uint32 { if r != nil { return r.copyNum } - return nil + return 0 } -func (r *PutObjectPartInit) SetCopiesNumber(v []uint32) { +func (r *PutObjectPartInit) SetCopiesNumber(v uint32) { r.copyNum = v }