yats.git

commit eaa349d1b78f92fe14049e16e9e9b13f0cc80975

Author: Paolo Lulli <paolo@lulli.net>

Moved protobuf source to yats-connectors

 protobuf/generate.sh | 15 ---------
 protobuf/yats-grpc.proto | 49 -----------------------------
 server/grpc/grpc_test.go | 2 -
 server/proto/yats-grpc.pb.go | 55 ++++++++++++++++----------------
 server/proto/yats-grpc_grpc.pb.go | 10 +++---


diff --git a/protobuf/generate.sh b/protobuf/generate.sh
deleted file mode 100755
index 9b3950b91d7711072f9d8704e352ce60037d7994..0000000000000000000000000000000000000000
--- a/protobuf/generate.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/bash -x
-
-
-cd $(dirname $0)
-TARGET_DIR="../server/proto/"
-
-SOURCES="yats-grpc.proto"
-
-for s in ${SOURCES}; do
-  protoc --go_out=${TARGET_DIR}\
-  --go_opt=paths=source_relative\
-  --go-grpc_out=${TARGET_DIR}\
-  --go-grpc_opt=paths=source_relative\
-  ${s}
-done




diff --git a/protobuf/yats-grpc.proto b/protobuf/yats-grpc.proto
deleted file mode 100644
index d1df430f9692585b9ababfa69391fdc2e1225ad9..0000000000000000000000000000000000000000
--- a/protobuf/yats-grpc.proto
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Yats - yats
- *
- * This file is licensed under the Affero General Public License version 3 or
- * later. See the COPYING file.
- *
- * @author Paolo Lulli <kevwe.com>
- * @copyright Paolo Lulli 2024
- */
-
-syntax = "proto3";
-
-package crud;
-
-option go_package = "yats/proto";
-
-message Metric {
-  string id_client = 1;
-  int64 mtime = 2;
-  string name = 3;
-  string value = 4;
-}
-
-message Event {
-  string id_client = 1;
-  int64 etime = 2;
-  string name = 3;
-}
-
-message CreateMetricRequest {
-  Metric metric = 1;
-}
-
-message CreateMetricResponse {
-  Metric metric = 1;
-}
-
-message CreateEventRequest {
-  Event event = 1;
-}
-
-message CreateEventResponse {
-  Event event = 1;
-}
-
-service YatsGrpcService {
-  rpc CreateMetric(CreateMetricRequest) returns (CreateMetricResponse);
-  rpc CreateEvent(CreateEventRequest) returns (CreateEventResponse);
-}




diff --git a/server/grpc/grpc_test.go b/server/grpc/grpc_test.go
index 4c3744a7d58b46be87ba147b3bcb4cdd0961f6ba..08b0672e6e565a4f46948f9f5146a13a189b24ec 100644
--- a/server/grpc/grpc_test.go
+++ b/server/grpc/grpc_test.go
@@ -20,7 +20,6 @@
 	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 	defer cancel()
 
