diff --git a/core/grpc/server/dependency_service_server.go b/core/grpc/server/dependency_service_server.go index c08f7218..c5d1843f 100644 --- a/core/grpc/server/dependency_service_server.go +++ b/core/grpc/server/dependency_service_server.go @@ -115,9 +115,11 @@ func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.Depen return nil, err } -func (svr DependencyServiceServer) UpdateTaskLog(stream grpc.DependencyService_UpdateTaskLogServer) (err error) { - var t *models2.DependencyTaskV2 +func (svr DependencyServiceServer) UpdateLogs(stream grpc.DependencyService_UpdateLogsServer) (err error) { + var n *models2.NodeV2 + var dep *models2.DependencyV2 for { + // receive message req, err := stream.Recv() if err == io.EOF { // all messages have been received @@ -126,29 +128,44 @@ func (svr DependencyServiceServer) UpdateTaskLog(stream grpc.DependencyService_U if err != nil { return err } - taskId, err := primitive.ObjectIDFromHex(req.TaskId) - if err != nil { - return err - } - if t == nil { - t, err = service.NewModelService[models2.DependencyTaskV2]().GetById(taskId) + + // if node is nil, get node + if n == nil { + n, err = service.NewModelService[models2.NodeV2]().GetOne(bson.M{"key": req.NodeKey}, nil) if err != nil { + log.Errorf("[DependencyServiceServer] get node error: %v", err) return err } } - var logs []models2.DependencyLogV2 - for _, line := range req.LogLines { - l := models2.DependencyLogV2{ - TaskId: taskId, - Content: line, + + // if dependency is nil, get dependency + if dep == nil { + dep, err = service.NewModelService[models2.DependencyV2]().GetOne(bson.M{ + "node_id": n.Id, + "name": req.Name, + "type": req.Lang, + }, nil) + if err != nil { + if !errors.Is(err, mongo.ErrNoDocuments) { + log.Errorf("[DependencyServiceServer] get dependency error: %v", err) + return err + } + // create dependency if not found + dep = &models2.DependencyV2{ + NodeId: n.Id, + Name: req.Name, + Type: req.Lang, + } + dep.SetCreatedAt(time.Now()) + dep.SetUpdatedAt(time.Now()) + dep.Id, err = service.NewModelService[models2.DependencyV2]().InsertOne(*dep) + if err != nil { + log.Errorf("[DependencyServiceServer] insert dependency error: %v", err) + return err + } } - l.SetCreated(t.CreatedBy) - logs = append(logs, l) - } - _, err = service.NewModelService[models2.DependencyLogV2]().InsertMany(logs) - if err != nil { - return err } + } } diff --git a/core/models/models/v2/base_v2.go b/core/models/models/v2/base_v2.go index 851f261b..f98a1206 100644 --- a/core/models/models/v2/base_v2.go +++ b/core/models/models/v2/base_v2.go @@ -75,6 +75,7 @@ func GetModelInstances() []any { *new(DependencyLogV2), *new(DependencySettingV2), *new(DependencyTaskV2), + *new(DependencyRepoV2), *new(EnvironmentV2), *new(GitV2), *new(MetricV2), diff --git a/core/models/models/v2/dependency_repo.go b/core/models/models/v2/dependency_repo.go new file mode 100644 index 00000000..464464e6 --- /dev/null +++ b/core/models/models/v2/dependency_repo.go @@ -0,0 +1,10 @@ +package models + +type DependencyRepoV2 struct { + any `collection:"dependency_repos"` + BaseModelV2[DependencyRepoV2] `bson:",inline"` + Name string `json:"name" bson:"name"` + Type string `json:"type" bson:"type"` + LatestVersion string `json:"latest_version" bson:"latest_version"` + AllVersions []string `json:"all_versions" bson:"all_versions"` +} diff --git a/core/models/models/v2/dependency_v2.go b/core/models/models/v2/dependency_v2.go index 2d1b7aae..a7fd95a0 100644 --- a/core/models/models/v2/dependency_v2.go +++ b/core/models/models/v2/dependency_v2.go @@ -11,8 +11,10 @@ type DependencyV2 struct { Description string `json:"description" bson:"description"` NodeId primitive.ObjectID `json:"node_id" bson:"node_id"` Type string `json:"type" bson:"type"` - LatestVersion string `json:"latest_version" bson:"latest_version"` Version string `json:"version" bson:"version"` + Status string `json:"status" bson:"status"` + Error string `json:"error,omitempty" bson:"error,omitempty"` + Logs []string `json:"logs,omitempty" bson:"logs,omitempty"` NodeIds []primitive.ObjectID `json:"node_ids,omitempty" bson:"-"` Versions []string `json:"versions,omitempty" bson:"-"` } diff --git a/frontend/packages/crawlab-ui b/frontend/packages/crawlab-ui index 10dd469f..54a3395d 160000 --- a/frontend/packages/crawlab-ui +++ b/frontend/packages/crawlab-ui @@ -1 +1 @@ -Subproject commit 10dd469f41d550ece95ff676fadf9f3237609748 +Subproject commit 54a3395d4158467479daec864d8e73f0f078f32e diff --git a/grpc/dependency_service.pb.go b/grpc/dependency_service.pb.go index 29aa3727..2e77d12a 100644 --- a/grpc/dependency_service.pb.go +++ b/grpc/dependency_service.pb.go @@ -313,17 +313,19 @@ func (x *DependencyServiceSyncRequest) GetDependencies() []*Dependency { return nil } -type DependencyServiceUpdateTaskLogRequest struct { +type DependencyServiceUpdateLogsRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - LogLines []string `protobuf:"bytes,2,rep,name=log_lines,json=logLines,proto3" json:"log_lines,omitempty"` + NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` + Lang string `protobuf:"bytes,2,opt,name=lang,proto3" json:"lang,omitempty"` + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + Logs []string `protobuf:"bytes,4,rep,name=logs,proto3" json:"logs,omitempty"` } -func (x *DependencyServiceUpdateTaskLogRequest) Reset() { - *x = DependencyServiceUpdateTaskLogRequest{} +func (x *DependencyServiceUpdateLogsRequest) Reset() { + *x = DependencyServiceUpdateLogsRequest{} if protoimpl.UnsafeEnabled { mi := &file_services_dependency_service_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -331,13 +333,13 @@ func (x *DependencyServiceUpdateTaskLogRequest) Reset() { } } -func (x *DependencyServiceUpdateTaskLogRequest) String() string { +func (x *DependencyServiceUpdateLogsRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*DependencyServiceUpdateTaskLogRequest) ProtoMessage() {} +func (*DependencyServiceUpdateLogsRequest) ProtoMessage() {} -func (x *DependencyServiceUpdateTaskLogRequest) ProtoReflect() protoreflect.Message { +func (x *DependencyServiceUpdateLogsRequest) ProtoReflect() protoreflect.Message { mi := &file_services_dependency_service_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -349,21 +351,35 @@ func (x *DependencyServiceUpdateTaskLogRequest) ProtoReflect() protoreflect.Mess return mi.MessageOf(x) } -// Deprecated: Use DependencyServiceUpdateTaskLogRequest.ProtoReflect.Descriptor instead. -func (*DependencyServiceUpdateTaskLogRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use DependencyServiceUpdateLogsRequest.ProtoReflect.Descriptor instead. +func (*DependencyServiceUpdateLogsRequest) Descriptor() ([]byte, []int) { return file_services_dependency_service_proto_rawDescGZIP(), []int{4} } -func (x *DependencyServiceUpdateTaskLogRequest) GetTaskId() string { +func (x *DependencyServiceUpdateLogsRequest) GetNodeKey() string { if x != nil { - return x.TaskId + return x.NodeKey } return "" } -func (x *DependencyServiceUpdateTaskLogRequest) GetLogLines() []string { +func (x *DependencyServiceUpdateLogsRequest) GetLang() string { if x != nil { - return x.LogLines + return x.Lang + } + return "" +} + +func (x *DependencyServiceUpdateLogsRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *DependencyServiceUpdateLogsRequest) GetLogs() []string { + if x != nil { + return x.Logs } return nil } @@ -404,34 +420,35 @@ var file_services_dependency_service_proto_rawDesc = []byte{ 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x22, - 0x5d, 0x0a, 0x25, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, - 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, - 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, - 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x6c, 0x6f, 0x67, 0x5f, 0x6c, 0x69, 0x6e, 0x65, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x6f, 0x67, 0x4c, 0x69, 0x6e, 0x65, 0x73, 0x2a, 0x3d, - 0x0a, 0x15, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43, 0x10, - 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0d, - 0x0a, 0x09, 0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0x81, 0x02, - 0x0a, 0x11, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x25, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, - 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, - 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, - 0x01, 0x12, 0x3c, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x50, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, - 0x12, 0x2b, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, - 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, - 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x7b, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x4b, 0x65, 0x79, + 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73, + 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x2a, 0x3d, 0x0a, 0x15, + 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x00, 0x12, + 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09, + 0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0xfb, 0x01, 0x0a, 0x11, + 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x25, 0x2e, 0x67, + 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, + 0x3c, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, + 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a, + 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x28, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, + 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -449,13 +466,13 @@ func file_services_dependency_service_proto_rawDescGZIP() []byte { var file_services_dependency_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_services_dependency_service_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_services_dependency_service_proto_goTypes = []any{ - (DependencyServiceCode)(0), // 0: grpc.DependencyServiceCode - (*Dependency)(nil), // 1: grpc.Dependency - (*DependencyServiceConnectRequest)(nil), // 2: grpc.DependencyServiceConnectRequest - (*DependencyServiceConnectResponse)(nil), // 3: grpc.DependencyServiceConnectResponse - (*DependencyServiceSyncRequest)(nil), // 4: grpc.DependencyServiceSyncRequest - (*DependencyServiceUpdateTaskLogRequest)(nil), // 5: grpc.DependencyServiceUpdateTaskLogRequest - (*Response)(nil), // 6: grpc.Response + (DependencyServiceCode)(0), // 0: grpc.DependencyServiceCode + (*Dependency)(nil), // 1: grpc.Dependency + (*DependencyServiceConnectRequest)(nil), // 2: grpc.DependencyServiceConnectRequest + (*DependencyServiceConnectResponse)(nil), // 3: grpc.DependencyServiceConnectResponse + (*DependencyServiceSyncRequest)(nil), // 4: grpc.DependencyServiceSyncRequest + (*DependencyServiceUpdateLogsRequest)(nil), // 5: grpc.DependencyServiceUpdateLogsRequest + (*Response)(nil), // 6: grpc.Response } var file_services_dependency_service_proto_depIdxs = []int32{ 0, // 0: grpc.DependencyServiceConnectResponse.code:type_name -> grpc.DependencyServiceCode @@ -463,10 +480,10 @@ var file_services_dependency_service_proto_depIdxs = []int32{ 1, // 2: grpc.DependencyServiceSyncRequest.dependencies:type_name -> grpc.Dependency 2, // 3: grpc.DependencyService.Connect:input_type -> grpc.DependencyServiceConnectRequest 4, // 4: grpc.DependencyService.Sync:input_type -> grpc.DependencyServiceSyncRequest - 5, // 5: grpc.DependencyService.UpdateTaskLog:input_type -> grpc.DependencyServiceUpdateTaskLogRequest + 5, // 5: grpc.DependencyService.UpdateLogs:input_type -> grpc.DependencyServiceUpdateLogsRequest 3, // 6: grpc.DependencyService.Connect:output_type -> grpc.DependencyServiceConnectResponse 6, // 7: grpc.DependencyService.Sync:output_type -> grpc.Response - 6, // 8: grpc.DependencyService.UpdateTaskLog:output_type -> grpc.Response + 6, // 8: grpc.DependencyService.UpdateLogs:output_type -> grpc.Response 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 @@ -530,7 +547,7 @@ func file_services_dependency_service_proto_init() { } } file_services_dependency_service_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*DependencyServiceUpdateTaskLogRequest); i { + switch v := v.(*DependencyServiceUpdateLogsRequest); i { case 0: return &v.state case 1: diff --git a/grpc/dependency_service_grpc.pb.go b/grpc/dependency_service_grpc.pb.go index d43edfbb..a0c7124f 100644 --- a/grpc/dependency_service_grpc.pb.go +++ b/grpc/dependency_service_grpc.pb.go @@ -19,9 +19,9 @@ import ( const _ = grpc.SupportPackageIsVersion8 const ( - DependencyService_Connect_FullMethodName = "/grpc.DependencyService/Connect" - DependencyService_Sync_FullMethodName = "/grpc.DependencyService/Sync" - DependencyService_UpdateTaskLog_FullMethodName = "/grpc.DependencyService/UpdateTaskLog" + DependencyService_Connect_FullMethodName = "/grpc.DependencyService/Connect" + DependencyService_Sync_FullMethodName = "/grpc.DependencyService/Sync" + DependencyService_UpdateLogs_FullMethodName = "/grpc.DependencyService/UpdateLogs" ) // DependencyServiceClient is the client API for DependencyService service. @@ -30,7 +30,7 @@ const ( type DependencyServiceClient interface { Connect(ctx context.Context, in *DependencyServiceConnectRequest, opts ...grpc.CallOption) (DependencyService_ConnectClient, error) Sync(ctx context.Context, in *DependencyServiceSyncRequest, opts ...grpc.CallOption) (*Response, error) - UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependencyService_UpdateTaskLogClient, error) + UpdateLogs(ctx context.Context, opts ...grpc.CallOption) (DependencyService_UpdateLogsClient, error) } type dependencyServiceClient struct { @@ -84,31 +84,31 @@ func (c *dependencyServiceClient) Sync(ctx context.Context, in *DependencyServic return out, nil } -func (c *dependencyServiceClient) UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependencyService_UpdateTaskLogClient, error) { +func (c *dependencyServiceClient) UpdateLogs(ctx context.Context, opts ...grpc.CallOption) (DependencyService_UpdateLogsClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &DependencyService_ServiceDesc.Streams[1], DependencyService_UpdateTaskLog_FullMethodName, cOpts...) + stream, err := c.cc.NewStream(ctx, &DependencyService_ServiceDesc.Streams[1], DependencyService_UpdateLogs_FullMethodName, cOpts...) if err != nil { return nil, err } - x := &dependencyServiceUpdateTaskLogClient{ClientStream: stream} + x := &dependencyServiceUpdateLogsClient{ClientStream: stream} return x, nil } -type DependencyService_UpdateTaskLogClient interface { - Send(*DependencyServiceUpdateTaskLogRequest) error +type DependencyService_UpdateLogsClient interface { + Send(*DependencyServiceUpdateLogsRequest) error CloseAndRecv() (*Response, error) grpc.ClientStream } -type dependencyServiceUpdateTaskLogClient struct { +type dependencyServiceUpdateLogsClient struct { grpc.ClientStream } -func (x *dependencyServiceUpdateTaskLogClient) Send(m *DependencyServiceUpdateTaskLogRequest) error { +func (x *dependencyServiceUpdateLogsClient) Send(m *DependencyServiceUpdateLogsRequest) error { return x.ClientStream.SendMsg(m) } -func (x *dependencyServiceUpdateTaskLogClient) CloseAndRecv() (*Response, error) { +func (x *dependencyServiceUpdateLogsClient) CloseAndRecv() (*Response, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } @@ -125,7 +125,7 @@ func (x *dependencyServiceUpdateTaskLogClient) CloseAndRecv() (*Response, error) type DependencyServiceServer interface { Connect(*DependencyServiceConnectRequest, DependencyService_ConnectServer) error Sync(context.Context, *DependencyServiceSyncRequest) (*Response, error) - UpdateTaskLog(DependencyService_UpdateTaskLogServer) error + UpdateLogs(DependencyService_UpdateLogsServer) error mustEmbedUnimplementedDependencyServiceServer() } @@ -139,8 +139,8 @@ func (UnimplementedDependencyServiceServer) Connect(*DependencyServiceConnectReq func (UnimplementedDependencyServiceServer) Sync(context.Context, *DependencyServiceSyncRequest) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") } -func (UnimplementedDependencyServiceServer) UpdateTaskLog(DependencyService_UpdateTaskLogServer) error { - return status.Errorf(codes.Unimplemented, "method UpdateTaskLog not implemented") +func (UnimplementedDependencyServiceServer) UpdateLogs(DependencyService_UpdateLogsServer) error { + return status.Errorf(codes.Unimplemented, "method UpdateLogs not implemented") } func (UnimplementedDependencyServiceServer) mustEmbedUnimplementedDependencyServiceServer() {} @@ -194,26 +194,26 @@ func _DependencyService_Sync_Handler(srv interface{}, ctx context.Context, dec f return interceptor(ctx, in, info, handler) } -func _DependencyService_UpdateTaskLog_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DependencyServiceServer).UpdateTaskLog(&dependencyServiceUpdateTaskLogServer{ServerStream: stream}) +func _DependencyService_UpdateLogs_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DependencyServiceServer).UpdateLogs(&dependencyServiceUpdateLogsServer{ServerStream: stream}) } -type DependencyService_UpdateTaskLogServer interface { +type DependencyService_UpdateLogsServer interface { SendAndClose(*Response) error - Recv() (*DependencyServiceUpdateTaskLogRequest, error) + Recv() (*DependencyServiceUpdateLogsRequest, error) grpc.ServerStream } -type dependencyServiceUpdateTaskLogServer struct { +type dependencyServiceUpdateLogsServer struct { grpc.ServerStream } -func (x *dependencyServiceUpdateTaskLogServer) SendAndClose(m *Response) error { +func (x *dependencyServiceUpdateLogsServer) SendAndClose(m *Response) error { return x.ServerStream.SendMsg(m) } -func (x *dependencyServiceUpdateTaskLogServer) Recv() (*DependencyServiceUpdateTaskLogRequest, error) { - m := new(DependencyServiceUpdateTaskLogRequest) +func (x *dependencyServiceUpdateLogsServer) Recv() (*DependencyServiceUpdateLogsRequest, error) { + m := new(DependencyServiceUpdateLogsRequest) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } @@ -239,8 +239,8 @@ var DependencyService_ServiceDesc = grpc.ServiceDesc{ ServerStreams: true, }, { - StreamName: "UpdateTaskLog", - Handler: _DependencyService_UpdateTaskLog_Handler, + StreamName: "UpdateLogs", + Handler: _DependencyService_UpdateLogs_Handler, ClientStreams: true, }, }, diff --git a/grpc/proto/services/dependency_service.proto b/grpc/proto/services/dependency_service.proto index 1309333e..9934c10d 100644 --- a/grpc/proto/services/dependency_service.proto +++ b/grpc/proto/services/dependency_service.proto @@ -34,13 +34,15 @@ message DependencyServiceSyncRequest { repeated Dependency dependencies = 3; } -message DependencyServiceUpdateTaskLogRequest { - string task_id = 1; - repeated string log_lines = 2; +message DependencyServiceUpdateLogsRequest { + string node_key = 1; + string lang = 2; + string name = 3; + repeated string logs = 4; } service DependencyService { rpc Connect(DependencyServiceConnectRequest) returns (stream DependencyServiceConnectResponse){}; rpc Sync(DependencyServiceSyncRequest) returns (Response){}; - rpc UpdateTaskLog(stream DependencyServiceUpdateTaskLogRequest) returns (Response){}; + rpc UpdateLogs(stream DependencyServiceUpdateLogsRequest) returns (Response){}; }