diff --git a/object/convert.go b/object/convert.go index 99047dc5..6e8ecffe 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 3cb44a3d..16736e9f 100644 Binary files a/object/grpc/types.pb.go and b/object/grpc/types.pb.go differ diff --git a/object/marshal.go b/object/marshal.go index bf8fcb97..f96b098e 100644 --- a/object/marshal.go +++ b/object/marshal.go @@ -33,6 +33,7 @@ const ( ecHdrHeaderField = 5 ecHdrParentSplitID = 6 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 95c76e52..b1931fc7 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 7916b1e0..43caf80c 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