forked from TrueCloudLab/frostfs-api-go
[#84] object: Regenerate EC-header type
Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
0803bc6ded
commit
f0b01527c1
5 changed files with 15 additions and 1 deletions
|
@ -271,6 +271,7 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message {
|
||||||
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
|
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||||
m.ParentSplitId = h.ParentSplitID
|
m.ParentSplitId = h.ParentSplitID
|
||||||
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
|
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||||
|
m.ParentAttributes = AttributesToGRPC(h.ParentAttributes)
|
||||||
m.Index = h.Index
|
m.Index = h.Index
|
||||||
m.Total = h.Total
|
m.Total = h.Total
|
||||||
m.Header = h.Header
|
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.Index = v.GetIndex()
|
||||||
h.Total = v.GetTotal()
|
h.Total = v.GetTotal()
|
||||||
h.Header = v.GetHeader()
|
h.Header = v.GetHeader()
|
||||||
|
|
BIN
object/grpc/types.pb.go
generated
BIN
object/grpc/types.pb.go
generated
Binary file not shown.
|
@ -33,6 +33,7 @@ const (
|
||||||
ecHdrHeaderField = 5
|
ecHdrHeaderField = 5
|
||||||
ecHdrParentSplitID = 6
|
ecHdrParentSplitID = 6
|
||||||
ecHdrParentSplitParentID = 7
|
ecHdrParentSplitParentID = 7
|
||||||
|
ecHdrParentAttributes = 8
|
||||||
|
|
||||||
hdrVersionField = 1
|
hdrVersionField = 1
|
||||||
hdrContainerIDField = 2
|
hdrContainerIDField = 2
|
||||||
|
@ -264,7 +265,10 @@ func (h *ECHeader) StableMarshal(buf []byte) []byte {
|
||||||
offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength)
|
offset += proto.UInt32Marshal(ecHdrHeaderLengthField, buf[offset:], h.HeaderLength)
|
||||||
offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header)
|
offset += proto.BytesMarshal(ecHdrHeaderField, buf[offset:], h.Header)
|
||||||
offset += proto.BytesMarshal(ecHdrParentSplitID, buf[offset:], h.ParentSplitID)
|
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
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -280,6 +284,9 @@ func (h *ECHeader) StableSize() (size int) {
|
||||||
size += proto.BytesSize(ecHdrHeaderField, h.Header)
|
size += proto.BytesSize(ecHdrHeaderField, h.Header)
|
||||||
size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID)
|
size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID)
|
||||||
size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID)
|
size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID)
|
||||||
|
for i := range h.ParentAttributes {
|
||||||
|
size += proto.NestedStructureSize(ecHdrParentAttributes, &h.ParentAttributes[i])
|
||||||
|
}
|
||||||
|
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,7 @@ func GenerateECHeader(empty bool) *object.ECHeader {
|
||||||
ech.Parent = refstest.GenerateObjectID(empty)
|
ech.Parent = refstest.GenerateObjectID(empty)
|
||||||
ech.ParentSplitID = []byte{1, 2, 3}
|
ech.ParentSplitID = []byte{1, 2, 3}
|
||||||
ech.ParentSplitParentID = refstest.GenerateObjectID(empty)
|
ech.ParentSplitParentID = refstest.GenerateObjectID(empty)
|
||||||
|
ech.ParentAttributes = GenerateAttributes(empty)
|
||||||
ech.Index = 0
|
ech.Index = 0
|
||||||
ech.Total = 2
|
ech.Total = 2
|
||||||
ech.Header = []byte("chunk of ec-encoded parent header")
|
ech.Header = []byte("chunk of ec-encoded parent header")
|
||||||
|
|
|
@ -43,6 +43,7 @@ type ECHeader struct {
|
||||||
Parent *refs.ObjectID
|
Parent *refs.ObjectID
|
||||||
ParentSplitID []byte
|
ParentSplitID []byte
|
||||||
ParentSplitParentID *refs.ObjectID
|
ParentSplitParentID *refs.ObjectID
|
||||||
|
ParentAttributes []Attribute
|
||||||
Index uint32
|
Index uint32
|
||||||
Total uint32
|
Total uint32
|
||||||
Header []byte
|
Header []byte
|
||||||
|
|
Loading…
Reference in a new issue