Procházet zdrojové kódy

add request data field

sainw před 3 roky
rodič
revize
2514e5277e
3 změnil soubory, kde provedl 86 přidání a 33 odebrání
  1. 48 33
      data.pb.go
  2. 2 0
      data.proto
  3. 36 0
      data_grpc.pb.go

+ 48 - 33
data.pb.go

@@ -77,6 +77,7 @@ type DataRequest struct {
 
 	Object       string                 `protobuf:"bytes,1,opt,name=object,proto3" json:"object,omitempty"`
 	UpdatedAfter *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=updated_after,json=updatedAfter,proto3" json:"updated_after,omitempty"`
+	Data         string                 `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"`
 }
 
 func (x *DataRequest) Reset() {
@@ -125,6 +126,13 @@ func (x *DataRequest) GetUpdatedAfter() *timestamppb.Timestamp {
 	return nil
 }
 
+func (x *DataRequest) GetData() string {
+	if x != nil {
+		return x.Data
+	}
+	return ""
+}
+
 type DataReply struct {
 	state         protoimpl.MessageState
 	sizeCache     protoimpl.SizeCache
@@ -202,40 +210,45 @@ var file_data_proto_rawDesc = []byte{
 	0x0a, 0x0a, 0x64, 0x61, 0x74, 0x61, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x03, 0x66, 0x68,
 	0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
 	0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f,
-	0x74, 0x6f, 0x22, 0x66, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+	0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
 	0x74, 0x12, 0x16, 0x0a, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28,
 	0x09, 0x52, 0x06, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x12, 0x3f, 0x0a, 0x0d, 0x75, 0x70, 0x64,
 	0x61, 0x74, 0x65, 0x64, 0x5f, 0x61, 0x66, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
 	0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
 	0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x0c, 0x75, 0x70,
-	0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x66, 0x74, 0x65, 0x72, 0x22, 0x88, 0x02, 0x0a, 0x09, 0x44,
-	0x61, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61,
-	0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x3d, 0x0a, 0x0c,
-	0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01,
-	0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x70,
-	0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0b,
-	0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x65,
-	0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
-	0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x4a, 0x0a, 0x13, 0x6c, 0x61, 0x74, 0x65,
-	0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18,
-	0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70,
-	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
-	0x70, 0x52, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64,
-	0x54, 0x69, 0x6d, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61,
-	0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x43, 0x48, 0x45, 0x44, 0x55, 0x4c, 0x45, 0x5f,
-	0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44,
-	0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52,
-	0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0x70, 0x0a, 0x0b, 0x44, 0x61, 0x74, 0x61, 0x53, 0x65, 0x72,
-	0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x44, 0x61, 0x74, 0x61, 0x12,
-	0x10, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
-	0x74, 0x1a, 0x0e, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c,
-	0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x44, 0x61, 0x74,
-	0x61, 0x12, 0x10, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75,
-	0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65,
-	0x70, 0x6c, 0x79, 0x22, 0x00, 0x30, 0x01, 0x42, 0x2a, 0x50, 0x01, 0x5a, 0x26, 0x67, 0x69, 0x74,
-	0x2e, 0x6d, 0x6f, 0x6b, 0x6b, 0x6f, 0x6e, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x61, 0x69, 0x6e,
-	0x77, 0x2f, 0x66, 0x68, 0x6f, 0x5f, 0x66, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, 0x5f, 0x70, 0x72,
-	0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+	0x64, 0x61, 0x74, 0x65, 0x64, 0x41, 0x66, 0x74, 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61,
+	0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x88,
+	0x02, 0x0a, 0x09, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x12, 0x12, 0x0a, 0x04,
+	0x64, 0x61, 0x74, 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61,
+	0x12, 0x3d, 0x0a, 0x0c, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
+	0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74,
+	0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x2e, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74,
+	0x75, 0x73, 0x52, 0x0b, 0x72, 0x65, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12,
+	0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01,
+	0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x12, 0x4a, 0x0a, 0x13,
+	0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74,
+	0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67,
+	0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65,
+	0x73, 0x74, 0x61, 0x6d, 0x70, 0x52, 0x11, 0x6c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x55, 0x70, 0x64,
+	0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x22, 0x3f, 0x0a, 0x0b, 0x52, 0x65, 0x70, 0x6c,
+	0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1d, 0x0a, 0x19, 0x53, 0x43, 0x48, 0x45, 0x44,
+	0x55, 0x4c, 0x45, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49,
+	0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, 0x06, 0x0a, 0x02, 0x4f, 0x4b, 0x10, 0x01, 0x12, 0x09,
+	0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x02, 0x32, 0xa2, 0x01, 0x0a, 0x0b, 0x44, 0x61,
+	0x74, 0x61, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2d, 0x0a, 0x07, 0x47, 0x65, 0x74,
+	0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52,
+	0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74,
+	0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x12, 0x32, 0x0a, 0x0a, 0x53, 0x74, 0x72, 0x65,
+	0x61, 0x6d, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74,
+	0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x66, 0x68, 0x6f, 0x2e, 0x44,
+	0x61, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x30, 0x01, 0x12, 0x30, 0x0a, 0x0a,
+	0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x61, 0x74, 0x61, 0x12, 0x10, 0x2e, 0x66, 0x68, 0x6f,
+	0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x66,
+	0x68, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x70, 0x6c, 0x79, 0x22, 0x00, 0x42, 0x2a,
+	0x50, 0x01, 0x5a, 0x26, 0x67, 0x69, 0x74, 0x2e, 0x6d, 0x6f, 0x6b, 0x6b, 0x6f, 0x6e, 0x2e, 0x63,
+	0x6f, 0x6d, 0x2f, 0x73, 0x61, 0x69, 0x6e, 0x77, 0x2f, 0x66, 0x68, 0x6f, 0x5f, 0x66, 0x6f, 0x72,
+	0x77, 0x61, 0x72, 0x64, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
+	0x6f, 0x33,
 }
 
 var (
@@ -264,10 +277,12 @@ var file_data_proto_depIdxs = []int32{
 	3, // 2: fho.DataReply.latest_updated_time:type_name -> google.protobuf.Timestamp
 	1, // 3: fho.DataService.GetData:input_type -> fho.DataRequest
 	1, // 4: fho.DataService.StreamData:input_type -> fho.DataRequest
-	2, // 5: fho.DataService.GetData:output_type -> fho.DataReply
-	2, // 6: fho.DataService.StreamData:output_type -> fho.DataReply
-	5, // [5:7] is the sub-list for method output_type
-	3, // [3:5] is the sub-list for method input_type
+	1, // 5: fho.DataService.UpdateData:input_type -> fho.DataRequest
+	2, // 6: fho.DataService.GetData:output_type -> fho.DataReply
+	2, // 7: fho.DataService.StreamData:output_type -> fho.DataReply
+	2, // 8: fho.DataService.UpdateData:output_type -> fho.DataReply
+	6, // [6:9] is the sub-list for method output_type
+	3, // [3:6] is the sub-list for method input_type
 	3, // [3:3] is the sub-list for extension type_name
 	3, // [3:3] is the sub-list for extension extendee
 	0, // [0:3] is the sub-list for field type_name

+ 2 - 0
data.proto

@@ -9,11 +9,13 @@ import "google/protobuf/timestamp.proto";
 service DataService {
   rpc GetData(DataRequest) returns (DataReply) {}
   rpc StreamData(DataRequest) returns (stream DataReply) {}
+  rpc UpdateData(DataRequest) returns (DataReply) {}
 }
 
 message DataRequest {
   string object =1;
   google.protobuf.Timestamp updated_after = 2;
+  string data = 3;
 }
 
 message DataReply {

+ 36 - 0
data_grpc.pb.go

@@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7
 type DataServiceClient interface {
 	GetData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataReply, error)
 	StreamData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (DataService_StreamDataClient, error)
+	UpdateData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataReply, error)
 }
 
 type dataServiceClient struct {
@@ -71,12 +72,22 @@ func (x *dataServiceStreamDataClient) Recv() (*DataReply, error) {
 	return m, nil
 }
 
+func (c *dataServiceClient) UpdateData(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataReply, error) {
+	out := new(DataReply)
+	err := c.cc.Invoke(ctx, "/fho.DataService/UpdateData", in, out, opts...)
+	if err != nil {
+		return nil, err
+	}
+	return out, nil
+}
+
 // DataServiceServer is the server API for DataService service.
 // All implementations must embed UnimplementedDataServiceServer
 // for forward compatibility
 type DataServiceServer interface {
 	GetData(context.Context, *DataRequest) (*DataReply, error)
 	StreamData(*DataRequest, DataService_StreamDataServer) error
+	UpdateData(context.Context, *DataRequest) (*DataReply, error)
 	mustEmbedUnimplementedDataServiceServer()
 }
 
@@ -90,6 +101,9 @@ func (UnimplementedDataServiceServer) GetData(context.Context, *DataRequest) (*D
 func (UnimplementedDataServiceServer) StreamData(*DataRequest, DataService_StreamDataServer) error {
 	return status.Errorf(codes.Unimplemented, "method StreamData not implemented")
 }
+func (UnimplementedDataServiceServer) UpdateData(context.Context, *DataRequest) (*DataReply, error) {
+	return nil, status.Errorf(codes.Unimplemented, "method UpdateData not implemented")
+}
 func (UnimplementedDataServiceServer) mustEmbedUnimplementedDataServiceServer() {}
 
 // UnsafeDataServiceServer may be embedded to opt out of forward compatibility for this service.
@@ -142,6 +156,24 @@ func (x *dataServiceStreamDataServer) Send(m *DataReply) error {
 	return x.ServerStream.SendMsg(m)
 }
 
+func _DataService_UpdateData_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+	in := new(DataRequest)
+	if err := dec(in); err != nil {
+		return nil, err
+	}
+	if interceptor == nil {
+		return srv.(DataServiceServer).UpdateData(ctx, in)
+	}
+	info := &grpc.UnaryServerInfo{
+		Server:     srv,
+		FullMethod: "/fho.DataService/UpdateData",
+	}
+	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+		return srv.(DataServiceServer).UpdateData(ctx, req.(*DataRequest))
+	}
+	return interceptor(ctx, in, info, handler)
+}
+
 // DataService_ServiceDesc is the grpc.ServiceDesc for DataService service.
 // It's only intended for direct use with grpc.RegisterService,
 // and not to be introspected or modified (even as a copy)
@@ -153,6 +185,10 @@ var DataService_ServiceDesc = grpc.ServiceDesc{
 			MethodName: "GetData",
 			Handler:    _DataService_GetData_Handler,
 		},
+		{
+			MethodName: "UpdateData",
+			Handler:    _DataService_UpdateData_Handler,
+		},
 	},
 	Streams: []grpc.StreamDesc{
 		{