From 1fe7f7b2faf02483eed1a2f52bd1c57d7b410fe2 Mon Sep 17 00:00:00 2001 From: Evgeniy Kulikov Date: Wed, 5 Feb 2020 13:42:49 +0300 Subject: [PATCH] make object.GetRange to be server-side streaming RPC --- docs/object.md | 9 +- object/service.pb.go | 243 +++++++++++++++++++++++-------------------- object/service.proto | 11 +- 3 files changed, 143 insertions(+), 120 deletions(-) diff --git a/docs/object.md b/docs/object.md index dbdd6dc..997991a 100644 --- a/docs/object.md +++ b/docs/object.md @@ -64,7 +64,7 @@ rpc Put(stream PutRequest) returns (PutResponse); rpc Delete(DeleteRequest) returns (DeleteResponse); rpc Head(HeadRequest) returns (HeadResponse); rpc Search(SearchRequest) returns (stream SearchResponse); -rpc GetRange(GetRangeRequest) returns (GetRangeResponse); +rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); rpc GetRangeHash(GetRangeHashRequest) returns (GetRangeHashResponse); ``` @@ -119,8 +119,9 @@ package). | Search | [SearchRequest](#object.SearchRequest) | [SearchResponse](#object.SearchResponse) | #### Method GetRange -GetRange of data payload. Ranges are set of pairs (offset, length). -Fragments order in response corresponds to ranges order in request. +GetRange of data payload. Range is a pair (offset, length). +Requested range can be restored by concatenation of all chunks +keeping receiving order. | Name | Input | Output | | ---- | ----- | ------ | @@ -196,7 +197,7 @@ in distributed system. | Field | Type | Label | Description | | ----- | ---- | ----- | ----------- | | Address | [refs.Address](#refs.Address) | | Address of object (container id + object id) | -| Ranges | [Range](#object.Range) | repeated | Ranges of object's payload to return | +| Range | [Range](#object.Range) | | Range of object's payload to return | | Meta | [service.RequestMetaHeader](#service.RequestMetaHeader) | | RequestMetaHeader contains information about request meta headers (should be embedded into message) | | Verify | [service.RequestVerificationHeader](#service.RequestVerificationHeader) | | RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) | diff --git a/object/service.pb.go b/object/service.pb.go index 05e7c4b..0e40508 100644 --- a/object/service.pb.go +++ b/object/service.pb.go @@ -661,8 +661,8 @@ func (m *SearchResponse) GetAddresses() []refs.Address { type GetRangeRequest struct { // Address of object (container id + object id) Address refs.Address `protobuf:"bytes,1,opt,name=Address,proto3" json:"Address"` - // Ranges of object's payload to return - Ranges []Range `protobuf:"bytes,2,rep,name=Ranges,proto3" json:"Ranges"` + // Range of object's payload to return + Range Range `protobuf:"bytes,2,opt,name=Range,proto3" json:"Range"` // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader `protobuf:"bytes,98,opt,name=Meta,proto3,embedded=Meta" json:"Meta"` // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message) @@ -708,11 +708,11 @@ func (m *GetRangeRequest) GetAddress() refs.Address { return refs.Address{} } -func (m *GetRangeRequest) GetRanges() []Range { +func (m *GetRangeRequest) GetRange() Range { if m != nil { - return m.Ranges + return m.Range } - return nil + return Range{} } type GetRangeResponse struct { @@ -883,60 +883,61 @@ func init() { func init() { proto.RegisterFile("object/service.proto", fileDescriptor_dfcdf610ade6a9ce) } var fileDescriptor_dfcdf610ade6a9ce = []byte{ - // 846 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0x4d, 0x4f, 0x33, 0x55, - 0x14, 0xee, 0xed, 0x94, 0x01, 0x4e, 0xa7, 0xbc, 0xcd, 0xa5, 0xbe, 0x36, 0x23, 0x29, 0x64, 0x82, - 0xa6, 0xc6, 0x74, 0x5a, 0x31, 0x41, 0x8c, 0xb8, 0xb0, 0x6d, 0xa0, 0x2c, 0x0c, 0x78, 0x21, 0x24, - 0xba, 0x9b, 0x4e, 0x6f, 0xdb, 0x91, 0x32, 0x53, 0xe7, 0x03, 0xc2, 0x0f, 0x70, 0xed, 0xd6, 0x95, - 0xbf, 0xc4, 0x1f, 0xc0, 0xc6, 0x84, 0xa5, 0x71, 0x41, 0x4c, 0x5d, 0xbb, 0x37, 0x71, 0x63, 0xee, - 0xc7, 0x74, 0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0x1b, 0x03, 0x7a, 0xd5, - 0x74, 0xa9, 0x37, 0x0c, 0x1a, 0xd6, 0xd4, 0x69, 0x8a, 0x8a, 0x7d, 0x95, 0x7f, 0x89, 0x7e, 0xf0, - 0x67, 0x00, 0x00, 0x00, 0xff, 0xff, 0xee, 0x6d, 0x9e, 0x41, 0x3d, 0x0b, 0x00, 0x00, + // 859 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x56, 0xcd, 0x6e, 0xeb, 0x44, + 0x14, 0xce, 0xc4, 0x89, 0xdb, 0x9e, 0x38, 0xbd, 0xd1, 0x34, 0x5c, 0x22, 0x53, 0xa5, 0x95, 0x75, + 0x41, 0x41, 0x28, 0x4e, 0xb8, 0x48, 0xa5, 0x88, 0x4a, 0x88, 0x24, 0x6a, 0xd3, 0x05, 0x6a, 0x99, + 0x56, 0x95, 0x60, 0xe7, 0x38, 0x93, 0xc4, 0x34, 0xb5, 0x83, 0x7f, 0x5a, 0xf5, 0x01, 0x58, 0xb3, + 0x65, 0xc9, 0x83, 0xf0, 0x00, 0xdd, 0x20, 0x75, 0x89, 0x58, 0x54, 0x28, 0x2c, 0x79, 0x01, 0x24, + 0x36, 0x68, 0x7e, 0x1c, 0xdb, 0x2d, 0x2d, 0xd0, 0x4d, 0xee, 0x2a, 0x33, 0xdf, 0xf9, 0xce, 0x99, + 0x9c, 0xcf, 0xdf, 0x19, 0x1b, 0xaa, 0xde, 0xe0, 0x1b, 0x6a, 0x87, 0xad, 0x80, 0xfa, 0x97, 0x8e, + 0x4d, 0xcd, 0x99, 0xef, 0x85, 0x1e, 0x56, 0x05, 0xaa, 0x57, 0x7c, 0x3a, 0x0a, 0x5a, 0xe1, 0xf5, + 0x8c, 0x06, 0x22, 0xa2, 0x63, 0xc9, 0x4f, 0x63, 0x1b, 0x01, 0x0d, 0x02, 0xc7, 0x73, 0xb3, 0x44, + 0x59, 0xb1, 0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e, 0xfa, 0x46, 0x06, 0x13, 0x27, 0xb4, 0x11, 0xcb, 0x38, + 0x8e, 0x52, 0x19, 0xc9, 0x2b, 0x3a, 0xc9, 0x48, 0xbd, 0x9c, 0x1a, 0x08, 0x7f, 0x0c, 0xaa, 0xb8, + 0x5d, 0xf1, 0x5b, 0x31, 0x21, 0xf3, 0xfa, 0xd1, 0x5f, 0xde, 0x87, 0x17, 0x13, 0x54, 0x60, 0x12, + 0xe0, 0x45, 0xdd, 0xd4, 0x8d, 0xac, 0x57, 0xb3, 0xa0, 0x4c, 0xf9, 0x04, 0x54, 0x31, 0x86, 0xc9, + 0x59, 0x99, 0x0b, 0x29, 0x39, 0x2b, 0x3b, 0xad, 0x6d, 0x84, 0x3f, 0x83, 0xd5, 0x58, 0x54, 0xfc, + 0x76, 0xba, 0xf7, 0xd4, 0x34, 0xea, 0xb5, 0x87, 0x81, 0x45, 0x81, 0x43, 0xd0, 0xd2, 0x4f, 0x05, + 0xbf, 0x73, 0x9f, 0x9b, 0xb2, 0xac, 0xbe, 0xf9, 0xcf, 0x41, 0x51, 0xac, 0xf3, 0xe9, 0xcd, 0xbc, + 0x8e, 0x6e, 0xe7, 0x75, 0xf4, 0xcb, 0xbc, 0x8e, 0x7e, 0x9b, 0xd7, 0xd1, 0x0f, 0xbf, 0xd7, 0x73, + 0x5f, 0xbf, 0x9b, 0xfa, 0x14, 0x75, 0x83, 0x99, 0x6d, 0x37, 0x87, 0xf4, 0xb2, 0xe5, 0x52, 0x6f, + 0x14, 0x34, 0xad, 0x99, 0xd3, 0x12, 0x15, 0x07, 0x2a, 0xff, 0x12, 0xfd, 0xe8, 0xef, 0x00, 0x00, + 0x00, 0xff, 0xff, 0x46, 0xff, 0x20, 0xe9, 0x3d, 0x0b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -974,9 +975,10 @@ type ServiceClient interface { // set to 1. Search query represented in serialized format (see query // package). Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (Service_SearchClient, error) - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -1108,13 +1110,36 @@ func (x *serviceSearchClient) Recv() (*SearchResponse, error) { return m, nil } -func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (*GetRangeResponse, error) { - out := new(GetRangeResponse) - err := c.cc.Invoke(ctx, "/object.Service/GetRange", in, out, opts...) +func (c *serviceClient) GetRange(ctx context.Context, in *GetRangeRequest, opts ...grpc.CallOption) (Service_GetRangeClient, error) { + stream, err := c.cc.NewStream(ctx, &_Service_serviceDesc.Streams[3], "/object.Service/GetRange", opts...) if err != nil { return nil, err } - return out, nil + x := &serviceGetRangeClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Service_GetRangeClient interface { + Recv() (*GetRangeResponse, error) + grpc.ClientStream +} + +type serviceGetRangeClient struct { + grpc.ClientStream +} + +func (x *serviceGetRangeClient) Recv() (*GetRangeResponse, error) { + m := new(GetRangeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil } func (c *serviceClient) GetRangeHash(ctx context.Context, in *GetRangeHashRequest, opts ...grpc.CallOption) (*GetRangeHashResponse, error) { @@ -1151,9 +1176,10 @@ type ServiceServer interface { // set to 1. Search query represented in serialized format (see query // package). Search(*SearchRequest, Service_SearchServer) error - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - GetRange(context.Context, *GetRangeRequest) (*GetRangeResponse, error) + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + GetRange(*GetRangeRequest, Service_GetRangeServer) error // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in // response corresponds to ranges order in request. Homomorphic hash is @@ -1180,8 +1206,8 @@ func (*UnimplementedServiceServer) Head(ctx context.Context, req *HeadRequest) ( func (*UnimplementedServiceServer) Search(req *SearchRequest, srv Service_SearchServer) error { return status.Errorf(codes.Unimplemented, "method Search not implemented") } -func (*UnimplementedServiceServer) GetRange(ctx context.Context, req *GetRangeRequest) (*GetRangeResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetRange not implemented") +func (*UnimplementedServiceServer) GetRange(req *GetRangeRequest, srv Service_GetRangeServer) error { + return status.Errorf(codes.Unimplemented, "method GetRange not implemented") } func (*UnimplementedServiceServer) GetRangeHash(ctx context.Context, req *GetRangeHashRequest) (*GetRangeHashResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method GetRangeHash not implemented") @@ -1295,22 +1321,25 @@ func (x *serviceSearchServer) Send(m *SearchResponse) error { return x.ServerStream.SendMsg(m) } -func _Service_GetRange_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetRangeRequest) - if err := dec(in); err != nil { - return nil, err +func _Service_GetRange_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(GetRangeRequest) + if err := stream.RecvMsg(m); err != nil { + return err } - if interceptor == nil { - return srv.(ServiceServer).GetRange(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/object.Service/GetRange", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ServiceServer).GetRange(ctx, req.(*GetRangeRequest)) - } - return interceptor(ctx, in, info, handler) + return srv.(ServiceServer).GetRange(m, &serviceGetRangeServer{stream}) +} + +type Service_GetRangeServer interface { + Send(*GetRangeResponse) error + grpc.ServerStream +} + +type serviceGetRangeServer struct { + grpc.ServerStream +} + +func (x *serviceGetRangeServer) Send(m *GetRangeResponse) error { + return x.ServerStream.SendMsg(m) } func _Service_GetRangeHash_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { @@ -1343,10 +1372,6 @@ var _Service_serviceDesc = grpc.ServiceDesc{ MethodName: "Head", Handler: _Service_Head_Handler, }, - { - MethodName: "GetRange", - Handler: _Service_GetRange_Handler, - }, { MethodName: "GetRangeHash", Handler: _Service_GetRangeHash_Handler, @@ -1368,6 +1393,11 @@ var _Service_serviceDesc = grpc.ServiceDesc{ Handler: _Service_Search_Handler, ServerStreams: true, }, + { + StreamName: "GetRange", + Handler: _Service_GetRange_Handler, + ServerStreams: true, + }, }, Metadata: "object/service.proto", } @@ -2093,20 +2123,16 @@ func (m *GetRangeRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x6 i-- dAtA[i] = 0x92 - if len(m.Ranges) > 0 { - for iNdEx := len(m.Ranges) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Ranges[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintService(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 + { + size, err := m.Range.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } + i -= size + i = encodeVarintService(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 { size, err := m.Address.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -2554,12 +2580,8 @@ func (m *GetRangeRequest) Size() (n int) { _ = l l = m.Address.Size() n += 1 + l + sovService(uint64(l)) - if len(m.Ranges) > 0 { - for _, e := range m.Ranges { - l = e.Size() - n += 1 + l + sovService(uint64(l)) - } - } + l = m.Range.Size() + n += 1 + l + sovService(uint64(l)) l = m.RequestMetaHeader.Size() n += 2 + l + sovService(uint64(l)) l = m.RequestVerificationHeader.Size() @@ -4253,7 +4275,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ranges", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Range", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4280,8 +4302,7 @@ func (m *GetRangeRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Ranges = append(m.Ranges, Range{}) - if err := m.Ranges[len(m.Ranges)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.Range.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/object/service.proto b/object/service.proto index 4487a49..fb80e5d 100644 --- a/object/service.proto +++ b/object/service.proto @@ -42,9 +42,10 @@ service Service { // package). rpc Search(SearchRequest) returns (stream SearchResponse); - // GetRange of data payload. Ranges are set of pairs (offset, length). - // Fragments order in response corresponds to ranges order in request. - rpc GetRange(GetRangeRequest) returns (GetRangeResponse); + // GetRange of data payload. Range is a pair (offset, length). + // Requested range can be restored by concatenation of all chunks + // keeping receiving order. + rpc GetRange(GetRangeRequest) returns (stream GetRangeResponse); // GetRangeHash returns homomorphic hash of object payload range after XOR // operation. Ranges are set of pairs (offset, length). Hashes order in @@ -153,8 +154,8 @@ message SearchResponse { message GetRangeRequest { // Address of object (container id + object id) refs.Address Address = 1 [(gogoproto.nullable) = false]; - // Ranges of object's payload to return - repeated Range Ranges = 2 [(gogoproto.nullable) = false]; + // Range of object's payload to return + Range Range = 2 [(gogoproto.nullable) = false]; // RequestMetaHeader contains information about request meta headers (should be embedded into message) service.RequestMetaHeader Meta = 98 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; // RequestVerificationHeader is a set of signatures of every NeoFS Node that processed request (should be embedded into message)