From 2f6d3209e1d3087b480f85a252ea5c9970e68e8e Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Mon, 27 May 2024 12:13:49 +0300 Subject: [PATCH] [#84] object: Regenerate EC-header type Signed-off-by: Airat Arifullin --- object/convert.go | 5 +++++ object/grpc/types.pb.go | Bin 51762 -> 52660 bytes object/marshal.go | 9 ++++++++- object/test/generate.go | 1 + object/types.go | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) diff --git a/object/convert.go b/object/convert.go index 99047dc..6e8ecff 100644 --- a/object/convert.go +++ b/object/convert.go @@ -271,6 +271,7 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message { m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID) m.ParentSplitId = h.ParentSplitID m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID) + m.ParentAttributes = AttributesToGRPC(h.ParentAttributes) m.Index = h.Index m.Total = h.Total m.Header = h.Header @@ -318,6 +319,10 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error { } } + if h.ParentAttributes, err = AttributesFromGRPC(v.GetParentAttributes()); err != nil { + return err + } + h.Index = v.GetIndex() h.Total = v.GetTotal() h.Header = v.GetHeader() diff --git a/object/grpc/types.pb.go b/object/grpc/types.pb.go index 3cb44a3dc5c5cc4e35e99aa51b929af2f8cf9940..16736e9f599d66bbc646f79c817aa20229aed7de 100644 GIT binary patch delta 1156 zcmZWoOH30{6pcj+Gkj8hrF?{`QK34@bUL(!@CgcWp)r^cO?5$w6vb$1U{o|L2nre$ zrJfoB6ex&*_z7C0iK4hPaUm-g#)KGMm>54BjXQnsO+g}?$(;M{Ip>{s-+LI0c{Cg| zx8UB+6%`3Jy9B?d)$3CW+60fPwl+7MQoU_Ec&?UJt5!;=vSi?=kRm(9R)ko_M^i#TPBFq8jRr{J$m`>I4W4>mzU7pJL%|%#3ATP%IUOHLljIw8+z@EvfM( zvM5OHQbXi(ds&vw>xgW*9@eK@SygFbYa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ecHdrParentSplitParentID = 7 + ecHdrParentAttributes = 8 hdrVersionField = 1 hdrContainerIDField = 2 @@ -264,7 +265,10 @@ func (h *ECHeader) StableMarshal(buf []byte) []byte { offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength) offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header) offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID) - proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) + offset += proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID) + for i := range h.ParentAttributes { + offset += proto.NestedStructureMarshal(ecHdrParentAttributes, buf[offset:], &h.ParentAttributes[i]) + } return buf } @@ -280,6 +284,9 @@ func (h *ECHeader) StableSize() (size int) { size += proto.BytesSize(ecHdrHeaderField, h.Header) size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID) size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID) + for i := range h.ParentAttributes { + size += proto.NestedStructureSize(ecHdrParentAttributes, &h.ParentAttributes[i]) + } return size } diff --git a/object/test/generate.go b/object/test/generate.go index 95c76e5..b1931fc 100644 --- a/object/test/generate.go +++ b/object/test/generate.go @@ -93,6 +93,7 @@ func GenerateECHeader(empty bool) *object.ECHeader { ech.Parent = refstest.GenerateObjectID(empty) ech.ParentSplitID = []byte{1, 2, 3} ech.ParentSplitParentID = refstest.GenerateObjectID(empty) + ech.ParentAttributes = GenerateAttributes(empty) ech.Index = 0 ech.Total = 2 ech.Header = []byte("chunk of ec-encoded parent header") diff --git a/object/types.go b/object/types.go index 7916b1e..43caf80 100644 --- a/object/types.go +++ b/object/types.go @@ -43,6 +43,7 @@ type ECHeader struct { Parent *refs.ObjectID ParentSplitID []byte ParentSplitParentID *refs.ObjectID + ParentAttributes []Attribute Index uint32 Total uint32 Header []byte