-	// Create an item
 	item := &proto.Metric{IdClient: "DefaultIdClient", Name: "testMetric1", Mtime: time.Now().UnixMilli(), Value: "This is the value"}
 	res, err := c.CreateMetric(ctx, &proto.CreateMetricRequest{Metric: item})
 	if err != nil {
@@ -40,7 +39,6 @@
 	ctx, cancel := context.WithTimeout(context.Background(), time.Second)
 	defer cancel()
 
-	// Create an item
 	item := &proto.Event{IdClient: "DefaultIdClient", Name: "testEvent1", Etime: time.Now().UnixMilli()}
 	res, err := c.CreateEvent(ctx, &proto.CreateEventRequest{Event: item})
 	if err != nil {




diff --git a/server/proto/yats-grpc.pb.go b/server/proto/yats-grpc.pb.go
index 822507d2708d77ffcce1d0a8181451cf9dcc805a..cd1f73ce4f99c6c104ef0b799206b1d7d7a30483 100644
--- a/server/proto/yats-grpc.pb.go
+++ b/server/proto/yats-grpc.pb.go
@@ -355,7 +355,7 @@ var File_yats_grpc_proto protoreflect.FileDescriptor
 
 var file_yats_grpc_proto_rawDesc = []byte{
 	0x0a, 0x0f, 0x79, 0x61, 0x74, 0x73, 0x2d, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74,
-	0x6f, 0x12, 0x04, 0x63, 0x72, 0x75, 0x64, 0x22, 0x65, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69,
+	0x6f, 0x12, 0x04, 0x79, 0x61, 0x74, 0x73, 0x22, 0x65, 0x0a, 0x06, 0x4d, 0x65, 0x74, 0x72, 0x69,
 	0x63, 0x12, 0x1b, 0x0a, 0x09, 0x69, 0x64, 0x5f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x01,
 	0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x69, 0x64, 0x43, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x12, 0x14,
 	0x0a, 0x05, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d,
@@ -369,31 +369,32 @@ 	0x01, 0x28, 0x03, 0x52, 0x05, 0x65, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
 	0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x3b,
 	0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x65,
 	0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18,
-	0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x4d, 0x65, 0x74,
+	0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x74,
 	0x72, 0x69, 0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x22, 0x3c, 0x0a, 0x14, 0x43,
 	0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52, 0x65, 0x73, 0x70, 0x6f,
 	0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x18, 0x01, 0x20,
-	0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69,
+	0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69,
 	0x63, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x22, 0x37, 0x0a, 0x12, 0x43, 0x72, 0x65,
 	0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
 	0x21, 0x0a, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b,
-	0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65,
+	0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65,
 	0x6e, 0x74, 0x22, 0x38, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e,
 	0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x05, 0x65, 0x76, 0x65,
-	0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e,
+	0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e,
 	0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x32, 0x9c, 0x01, 0x0a,
 	0x0f, 0x59, 0x61, 0x74, 0x73, 0x47, 0x72, 0x70, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
 	0x12, 0x45, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63,
-	0x12, 0x19, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65,
-	0x74, 0x72, 0x69, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x63, 0x72,
-	0x75, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52,
+	0x12, 0x19, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65,
+	0x74, 0x72, 0x69, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x79, 0x61,
+	0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x52,
 	0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x42, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74,
-	0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x43, 0x72,
+	0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x12, 0x18, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72,
 	0x65, 0x61, 0x74, 0x65, 0x45, 0x76, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
-	0x1a, 0x19, 0x2e, 0x63, 0x72, 0x75, 0x64, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76,
-	0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x0c, 0x5a, 0x0a, 0x79,
-	0x61, 0x74, 0x73, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
-	0x33,
+	0x1a, 0x19, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x45, 0x76,
+	0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x27, 0x0a, 0x17, 0x63,
+	0x6f, 0x6d, 0x2e, 0x6b, 0x65, 0x76, 0x77, 0x65, 0x2e, 0x79, 0x61, 0x74, 0x73, 0x2e, 0x70, 0x72,
+	0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x50, 0x01, 0x5a, 0x0a, 0x79, 0x61, 0x74, 0x73, 0x2f, 0x70,
+	0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
 }
 
 var (
@@ -410,22 +411,22 @@ }
 
 var file_yats_grpc_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
 var file_yats_grpc_proto_goTypes = []interface{}{
-	(*Metric)(nil),               // 0: crud.Metric
-	(*Event)(nil),                // 1: crud.Event
-	(*CreateMetricRequest)(nil),  // 2: crud.CreateMetricRequest
-	(*CreateMetricResponse)(nil), // 3: crud.CreateMetricResponse
-	(*CreateEventRequest)(nil),   // 4: crud.CreateEventRequest
-	(*CreateEventResponse)(nil),  // 5: crud.CreateEventResponse
+	(*Metric)(nil),               // 0: yats.Metric
+	(*Event)(nil),                // 1: yats.Event
+	(*CreateMetricRequest)(nil),  // 2: yats.CreateMetricRequest
+	(*CreateMetricResponse)(nil), // 3: yats.CreateMetricResponse
+	(*CreateEventRequest)(nil),   // 4: yats.CreateEventRequest
+	(*CreateEventResponse)(nil),  // 5: yats.CreateEventResponse
 }
 var file_yats_grpc_proto_depIdxs = []int32{
-	0, // 0: crud.CreateMetricRequest.metric:type_name -> crud.Metric
-	0, // 1: crud.CreateMetricResponse.metric:type_name -> crud.Metric
-	1, // 2: crud.CreateEventRequest.event:type_name -> crud.Event
-	1, // 3: crud.CreateEventResponse.event:type_name -> crud.Event
-	2, // 4: crud.YatsGrpcService.CreateMetric:input_type -> crud.CreateMetricRequest
-	4, // 5: crud.YatsGrpcService.CreateEvent:input_type -> crud.CreateEventRequest
-	3, // 6: crud.YatsGrpcService.CreateMetric:output_type -> crud.CreateMetricResponse
-	5, // 7: crud.YatsGrpcService.CreateEvent:output_type -> crud.CreateEventResponse
+	0, // 0: yats.CreateMetricRequest.metric:type_name -> yats.Metric
+	0, // 1: yats.CreateMetricResponse.metric:type_name -> yats.Metric
+	1, // 2: yats.CreateEventRequest.event:type_name -> yats.Event
+	1, // 3: yats.CreateEventResponse.event:type_name -> yats.Event
+	2, // 4: yats.YatsGrpcService.CreateMetric:input_type -> yats.CreateMetricRequest
+	4, // 5: yats.YatsGrpcService.CreateEvent:input_type -> yats.CreateEventRequest
+	3, // 6: yats.YatsGrpcService.CreateMetric:output_type -> yats.CreateMetricResponse
+	5, // 7: yats.YatsGrpcService.CreateEvent:output_type -> yats.CreateEventResponse
 	6, // [6:8] is the sub-list for method output_type
 	4, // [4:6] is the sub-list for method input_type
 	4, // [4:4] is the sub-list for extension type_name




diff --git a/server/proto/yats-grpc_grpc.pb.go b/server/proto/yats-grpc_grpc.pb.go
index 565b23b922a8ea3e6e470ff6890e58134c9477b8..2a1516696f714b60e27db889d88e409a02f89abe 100644
--- a/server/proto/yats-grpc_grpc.pb.go
+++ b/server/proto/yats-grpc_grpc.pb.go
@@ -31,7 +31,7 @@ }
 
 func (c *yatsGrpcServiceClient) CreateMetric(ctx context.Context, in *CreateMetricRequest, opts ...grpc.CallOption) (*CreateMetricResponse, error) {
 	out := new(CreateMetricResponse)
-	err := c.cc.Invoke(ctx, "/crud.YatsGrpcService/CreateMetric", in, out, opts...)
+	err := c.cc.Invoke(ctx, "/yats.YatsGrpcService/CreateMetric", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -40,7 +40,7 @@ }
 
 func (c *yatsGrpcServiceClient) CreateEvent(ctx context.Context, in *CreateEventRequest, opts ...grpc.CallOption) (*CreateEventResponse, error) {
 	out := new(CreateEventResponse)
-	err := c.cc.Invoke(ctx, "/crud.YatsGrpcService/CreateEvent", in, out, opts...)
+	err := c.cc.Invoke(ctx, "/yats.YatsGrpcService/CreateEvent", in, out, opts...)
 	if err != nil {
 		return nil, err
 	}
@@ -89,7 +89,7 @@ 		return srv.(YatsGrpcServiceServer).CreateMetric(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/crud.YatsGrpcService/CreateMetric",
+		FullMethod: "/yats.YatsGrpcService/CreateMetric",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(YatsGrpcServiceServer).CreateMetric(ctx, req.(*CreateMetricRequest))
@@ -107,7 +107,7 @@ 		return srv.(YatsGrpcServiceServer).CreateEvent(ctx, in)
 	}
 	info := &grpc.UnaryServerInfo{
 		Server:     srv,
-		FullMethod: "/crud.YatsGrpcService/CreateEvent",
+		FullMethod: "/yats.YatsGrpcService/CreateEvent",
 	}
 	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
 		return srv.(YatsGrpcServiceServer).CreateEvent(ctx, req.(*CreateEventRequest))
@@ -116,7 +116,7 @@ 	return interceptor(ctx, in, info, handler)
 }
 
 var _YatsGrpcService_serviceDesc = grpc.ServiceDesc{
-	ServiceName: "crud.YatsGrpcService",
+	ServiceName: "yats.YatsGrpcService",
 	HandlerType: (*YatsGrpcServiceServer)(nil),
 	Methods: []grpc.MethodDesc{
 		{