From 259b46f3848a93d5c4ce10aebce309399a806145 Mon Sep 17 00:00:00 2001 From: "loveckiy.ivan" Date: Sun, 9 Nov 2025 12:11:15 +0300 Subject: [PATCH] [dev] regen --- Makefile | 20 +++++++++++++++ README.md | 13 +++++++++- v1/plugin.pb.go | 59 ++++++++++++++++++++++---------------------- v1/plugin.proto | 2 +- v1/plugin_grpc.pb.go | 10 ++++---- 5 files changed, 67 insertions(+), 37 deletions(-) create mode 100644 Makefile mode change 100644 => 100755 README.md diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..1cc0916 --- /dev/null +++ b/Makefile @@ -0,0 +1,20 @@ +# calculate current dir +ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) + +docker_gen: + docker run --rm -v ${PWD}/proto/v1:/defs namely/protoc-all:1.51_2 -l go -d . -o . + +# generate connectors for go and ts, docs, lint, validate from proto files +# build and push new version: +# make bp name=pb_builder version=pb_builder-0.0.1 +regen: + cd ./v1 && \ + protoc --go_out=./ --go_opt=paths=source_relative --go-grpc_out=./ --go-grpc_opt=paths=source_relative ./plugin.proto + +#docker build \ +# --file $(ROOT_DIR)/build/sdk.dockerfile \ +# --tag sdk:latest $(ROOT_DIR) && \ +# docker run \ +# --rm \ +# --volume $(ROOT_DIR)/sdk:/root/sdk \ +# --name sdk_1 sdk:latest diff --git a/README.md b/README.md old mode 100644 new mode 100755 index 73b471f..7c8cd7b --- a/README.md +++ b/README.md @@ -1,2 +1,13 @@ -# proto +# SDK + Simple Service +## Описание + +Предназначен для взаимодействия с внешними сервисами расширения. + +## Генерация протофайла +Выполняем в терминале: +```shell +make regen +``` + +Cгенерированные файлы находятся в директории `v1`. diff --git a/v1/plugin.pb.go b/v1/plugin.pb.go index 60ff584..178b300 100644 --- a/v1/plugin.pb.go +++ b/v1/plugin.pb.go @@ -226,28 +226,27 @@ func (x *ServicesOut) GetList() []string { var File_plugin_proto protoreflect.FileDescriptor var file_plugin_proto_rawDesc = []byte{ - 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x09, - 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x22, 0x52, 0x0a, 0x06, 0x45, 0x78, 0x65, - 0x63, 0x49, 0x6e, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, - 0x06, 0x6d, 0x65, 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, - 0x65, 0x74, 0x68, 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x31, 0x0a, - 0x07, 0x45, 0x78, 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, - 0x6c, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, - 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, - 0x22, 0x0c, 0x0a, 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x49, 0x6e, 0x22, 0x21, - 0x0a, 0x0b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x12, 0x0a, - 0x04, 0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x73, - 0x74, 0x32, 0x75, 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x2d, - 0x0a, 0x04, 0x45, 0x78, 0x65, 0x63, 0x12, 0x11, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, - 0x6f, 0x72, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x49, 0x6e, 0x1a, 0x12, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x45, 0x78, 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x39, 0x0a, - 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x12, 0x15, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, - 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x49, 0x6e, - 0x1a, 0x16, 0x2e, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x0a, 0x0c, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, + 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x22, 0x52, 0x0a, 0x06, 0x45, 0x78, 0x65, 0x63, 0x49, 0x6e, + 0x12, 0x18, 0x0a, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x65, + 0x74, 0x68, 0x6f, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x65, 0x74, 0x68, + 0x6f, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x31, 0x0a, 0x07, 0x45, 0x78, + 0x65, 0x63, 0x4f, 0x75, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x22, 0x0c, 0x0a, + 0x0a, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x49, 0x6e, 0x22, 0x21, 0x0a, 0x0b, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x32, 0x69, + 0x0a, 0x09, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x12, 0x27, 0x0a, 0x04, 0x45, + 0x78, 0x65, 0x63, 0x12, 0x0e, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, + 0x63, 0x49, 0x6e, 0x1a, 0x0f, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x45, 0x78, 0x65, + 0x63, 0x4f, 0x75, 0x74, 0x12, 0x33, 0x0a, 0x08, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, + 0x12, 0x12, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x73, 0x49, 0x6e, 0x1a, 0x13, 0x2e, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x2e, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x4f, 0x75, 0x74, 0x42, 0x03, 0x5a, 0x01, 0x2e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -264,16 +263,16 @@ func file_plugin_proto_rawDescGZIP() []byte { var file_plugin_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_plugin_proto_goTypes = []interface{}{ - (*ExecIn)(nil), // 0: simple_plugin.ExecIn - (*ExecOut)(nil), // 1: simple_plugin.ExecOut - (*ServicesIn)(nil), // 2: simple_plugin.ServicesIn - (*ServicesOut)(nil), // 3: simple_plugin.ServicesOut + (*ExecIn)(nil), // 0: plugin.ExecIn + (*ExecOut)(nil), // 1: plugin.ExecOut + (*ServicesIn)(nil), // 2: plugin.ServicesIn + (*ServicesOut)(nil), // 3: plugin.ServicesOut } var file_plugin_proto_depIdxs = []int32{ - 0, // 0: simple_plugin.Collector.Exec:input_type -> simple_plugin.ExecIn - 2, // 1: simple_plugin.Collector.Services:input_type -> simple_plugin.ServicesIn - 1, // 2: simple_plugin.Collector.Exec:output_type -> simple_plugin.ExecOut - 3, // 3: simple_plugin.Collector.Services:output_type -> simple_plugin.ServicesOut + 0, // 0: plugin.Collector.Exec:input_type -> plugin.ExecIn + 2, // 1: plugin.Collector.Services:input_type -> plugin.ServicesIn + 1, // 2: plugin.Collector.Exec:output_type -> plugin.ExecOut + 3, // 3: plugin.Collector.Services:output_type -> plugin.ServicesOut 2, // [2:4] is the sub-list for method output_type 0, // [0:2] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name diff --git a/v1/plugin.proto b/v1/plugin.proto index b89c870..904e3f2 100755 --- a/v1/plugin.proto +++ b/v1/plugin.proto @@ -1,6 +1,6 @@ syntax = "proto3"; -package collector; +package plugin; option go_package = "."; diff --git a/v1/plugin_grpc.pb.go b/v1/plugin_grpc.pb.go index c8e408c..9666572 100644 --- a/v1/plugin_grpc.pb.go +++ b/v1/plugin_grpc.pb.go @@ -36,7 +36,7 @@ func NewCollectorClient(cc grpc.ClientConnInterface) CollectorClient { func (c *collectorClient) Exec(ctx context.Context, in *ExecIn, opts ...grpc.CallOption) (*ExecOut, error) { out := new(ExecOut) - err := c.cc.Invoke(ctx, "/simple_plugin.Collector/Exec", in, out, opts...) + err := c.cc.Invoke(ctx, "/plugin.Collector/Exec", in, out, opts...) if err != nil { return nil, err } @@ -45,7 +45,7 @@ func (c *collectorClient) Exec(ctx context.Context, in *ExecIn, opts ...grpc.Cal func (c *collectorClient) Services(ctx context.Context, in *ServicesIn, opts ...grpc.CallOption) (*ServicesOut, error) { out := new(ServicesOut) - err := c.cc.Invoke(ctx, "/simple_plugin.Collector/Services", in, out, opts...) + err := c.cc.Invoke(ctx, "/plugin.Collector/Services", in, out, opts...) if err != nil { return nil, err } @@ -94,7 +94,7 @@ func _Collector_Exec_Handler(srv interface{}, ctx context.Context, dec func(inte } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/simple_plugin.Collector/Exec", + FullMethod: "/plugin.Collector/Exec", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CollectorServer).Exec(ctx, req.(*ExecIn)) @@ -112,7 +112,7 @@ func _Collector_Services_Handler(srv interface{}, ctx context.Context, dec func( } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/simple_plugin.Collector/Services", + FullMethod: "/plugin.Collector/Services", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(CollectorServer).Services(ctx, req.(*ServicesIn)) @@ -124,7 +124,7 @@ func _Collector_Services_Handler(srv interface{}, ctx context.Context, dec func( // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) var Collector_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "simple_plugin.Collector", + ServiceName: "plugin.Collector", HandlerType: (*CollectorServer)(nil), Methods: []grpc.MethodDesc{ {