[#79] object: Implement Range\RangeHash requests for EC object
All checks were successful
DCO action / DCO (pull_request) Successful in 1m16s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m37s
Tests and linters / Lint (pull_request) Successful in 1m56s
Tests and linters / Tests (1.19) (pull_request) Successful in 2m9s
Tests and linters / Tests with -race (pull_request) Successful in 2m2s

Signed-off-by: Anton Nikiforov <an.nikiforov@yadro.com>
This commit is contained in:
Anton Nikiforov 2024-04-27 23:03:26 +03:00
parent df9b65324a
commit 67c6f305b2
3 changed files with 24 additions and 0 deletions

View file

@ -1962,6 +1962,8 @@ func (r *GetRangeResponseBody) ToGRPCMessage() grpc.Message {
m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk)) m.SetChunk(v.ToGRPCMessage().(*object.GetRangeResponse_Body_Chunk))
case *SplitInfo: case *SplitInfo:
m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo)) m.SetSplitInfo(v.ToGRPCMessage().(*object.SplitInfo))
case *ECInfo:
m.SetECInfo(v.ToGRPCMessage().(*object.ECInfo))
default: default:
panic(fmt.Sprintf("unknown get range part %T", v)) panic(fmt.Sprintf("unknown get range part %T", v))
} }
@ -1994,6 +1996,12 @@ func (r *GetRangeResponseBody) FromGRPCMessage(m grpc.Message) error {
r.rngPart = partSplit r.rngPart = partSplit
err = partSplit.FromGRPCMessage(pt.SplitInfo) err = partSplit.FromGRPCMessage(pt.SplitInfo)
} }
case *object.GetRangeResponse_Body_EcInfo:
if pt != nil {
partEC := new(ECInfo)
r.rngPart = partEC
err = partEC.FromGRPCMessage(pt.EcInfo)
}
default: default:
err = fmt.Errorf("unknown get range part %T", pt) err = fmt.Errorf("unknown get range part %T", pt)
} }

View file

@ -435,6 +435,13 @@ func (m *GetRangeResponse_Body) SetSplitInfo(v *SplitInfo) {
} }
} }
// SetECInfo sets meta info about the erasure-coded object.
func (m *GetRangeResponse_Body) SetECInfo(v *ECInfo) {
m.RangePart = &GetRangeResponse_Body_EcInfo{
EcInfo: v,
}
}
// SetBody sets body of the response. // SetBody sets body of the response.
func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) { func (m *GetRangeResponse) SetBody(v *GetRangeResponse_Body) {
m.Body = v m.Body = v

View file

@ -117,6 +117,7 @@ const (
getRangeRespChunkField = 1 getRangeRespChunkField = 1
getRangeRespSplitInfoField = 2 getRangeRespSplitInfoField = 2
getRangeRespECInfoField = 3
getRangeHashReqBodyAddressField = 1 getRangeHashReqBodyAddressField = 1
getRangeHashReqBodyRangesField = 2 getRangeHashReqBodyRangesField = 2
@ -1110,6 +1111,10 @@ func (r *GetRangeResponseBody) StableMarshal(buf []byte) []byte {
if v != nil { if v != nil {
proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v) proto.NestedStructureMarshal(getRangeRespSplitInfoField, buf, v)
} }
case *ECInfo:
if v != nil {
proto.NestedStructureMarshal(getRangeRespECInfoField, buf, v)
}
default: default:
panic("unknown one of object get range request body type") panic("unknown one of object get range request body type")
} }
@ -1132,6 +1137,10 @@ func (r *GetRangeResponseBody) StableSize() (size int) {
if v != nil { if v != nil {
size = proto.NestedStructureSize(getRangeRespSplitInfoField, v) size = proto.NestedStructureSize(getRangeRespSplitInfoField, v)
} }
case *ECInfo:
if v != nil {
size = proto.NestedStructureSize(getRangeRespECInfoField, v)
}
default: default:
panic("unknown one of object get range request body type") panic("unknown one of object get range request body type")
} }