diff --git a/.github/workflows/checkproto.yaml b/.github/workflows/checkproto.yaml new file mode 100644 index 0000000..c8b48d1 --- /dev/null +++ b/.github/workflows/checkproto.yaml @@ -0,0 +1,67 @@ +name: CI + +on: + push: + branches: + - main + paths: + - "agent/agent.proto" + - "agent/*.pb.go" + pull_request: + branches: + - main + paths: + - "agent/agent.proto" + - "agent/*.pb.go" + +jobs: + checkproto: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: 1.20.x + + - name: Set up protoc + run: | + PROTOC_VERSION=23.3 + PROTOC_GEN_VERSION=v1.31.0 + PROTOC_GRPC_VERSION=v1.3.0 + + # Download and install protoc + PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip + curl -0L -o $PROTOC_ZIP https://github.com/protocolbuffers/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP + unzip -o $PROTOC_ZIP -d protoc3 + sudo mv protoc3/bin/* /usr/local/bin/ + sudo mv protoc3/include/* /usr/local/include/ + rm -rf $PROTOC_ZIP protoc3 + + # Install protoc-gen-go and protoc-gen-go-grpc + go install google.golang.org/protobuf/cmd/protoc-gen-go@$PROTOC_GEN_VERSION + go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@$PROTOC_GRPC_VERSION + + # Add protoc to the PATH + export PATH=$PATH:/usr/local/bin/protoc + + - name: Set up Mainflux + run: | + # Rename .pb.go files to .pb.go.tmp to prevent conflicts + for p in $(ls agent/*.pb.go); do + mv $p $p.tmp + done + + # Generate Go files from protobuf definitions + make protoc + + # Compare generated Go files with the original ones + for p in $(ls agent/*.pb.go); do + if ! cmp -s $p $p.tmp; then + echo "Proto file and generated Go file $p are out of sync!" + exit 1 + fi + done diff --git a/Makefile b/Makefile index 6775b30..a599c00 100644 --- a/Makefile +++ b/Makefile @@ -52,5 +52,4 @@ copy-agent-rc-sh: # docker-compose -f docker/docker-compose.yml up protoc: - protoc --go_out=. proto/*.proto - protoc --go-grpc_out=. proto/*.proto \ No newline at end of file + protoc -I. --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative agent/agent.proto diff --git a/agent/agent.pb.go b/agent/agent.pb.go index 4db0099..d995805 100644 --- a/agent/agent.pb.go +++ b/agent/agent.pb.go @@ -1,10 +1,8 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.12.4 -// source: proto/agent.proto - -// import "google/protobuf/timestamp.proto"; +// protoc-gen-go v1.31.0 +// protoc v4.23.3 +// source: agent/agent.proto package agent @@ -33,7 +31,7 @@ type RunRequest struct { func (x *RunRequest) Reset() { *x = RunRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[0] + mi := &file_agent_agent_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -46,7 +44,7 @@ func (x *RunRequest) String() string { func (*RunRequest) ProtoMessage() {} func (x *RunRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[0] + mi := &file_agent_agent_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -59,7 +57,7 @@ func (x *RunRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use RunRequest.ProtoReflect.Descriptor instead. func (*RunRequest) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{0} + return file_agent_agent_proto_rawDescGZIP(), []int{0} } func (x *RunRequest) GetComputation() []byte { @@ -80,7 +78,7 @@ type RunResponse struct { func (x *RunResponse) Reset() { *x = RunResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[1] + mi := &file_agent_agent_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -93,7 +91,7 @@ func (x *RunResponse) String() string { func (*RunResponse) ProtoMessage() {} func (x *RunResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[1] + mi := &file_agent_agent_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -106,7 +104,7 @@ func (x *RunResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use RunResponse.ProtoReflect.Descriptor instead. func (*RunResponse) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{1} + return file_agent_agent_proto_rawDescGZIP(), []int{1} } func (x *RunResponse) GetComputation() string { @@ -127,7 +125,7 @@ type AlgoRequest struct { func (x *AlgoRequest) Reset() { *x = AlgoRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[2] + mi := &file_agent_agent_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -140,7 +138,7 @@ func (x *AlgoRequest) String() string { func (*AlgoRequest) ProtoMessage() {} func (x *AlgoRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[2] + mi := &file_agent_agent_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -153,7 +151,7 @@ func (x *AlgoRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AlgoRequest.ProtoReflect.Descriptor instead. func (*AlgoRequest) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{2} + return file_agent_agent_proto_rawDescGZIP(), []int{2} } func (x *AlgoRequest) GetAlgorithm() []byte { @@ -174,7 +172,7 @@ type AlgoResponse struct { func (x *AlgoResponse) Reset() { *x = AlgoResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[3] + mi := &file_agent_agent_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -187,7 +185,7 @@ func (x *AlgoResponse) String() string { func (*AlgoResponse) ProtoMessage() {} func (x *AlgoResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[3] + mi := &file_agent_agent_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -200,7 +198,7 @@ func (x *AlgoResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AlgoResponse.ProtoReflect.Descriptor instead. func (*AlgoResponse) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{3} + return file_agent_agent_proto_rawDescGZIP(), []int{3} } func (x *AlgoResponse) GetAlgorithmID() string { @@ -221,7 +219,7 @@ type DataRequest struct { func (x *DataRequest) Reset() { *x = DataRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[4] + mi := &file_agent_agent_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -234,7 +232,7 @@ func (x *DataRequest) String() string { func (*DataRequest) ProtoMessage() {} func (x *DataRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[4] + mi := &file_agent_agent_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -247,7 +245,7 @@ func (x *DataRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use DataRequest.ProtoReflect.Descriptor instead. func (*DataRequest) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{4} + return file_agent_agent_proto_rawDescGZIP(), []int{4} } func (x *DataRequest) GetDataset() string { @@ -268,7 +266,7 @@ type DataResponse struct { func (x *DataResponse) Reset() { *x = DataResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[5] + mi := &file_agent_agent_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -281,7 +279,7 @@ func (x *DataResponse) String() string { func (*DataResponse) ProtoMessage() {} func (x *DataResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[5] + mi := &file_agent_agent_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -294,7 +292,7 @@ func (x *DataResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use DataResponse.ProtoReflect.Descriptor instead. func (*DataResponse) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{5} + return file_agent_agent_proto_rawDescGZIP(), []int{5} } func (x *DataResponse) GetDatasetID() string { @@ -313,7 +311,7 @@ type ResultRequest struct { func (x *ResultRequest) Reset() { *x = ResultRequest{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[6] + mi := &file_agent_agent_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -326,7 +324,7 @@ func (x *ResultRequest) String() string { func (*ResultRequest) ProtoMessage() {} func (x *ResultRequest) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[6] + mi := &file_agent_agent_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -339,7 +337,7 @@ func (x *ResultRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultRequest.ProtoReflect.Descriptor instead. func (*ResultRequest) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{6} + return file_agent_agent_proto_rawDescGZIP(), []int{6} } type ResultResponse struct { @@ -353,7 +351,7 @@ type ResultResponse struct { func (x *ResultResponse) Reset() { *x = ResultResponse{} if protoimpl.UnsafeEnabled { - mi := &file_proto_agent_proto_msgTypes[7] + mi := &file_agent_agent_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -366,7 +364,7 @@ func (x *ResultResponse) String() string { func (*ResultResponse) ProtoMessage() {} func (x *ResultResponse) ProtoReflect() protoreflect.Message { - mi := &file_proto_agent_proto_msgTypes[7] + mi := &file_agent_agent_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -379,7 +377,7 @@ func (x *ResultResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use ResultResponse.ProtoReflect.Descriptor instead. func (*ResultResponse) Descriptor() ([]byte, []int) { - return file_proto_agent_proto_rawDescGZIP(), []int{7} + return file_agent_agent_proto_rawDescGZIP(), []int{7} } func (x *ResultResponse) GetFile() []byte { @@ -389,11 +387,11 @@ func (x *ResultResponse) GetFile() []byte { return nil } -var File_proto_agent_proto protoreflect.FileDescriptor +var File_agent_agent_proto protoreflect.FileDescriptor -var file_proto_agent_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, +var file_agent_agent_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x0b, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x22, 0x2e, 0x0a, 0x0a, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x75, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, @@ -416,58 +414,58 @@ var file_proto_agent_proto_rawDesc = []byte{ 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x32, 0x8d, 0x02, 0x0a, 0x0c, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, - 0x3a, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x12, 0x17, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x75, + 0x3a, 0x0a, 0x03, 0x52, 0x75, 0x6e, 0x12, 0x17, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, + 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x75, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x04, 0x41, - 0x6c, 0x67, 0x6f, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, - 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x41, 0x6c, 0x67, 0x6f, + 0x6c, 0x67, 0x6f, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, + 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x6c, 0x67, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x3d, 0x0a, 0x04, 0x44, 0x61, - 0x74, 0x61, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x74, 0x61, 0x12, 0x18, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x61, - 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x44, 0x61, 0x74, 0x61, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x43, 0x0a, 0x06, 0x52, 0x65, 0x73, - 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x1b, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x65, + 0x75, 0x6c, 0x74, 0x12, 0x1a, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, + 0x74, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1b, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x61, 0x67, 0x65, 0x6e, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( - file_proto_agent_proto_rawDescOnce sync.Once - file_proto_agent_proto_rawDescData = file_proto_agent_proto_rawDesc + file_agent_agent_proto_rawDescOnce sync.Once + file_agent_agent_proto_rawDescData = file_agent_agent_proto_rawDesc ) -func file_proto_agent_proto_rawDescGZIP() []byte { - file_proto_agent_proto_rawDescOnce.Do(func() { - file_proto_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_agent_proto_rawDescData) +func file_agent_agent_proto_rawDescGZIP() []byte { + file_agent_agent_proto_rawDescOnce.Do(func() { + file_agent_agent_proto_rawDescData = protoimpl.X.CompressGZIP(file_agent_agent_proto_rawDescData) }) - return file_proto_agent_proto_rawDescData -} - -var file_proto_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_proto_agent_proto_goTypes = []interface{}{ - (*RunRequest)(nil), // 0: agent_proto.RunRequest - (*RunResponse)(nil), // 1: agent_proto.RunResponse - (*AlgoRequest)(nil), // 2: agent_proto.AlgoRequest - (*AlgoResponse)(nil), // 3: agent_proto.AlgoResponse - (*DataRequest)(nil), // 4: agent_proto.DataRequest - (*DataResponse)(nil), // 5: agent_proto.DataResponse - (*ResultRequest)(nil), // 6: agent_proto.ResultRequest - (*ResultResponse)(nil), // 7: agent_proto.ResultResponse -} -var file_proto_agent_proto_depIdxs = []int32{ - 0, // 0: agent_proto.AgentService.Run:input_type -> agent_proto.RunRequest - 2, // 1: agent_proto.AgentService.Algo:input_type -> agent_proto.AlgoRequest - 4, // 2: agent_proto.AgentService.Data:input_type -> agent_proto.DataRequest - 6, // 3: agent_proto.AgentService.Result:input_type -> agent_proto.ResultRequest - 1, // 4: agent_proto.AgentService.Run:output_type -> agent_proto.RunResponse - 3, // 5: agent_proto.AgentService.Algo:output_type -> agent_proto.AlgoResponse - 5, // 6: agent_proto.AgentService.Data:output_type -> agent_proto.DataResponse - 7, // 7: agent_proto.AgentService.Result:output_type -> agent_proto.ResultResponse + return file_agent_agent_proto_rawDescData +} + +var file_agent_agent_proto_msgTypes = make([]protoimpl.MessageInfo, 8) +var file_agent_agent_proto_goTypes = []interface{}{ + (*RunRequest)(nil), // 0: agent.agent.RunRequest + (*RunResponse)(nil), // 1: agent.agent.RunResponse + (*AlgoRequest)(nil), // 2: agent.agent.AlgoRequest + (*AlgoResponse)(nil), // 3: agent.agent.AlgoResponse + (*DataRequest)(nil), // 4: agent.agent.DataRequest + (*DataResponse)(nil), // 5: agent.agent.DataResponse + (*ResultRequest)(nil), // 6: agent.agent.ResultRequest + (*ResultResponse)(nil), // 7: agent.agent.ResultResponse +} +var file_agent_agent_proto_depIdxs = []int32{ + 0, // 0: agent.agent.AgentService.Run:input_type -> agent.agent.RunRequest + 2, // 1: agent.agent.AgentService.Algo:input_type -> agent.agent.AlgoRequest + 4, // 2: agent.agent.AgentService.Data:input_type -> agent.agent.DataRequest + 6, // 3: agent.agent.AgentService.Result:input_type -> agent.agent.ResultRequest + 1, // 4: agent.agent.AgentService.Run:output_type -> agent.agent.RunResponse + 3, // 5: agent.agent.AgentService.Algo:output_type -> agent.agent.AlgoResponse + 5, // 6: agent.agent.AgentService.Data:output_type -> agent.agent.DataResponse + 7, // 7: agent.agent.AgentService.Result:output_type -> agent.agent.ResultResponse 4, // [4:8] is the sub-list for method output_type 0, // [0:4] is the sub-list for method input_type 0, // [0:0] is the sub-list for extension type_name @@ -475,13 +473,13 @@ var file_proto_agent_proto_depIdxs = []int32{ 0, // [0:0] is the sub-list for field type_name } -func init() { file_proto_agent_proto_init() } -func file_proto_agent_proto_init() { - if File_proto_agent_proto != nil { +func init() { file_agent_agent_proto_init() } +func file_agent_agent_proto_init() { + if File_agent_agent_proto != nil { return } if !protoimpl.UnsafeEnabled { - file_proto_agent_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RunRequest); i { case 0: return &v.state @@ -493,7 +491,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RunResponse); i { case 0: return &v.state @@ -505,7 +503,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AlgoRequest); i { case 0: return &v.state @@ -517,7 +515,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AlgoResponse); i { case 0: return &v.state @@ -529,7 +527,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataRequest); i { case 0: return &v.state @@ -541,7 +539,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DataResponse); i { case 0: return &v.state @@ -553,7 +551,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultRequest); i { case 0: return &v.state @@ -565,7 +563,7 @@ func file_proto_agent_proto_init() { return nil } } - file_proto_agent_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + file_agent_agent_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ResultResponse); i { case 0: return &v.state @@ -582,18 +580,18 @@ func file_proto_agent_proto_init() { out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_proto_agent_proto_rawDesc, + RawDescriptor: file_agent_agent_proto_rawDesc, NumEnums: 0, NumMessages: 8, NumExtensions: 0, NumServices: 1, }, - GoTypes: file_proto_agent_proto_goTypes, - DependencyIndexes: file_proto_agent_proto_depIdxs, - MessageInfos: file_proto_agent_proto_msgTypes, + GoTypes: file_agent_agent_proto_goTypes, + DependencyIndexes: file_agent_agent_proto_depIdxs, + MessageInfos: file_agent_agent_proto_msgTypes, }.Build() - File_proto_agent_proto = out.File - file_proto_agent_proto_rawDesc = nil - file_proto_agent_proto_goTypes = nil - file_proto_agent_proto_depIdxs = nil + File_agent_agent_proto = out.File + file_agent_agent_proto_rawDesc = nil + file_agent_agent_proto_goTypes = nil + file_agent_agent_proto_depIdxs = nil } diff --git a/proto/agent.proto b/agent/agent.proto similarity index 75% rename from proto/agent.proto rename to agent/agent.proto index 299c8e5..4caf0c3 100644 --- a/proto/agent.proto +++ b/agent/agent.proto @@ -1,22 +1,16 @@ syntax = "proto3"; -// import "google/protobuf/timestamp.proto"; - -package agent_proto; +package agent.agent; option go_package = "./agent"; service AgentService { - // rpc Health(HealthRequest) returns (HealthResponse) {} rpc Run(RunRequest) returns (RunResponse) {} rpc Algo(AlgoRequest) returns (AlgoResponse) {} rpc Data(DataRequest) returns (DataResponse) {} rpc Result(ResultRequest) returns (ResultResponse) {} } -// message HealthRequest {} -// message HealthResponse { string status = 1; } - message RunRequest { bytes computation = 1; } message RunResponse { string Computation = 1; } diff --git a/agent/agent_grpc.pb.go b/agent/agent_grpc.pb.go index 4d08673..ca00939 100644 --- a/agent/agent_grpc.pb.go +++ b/agent/agent_grpc.pb.go @@ -1,8 +1,8 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.12.4 -// source: proto/agent.proto +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.23.3 +// source: agent/agent.proto package agent @@ -18,11 +18,17 @@ import ( // Requires gRPC-Go v1.32.0 or later. const _ = grpc.SupportPackageIsVersion7 +const ( + AgentService_Run_FullMethodName = "/agent.agent.AgentService/Run" + AgentService_Algo_FullMethodName = "/agent.agent.AgentService/Algo" + AgentService_Data_FullMethodName = "/agent.agent.AgentService/Data" + AgentService_Result_FullMethodName = "/agent.agent.AgentService/Result" +) + // AgentServiceClient is the client API for AgentService service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type AgentServiceClient interface { - // rpc Health(HealthRequest) returns (HealthResponse) {} Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (*RunResponse, error) Algo(ctx context.Context, in *AlgoRequest, opts ...grpc.CallOption) (*AlgoResponse, error) Data(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataResponse, error) @@ -39,7 +45,7 @@ func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient { func (c *agentServiceClient) Run(ctx context.Context, in *RunRequest, opts ...grpc.CallOption) (*RunResponse, error) { out := new(RunResponse) - err := c.cc.Invoke(ctx, "/agent_proto.AgentService/Run", in, out, opts...) + err := c.cc.Invoke(ctx, AgentService_Run_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -48,7 +54,7 @@ func (c *agentServiceClient) Run(ctx context.Context, in *RunRequest, opts ...gr func (c *agentServiceClient) Algo(ctx context.Context, in *AlgoRequest, opts ...grpc.CallOption) (*AlgoResponse, error) { out := new(AlgoResponse) - err := c.cc.Invoke(ctx, "/agent_proto.AgentService/Algo", in, out, opts...) + err := c.cc.Invoke(ctx, AgentService_Algo_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -57,7 +63,7 @@ func (c *agentServiceClient) Algo(ctx context.Context, in *AlgoRequest, opts ... func (c *agentServiceClient) Data(ctx context.Context, in *DataRequest, opts ...grpc.CallOption) (*DataResponse, error) { out := new(DataResponse) - err := c.cc.Invoke(ctx, "/agent_proto.AgentService/Data", in, out, opts...) + err := c.cc.Invoke(ctx, AgentService_Data_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -66,7 +72,7 @@ func (c *agentServiceClient) Data(ctx context.Context, in *DataRequest, opts ... func (c *agentServiceClient) Result(ctx context.Context, in *ResultRequest, opts ...grpc.CallOption) (*ResultResponse, error) { out := new(ResultResponse) - err := c.cc.Invoke(ctx, "/agent_proto.AgentService/Result", in, out, opts...) + err := c.cc.Invoke(ctx, AgentService_Result_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -77,7 +83,6 @@ func (c *agentServiceClient) Result(ctx context.Context, in *ResultRequest, opts // All implementations must embed UnimplementedAgentServiceServer // for forward compatibility type AgentServiceServer interface { - // rpc Health(HealthRequest) returns (HealthResponse) {} Run(context.Context, *RunRequest) (*RunResponse, error) Algo(context.Context, *AlgoRequest) (*AlgoResponse, error) Data(context.Context, *DataRequest) (*DataResponse, error) @@ -124,7 +129,7 @@ func _AgentService_Run_Handler(srv interface{}, ctx context.Context, dec func(in } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/agent_proto.AgentService/Run", + FullMethod: AgentService_Run_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AgentServiceServer).Run(ctx, req.(*RunRequest)) @@ -142,7 +147,7 @@ func _AgentService_Algo_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/agent_proto.AgentService/Algo", + FullMethod: AgentService_Algo_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AgentServiceServer).Algo(ctx, req.(*AlgoRequest)) @@ -160,7 +165,7 @@ func _AgentService_Data_Handler(srv interface{}, ctx context.Context, dec func(i } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/agent_proto.AgentService/Data", + FullMethod: AgentService_Data_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AgentServiceServer).Data(ctx, req.(*DataRequest)) @@ -178,7 +183,7 @@ func _AgentService_Result_Handler(srv interface{}, ctx context.Context, dec func } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/agent_proto.AgentService/Result", + FullMethod: AgentService_Result_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { return srv.(AgentServiceServer).Result(ctx, req.(*ResultRequest)) @@ -190,7 +195,7 @@ func _AgentService_Result_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 AgentService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "agent_proto.AgentService", + ServiceName: "agent.agent.AgentService", HandlerType: (*AgentServiceServer)(nil), Methods: []grpc.MethodDesc{ { @@ -211,5 +216,5 @@ var AgentService_ServiceDesc = grpc.ServiceDesc{ }, }, Streams: []grpc.StreamDesc{}, - Metadata: "proto/agent.proto", + Metadata: "agent/agent.proto", } diff --git a/agent/api/grpc/client.go b/agent/api/grpc/client.go index a0c29ad..7b6944d 100644 --- a/agent/api/grpc/client.go +++ b/agent/api/grpc/client.go @@ -11,9 +11,7 @@ import ( "google.golang.org/grpc" ) -const ( - svcName = "agent_proto.AgentService" -) +const svcName = "agent.agent.AgentService" type grpcClient struct { run endpoint.Endpoint