forked from TrueCloudLab/frostfs-api-go
[#83] object: Regenerate protobufs for ECHeader
* Fix marshalers and converters; * Fix unit-tests. Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
parent
4fe42ac4ad
commit
0803bc6ded
5 changed files with 33 additions and 19 deletions
|
@ -270,7 +270,7 @@ func (h *ECHeader) ToGRPCMessage() grpc.Message {
|
|||
|
||||
m.Parent = h.Parent.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
m.ParentSplitId = h.ParentSplitID
|
||||
m.ParentSplitIndex = h.ParentSplitIndex
|
||||
m.ParentSplitParentId = h.ParentSplitParentID.ToGRPCMessage().(*refsGRPC.ObjectID)
|
||||
m.Index = h.Index
|
||||
m.Total = h.Total
|
||||
m.Header = h.Header
|
||||
|
@ -303,7 +303,21 @@ func (h *ECHeader) FromGRPCMessage(m grpc.Message) error {
|
|||
}
|
||||
|
||||
h.ParentSplitID = v.GetParentSplitId()
|
||||
h.ParentSplitIndex = v.GetParentSplitIndex()
|
||||
|
||||
parSplitParentID := v.GetParentSplitParentId()
|
||||
if parSplitParentID == nil {
|
||||
h.ParentSplitParentID = nil
|
||||
} else {
|
||||
if h.ParentSplitParentID == nil {
|
||||
h.ParentSplitParentID = new(refs.ObjectID)
|
||||
}
|
||||
|
||||
err = h.ParentSplitParentID.FromGRPCMessage(parSplitParentID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
h.Index = v.GetIndex()
|
||||
h.Total = v.GetTotal()
|
||||
h.Header = v.GetHeader()
|
||||
|
|
BIN
object/grpc/types.pb.go
generated
BIN
object/grpc/types.pb.go
generated
Binary file not shown.
|
@ -32,7 +32,7 @@ const (
|
|||
ecHdrHeaderLengthField = 4
|
||||
ecHdrHeaderField = 5
|
||||
ecHdrParentSplitID = 6
|
||||
ecHdrParentSplitIndex = 7
|
||||
ecHdrParentSplitParentID = 7
|
||||
|
||||
hdrVersionField = 1
|
||||
hdrContainerIDField = 2
|
||||
|
@ -264,7 +264,7 @@ 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.UInt32Marshal(ecHdrParentSplitIndex, buf[offset:], h.ParentSplitIndex)
|
||||
proto.NestedStructureMarshal(ecHdrParentSplitParentID, buf[offset:], h.ParentSplitParentID)
|
||||
return buf
|
||||
}
|
||||
|
||||
|
@ -279,7 +279,7 @@ func (h *ECHeader) StableSize() (size int) {
|
|||
size += proto.UInt32Size(ecHdrHeaderLengthField, h.HeaderLength)
|
||||
size += proto.BytesSize(ecHdrHeaderField, h.Header)
|
||||
size += proto.BytesSize(ecHdrParentSplitID, h.ParentSplitID)
|
||||
size += proto.UInt32Size(ecHdrParentSplitIndex, h.ParentSplitIndex)
|
||||
size += proto.NestedStructureSize(ecHdrParentSplitParentID, h.ParentSplitParentID)
|
||||
|
||||
return size
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ func GenerateECHeader(empty bool) *object.ECHeader {
|
|||
if !empty {
|
||||
ech.Parent = refstest.GenerateObjectID(empty)
|
||||
ech.ParentSplitID = []byte{1, 2, 3}
|
||||
ech.ParentSplitIndex = 1
|
||||
ech.ParentSplitParentID = refstest.GenerateObjectID(empty)
|
||||
ech.Index = 0
|
||||
ech.Total = 2
|
||||
ech.Header = []byte("chunk of ec-encoded parent header")
|
||||
|
|
|
@ -42,7 +42,7 @@ type SplitHeader struct {
|
|||
type ECHeader struct {
|
||||
Parent *refs.ObjectID
|
||||
ParentSplitID []byte
|
||||
ParentSplitIndex uint32
|
||||
ParentSplitParentID *refs.ObjectID
|
||||
Index uint32
|
||||
Total uint32
|
||||
Header []byte
|
||||
|
|
Loading…
Reference in a new issue