From 972713959f243763810f7f1f0c00452cf9e5719c Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Sat, 15 Jun 2024 23:25:24 +0800 Subject: [PATCH] feat: updated grpc for dependencies service --- core/controllers/base_v2.go | 12 +- core/entity/dependency.go | 14 + core/grpc/client/client_v2.go | 4 +- core/grpc/server/dependencies_server_v2.go | 137 ++++- core/grpc/server/server_v2.go | 23 +- core/models/common/index_service_v2.go | 160 ++++++ core/models/models/dependency_v2.go | 18 +- core/models/models/git_v2.go | 1 + core/node/service/master_service_v2.go | 2 +- grpc/dependencies_service_v2.pb.go | 62 +-- grpc/dependencies_service_v2_grpc.pb.go | 35 +- grpc/dependencies_service_v2_request.pb.go | 488 ------------------ .../services/dependencies_service_v2.proto | 4 +- 13 files changed, 372 insertions(+), 588 deletions(-) create mode 100644 core/entity/dependency.go create mode 100644 core/models/common/index_service_v2.go delete mode 100644 grpc/dependencies_service_v2_request.pb.go diff --git a/core/controllers/base_v2.go b/core/controllers/base_v2.go index ddb9107e..be6eebff 100644 --- a/core/controllers/base_v2.go +++ b/core/controllers/base_v2.go @@ -86,7 +86,6 @@ func (ctr *BaseControllerV2[T]) PutById(c *gin.Context) { u := GetUserFromContextV2(c) m := any(&model).(interfaces.ModelV2) - m.SetId(primitive.NewObjectID()) m.SetUpdated(u.Id) if err := ctr.modelSvc.ReplaceById(id, model); err != nil { @@ -170,14 +169,19 @@ func (ctr *BaseControllerV2[T]) DeleteList(c *gin.Context) { } func (ctr *BaseControllerV2[T]) getAll(c *gin.Context) { - models, err := ctr.modelSvc.GetMany(nil, &mongo.FindOptions{ - Sort: bson.D{{"_id", -1}}, + query := MustGetFilterQuery(c) + sort := MustGetSortOption(c) + if sort == nil { + sort = bson.D{{"_id", -1}} + } + models, err := ctr.modelSvc.GetMany(query, &mongo.FindOptions{ + Sort: sort, }) if err != nil { HandleErrorInternalServerError(c, err) return } - total, err := ctr.modelSvc.Count(nil) + total, err := ctr.modelSvc.Count(query) if err != nil { HandleErrorInternalServerError(c, err) return diff --git a/core/entity/dependency.go b/core/entity/dependency.go new file mode 100644 index 00000000..55f9c6ad --- /dev/null +++ b/core/entity/dependency.go @@ -0,0 +1,14 @@ +package entity + +import "go.mongodb.org/mongo-driver/bson/primitive" + +type DependencyResult struct { + Name string `json:"name,omitempty" bson:"name,omitempty"` + NodeIds []primitive.ObjectID `json:"node_ids,omitempty" bson:"node_ids,omitempty"` + Versions []string `json:"versions,omitempty" bson:"versions,omitempty"` + LatestVersion string `json:"latest_version" bson:"latest_version"` + Count int `json:"count,omitempty" bson:"count,omitempty"` + Upgradable bool `json:"upgradable" bson:"upgradable"` + Downgradable bool `json:"downgradable" bson:"downgradable"` + Installable bool `json:"installable" bson:"installable"` +} diff --git a/core/grpc/client/client_v2.go b/core/grpc/client/client_v2.go index fd40cc9c..f4ddc2e3 100644 --- a/core/grpc/client/client_v2.go +++ b/core/grpc/client/client_v2.go @@ -40,7 +40,7 @@ type GrpcClientV2 struct { NodeClient grpc2.NodeServiceClient TaskClient grpc2.TaskServiceClient ModelBaseServiceV2Client grpc2.ModelBaseServiceV2Client - DependenciesClient grpc2.DependencyServiceV2Client + DependenciesClient grpc2.DependenciesServiceV2Client } func (c *GrpcClientV2) Init() (err error) { @@ -95,7 +95,7 @@ func (c *GrpcClientV2) Register() { c.NodeClient = grpc2.NewNodeServiceClient(c.conn) c.ModelBaseServiceV2Client = grpc2.NewModelBaseServiceV2Client(c.conn) c.TaskClient = grpc2.NewTaskServiceClient(c.conn) - c.DependenciesClient = grpc2.NewDependencyServiceV2Client(c.conn) + c.DependenciesClient = grpc2.NewDependenciesServiceV2Client(c.conn) // log log.Infof("[GrpcClient] grpc client registered client services") diff --git a/core/grpc/server/dependencies_server_v2.go b/core/grpc/server/dependencies_server_v2.go index b5b15c35..f7ede5c0 100644 --- a/core/grpc/server/dependencies_server_v2.go +++ b/core/grpc/server/dependencies_server_v2.go @@ -2,30 +2,41 @@ package server import ( "context" + "errors" + "github.com/apex/log" "github.com/crawlab-team/crawlab/core/models/models" "github.com/crawlab-team/crawlab/core/models/service" + mongo2 "github.com/crawlab-team/crawlab/db/mongo" "github.com/crawlab-team/crawlab/grpc" + "github.com/crawlab-team/crawlab/trace" "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" + "go.mongodb.org/mongo-driver/mongo" "io" "sync" + "time" ) type DependenciesServerV2 struct { grpc.UnimplementedDependenciesServiceV2Server mu *sync.Mutex - streams map[string]grpc.DependenciesServiceV2_ConnectServer + streams map[string]*grpc.DependenciesServiceV2_ConnectServer } -func (svr DependenciesServerV2) Connect(stream grpc.DependenciesServiceV2_ConnectServer) (err error) { +func (svr DependenciesServerV2) Connect(req *grpc.DependenciesServiceV2ConnectRequest, stream grpc.DependenciesServiceV2_ConnectServer) (err error) { svr.mu.Lock() - defer svr.mu.Unlock() - req, err := stream.Recv() - if err != nil { - return err + svr.streams[req.NodeKey] = &stream + svr.mu.Unlock() + log.Info("[DependenciesServerV2] connected: " + req.NodeKey) + + // Keep this scope alive because once this scope exits - the stream is closed + for { + select { + case <-stream.Context().Done(): + log.Info("[DependenciesServerV2] disconnected: " + req.NodeKey) + return nil + } } - svr.streams[req.NodeKey] = stream - return nil } func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.DependenciesServiceV2SyncRequest) (response *grpc.Response, err error) { @@ -33,20 +44,75 @@ func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.Dependen if err != nil { return nil, err } - var deps []models.DependencyV2 + + depsDb, err := service.NewModelServiceV2[models.DependencyV2]().GetMany(bson.M{ + "node_id": n.Id, + "type": request.Lang, + }, nil) + if err != nil { + if !errors.Is(err, mongo.ErrNoDocuments) { + log.Errorf("[DependenciesServiceV2] get dependencies from db error: %v", err) + return nil, err + } + } + + depsDbMap := make(map[string]*models.DependencyV2) + for _, d := range depsDb { + depsDbMap[d.Name] = &d + } + + var depsToInsert []models.DependencyV2 + depsMap := make(map[string]*models.DependencyV2) for _, dep := range request.Dependencies { - deps = append(deps, models.DependencyV2{ + d := models.DependencyV2{ Name: dep.Name, NodeId: n.Id, Type: request.Lang, Version: dep.Version, - }) + } + d.SetCreatedAt(time.Now()) + + depsMap[d.Name] = &d + + _, ok := depsDbMap[d.Name] + if !ok { + depsToInsert = append(depsToInsert, d) + } } - _, err = service.NewModelServiceV2[models.DependencyV2]().InsertMany(deps) - if err != nil { - return nil, err + + var depIdsToDelete []primitive.ObjectID + for _, d := range depsDb { + _, ok := depsMap[d.Name] + if !ok { + depIdsToDelete = append(depIdsToDelete, d.Id) + } } - return nil, nil + + err = mongo2.RunTransaction(func(ctx mongo.SessionContext) (err error) { + if len(depIdsToDelete) > 0 { + err = service.NewModelServiceV2[models.DependencyV2]().DeleteMany(bson.M{ + "_id": bson.M{"$in": depIdsToDelete}, + }) + if err != nil { + log.Errorf("[DependenciesServerV2] delete dependencies in db error: %v", err) + trace.PrintError(err) + return err + } + } + + if len(depsToInsert) > 0 { + _, err = service.NewModelServiceV2[models.DependencyV2]().InsertMany(depsToInsert) + if err != nil { + log.Errorf("[DependenciesServerV2] insert dependencies in db error: %v", err) + trace.PrintError(err) + return err + } + } + + return nil + }) + + return nil, err } func (svr DependenciesServerV2) UpdateTaskLog(stream grpc.DependenciesServiceV2_UpdateTaskLogServer) (err error) { @@ -70,18 +136,45 @@ func (svr DependenciesServerV2) UpdateTaskLog(stream grpc.DependenciesServiceV2_ return err } } - l := models.DependencyLogV2{ - TaskId: taskId, - Content: req.Content, + var logs []models.DependencyLogV2 + for _, line := range req.LogLines { + l := models.DependencyLogV2{ + TaskId: taskId, + Content: line, + } + l.SetCreated(t.CreatedBy) + logs = append(logs, l) } - l.SetCreated(t.CreatedBy) - _, err = service.NewModelServiceV2[models.DependencyLogV2]().InsertOne(l) + _, err = service.NewModelServiceV2[models.DependencyLogV2]().InsertMany(logs) if err != nil { return err } } } -func NewDependenciesServerV2() *DependenciesServerV2 { - return &DependenciesServerV2{} +func (svr DependenciesServerV2) GetStream(key string) (stream *grpc.DependenciesServiceV2_ConnectServer, err error) { + svr.mu.Lock() + defer svr.mu.Unlock() + stream, ok := svr.streams[key] + if !ok { + return nil, errors.New("stream not found") + } + return stream, nil +} + +func NewDependenciesServerV2() *DependenciesServerV2 { + return &DependenciesServerV2{ + mu: new(sync.Mutex), + streams: make(map[string]*grpc.DependenciesServiceV2_ConnectServer), + } +} + +var depSvc *DependenciesServerV2 + +func GetDependenciesServerV2() *DependenciesServerV2 { + if depSvc != nil { + return depSvc + } + depSvc = NewDependenciesServerV2() + return depSvc } diff --git a/core/grpc/server/server_v2.go b/core/grpc/server/server_v2.go index ebcb871b..ad04c5a0 100644 --- a/core/grpc/server/server_v2.go +++ b/core/grpc/server/server_v2.go @@ -42,10 +42,10 @@ type GrpcServerV2 struct { nodeCfgSvc interfaces.NodeConfigService // servers - nodeSvr *NodeServerV2 - taskSvr *TaskServerV2 - modelBaseServiceSvr *ModelBaseServiceServerV2 - dependenciesSvr *DependenciesServerV2 + NodeSvr *NodeServerV2 + TaskSvr *TaskServerV2 + ModelBaseServiceSvr *ModelBaseServiceServerV2 + DependenciesSvr *DependenciesServerV2 } func (svr *GrpcServerV2) GetConfigPath() (path string) { @@ -115,9 +115,10 @@ func (svr *GrpcServerV2) Stop() (err error) { } func (svr *GrpcServerV2) Register() (err error) { - grpc2.RegisterNodeServiceServer(svr.svr, *svr.nodeSvr) // node service - grpc2.RegisterModelBaseServiceV2Server(svr.svr, *svr.modelBaseServiceSvr) - grpc2.RegisterTaskServiceServer(svr.svr, *svr.taskSvr) + grpc2.RegisterNodeServiceServer(svr.svr, *svr.NodeSvr) + grpc2.RegisterModelBaseServiceV2Server(svr.svr, *svr.ModelBaseServiceSvr) + grpc2.RegisterTaskServiceServer(svr.svr, *svr.TaskSvr) + grpc2.RegisterDependenciesServiceV2Server(svr.svr, *svr.DependenciesSvr) return nil } @@ -206,16 +207,16 @@ func NewGrpcServerV2() (svr *GrpcServerV2, err error) { svr.nodeCfgSvc = nodeconfig.GetNodeConfigService() - svr.nodeSvr, err = NewNodeServerV2() + svr.NodeSvr, err = NewNodeServerV2() if err != nil { return nil, err } - svr.modelBaseServiceSvr = NewModelBaseServiceV2Server() - svr.taskSvr, err = NewTaskServerV2() + svr.ModelBaseServiceSvr = NewModelBaseServiceV2Server() + svr.TaskSvr, err = NewTaskServerV2() if err != nil { return nil, err } - svr.dependenciesSvr = NewDependenciesServerV2() + svr.DependenciesSvr = GetDependenciesServerV2() // recovery options recoveryOpts := []grpc_recovery.Option{ diff --git a/core/models/common/index_service_v2.go b/core/models/common/index_service_v2.go new file mode 100644 index 00000000..c46ec3dc --- /dev/null +++ b/core/models/common/index_service_v2.go @@ -0,0 +1,160 @@ +package common + +import ( + "github.com/crawlab-team/crawlab/core/models/models" + "github.com/crawlab-team/crawlab/core/models/service" + "github.com/crawlab-team/crawlab/db/mongo" + "go.mongodb.org/mongo-driver/bson" + mongo2 "go.mongodb.org/mongo-driver/mongo" + "go.mongodb.org/mongo-driver/mongo/options" +) + +func CreateIndexesV2() { + // nodes + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.NodeV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"key": 1}}, // key + {Keys: bson.M{"name": 1}}, // name + {Keys: bson.M{"is_master": 1}}, // is_master + {Keys: bson.M{"status": 1}}, // status + {Keys: bson.M{"enabled": 1}}, // enabled + {Keys: bson.M{"active": 1}}, // active + }) + + // projects + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.ProjectV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + }) + + // spiders + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.SpiderV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + {Keys: bson.M{"type": 1}}, + {Keys: bson.M{"col_id": 1}}, + {Keys: bson.M{"project_id": 1}}, + }) + + // tasks + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.TaskV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"spider_id": 1}}, + {Keys: bson.M{"status": 1}}, + {Keys: bson.M{"node_id": 1}}, + {Keys: bson.M{"schedule_id": 1}}, + {Keys: bson.M{"type": 1}}, + {Keys: bson.M{"mode": 1}}, + {Keys: bson.M{"priority": 1}}, + {Keys: bson.M{"parent_id": 1}}, + {Keys: bson.M{"has_sub": 1}}, + {Keys: bson.M{"create_ts": -1}}, + }) + + // task stats + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.TaskStatV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"create_ts": 1}}, + }) + + // schedules + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.ScheduleV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + {Keys: bson.M{"spider_id": 1}}, + {Keys: bson.M{"enabled": 1}}, + }) + + // users + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.UserV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"username": 1}}, + {Keys: bson.M{"role": 1}}, + {Keys: bson.M{"email": 1}}, + }) + + // settings + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.SettingV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"key": 1}}, + }) + + // tokens + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.TokenV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + }) + + // variables + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.VariableV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"key": 1}}, + }) + + // data sources + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DataSourceV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + }) + + // data collections + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DataCollectionV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.M{"name": 1}}, + }) + + // roles + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.RoleV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.D{{"key", 1}}, Options: options.Index().SetUnique(true)}, + }) + + // user role relations + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.UserRoleV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.D{{"user_id", 1}, {"role_id", 1}}, Options: options.Index().SetUnique(true)}, + {Keys: bson.D{{"role_id", 1}, {"user_id", 1}}, Options: options.Index().SetUnique(true)}, + }) + + // permissions + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.PermissionV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.D{{"key", 1}}, Options: options.Index().SetUnique(true)}, + }) + + // role permission relations + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.RolePermissionV2{})).MustCreateIndexes([]mongo2.IndexModel{ + {Keys: bson.D{{"role_id", 1}, {"permission_id", 1}}, Options: options.Index().SetUnique(true)}, + {Keys: bson.D{{"permission_id", 1}, {"role_id", 1}}, Options: options.Index().SetUnique(true)}, + }) + + // dependencies + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DependencyV2{})).MustCreateIndexes([]mongo2.IndexModel{ + { + Keys: bson.D{ + {"type", 1}, + {"node_id", 1}, + {"name", 1}, + }, + Options: (&options.IndexOptions{}).SetUnique(true), + }, + }) + + // dependency settings + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DependencySettingV2{})).MustCreateIndexes([]mongo2.IndexModel{ + { + Keys: bson.D{ + {"type", 1}, + {"node_id", 1}, + {"name", 1}, + }, + Options: (&options.IndexOptions{}).SetUnique(true), + }, + }) + + // dependency logs + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DependencyLogV2{})).MustCreateIndexes([]mongo2.IndexModel{ + { + Keys: bson.D{{"task_id", 1}}, + }, + { + Keys: bson.D{{"update_ts", 1}}, + Options: (&options.IndexOptions{}).SetExpireAfterSeconds(60 * 60 * 24), + }, + }) + + // dependency tasks + mongo.GetMongoCol(service.GetCollectionNameByInstance(models.DependencyTaskV2{})).MustCreateIndexes([]mongo2.IndexModel{ + { + Keys: bson.D{ + {"update_ts", 1}, + }, + Options: (&options.IndexOptions{}).SetExpireAfterSeconds(60 * 60 * 24), + }, + }) +} diff --git a/core/models/models/dependency_v2.go b/core/models/models/dependency_v2.go index 4d3811d6..6d8d6039 100644 --- a/core/models/models/dependency_v2.go +++ b/core/models/models/dependency_v2.go @@ -1,14 +1,18 @@ package models -import "go.mongodb.org/mongo-driver/bson/primitive" +import ( + "github.com/crawlab-team/crawlab/core/entity" + "go.mongodb.org/mongo-driver/bson/primitive" +) type DependencyV2 struct { any `collection:"dependencies"` BaseModelV2[DependencyV2] `bson:",inline"` - Name string `json:"name" bson:"name"` - 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"` + Name string `json:"name" bson:"name"` + 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"` + Result entity.DependencyResult `json:"result" bson:"-"` } diff --git a/core/models/models/git_v2.go b/core/models/models/git_v2.go index b72c130a..1ccced39 100644 --- a/core/models/models/git_v2.go +++ b/core/models/models/git_v2.go @@ -4,6 +4,7 @@ type GitV2 struct { any `collection:"gits"` BaseModelV2[GitV2] `bson:",inline"` Url string `json:"url" bson:"url"` + Name string `json:"name" bson:"name"` AuthType string `json:"auth_type" bson:"auth_type"` Username string `json:"username" bson:"username"` Password string `json:"password" bson:"password"` diff --git a/core/node/service/master_service_v2.go b/core/node/service/master_service_v2.go index 1ca7a52a..13aa69c1 100644 --- a/core/node/service/master_service_v2.go +++ b/core/node/service/master_service_v2.go @@ -54,7 +54,7 @@ func (svc *MasterServiceV2) Init() (err error) { func (svc *MasterServiceV2) Start() { // create indexes - common.CreateIndexes() + common.CreateIndexesV2() // start grpc server if err := svc.server.Start(); err != nil { diff --git a/grpc/dependencies_service_v2.pb.go b/grpc/dependencies_service_v2.pb.go index baf1bcad..6966b1d9 100644 --- a/grpc/dependencies_service_v2.pb.go +++ b/grpc/dependencies_service_v2.pb.go @@ -323,8 +323,8 @@ type DependenciesServiceV2UpdateTaskLogRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskId string `protobuf:"bytes,1,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - Content string `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` + 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"` } func (x *DependenciesServiceV2UpdateTaskLogRequest) Reset() { @@ -366,11 +366,11 @@ func (x *DependenciesServiceV2UpdateTaskLogRequest) GetTaskId() string { return "" } -func (x *DependenciesServiceV2UpdateTaskLogRequest) GetContent() string { +func (x *DependenciesServiceV2UpdateTaskLogRequest) GetLogLines() []string { if x != nil { - return x.Content + return x.LogLines } - return "" + return nil } var File_services_dependencies_service_v2_proto protoreflect.FileDescriptor @@ -410,36 +410,36 @@ var file_services_dependencies_service_v2_proto_rawDesc = []byte{ 0x0a, 0x0c, 0x64, 0x65, 0x70, 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, 0x5e, 0x0a, 0x29, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, + 0x63, 0x69, 0x65, 0x73, 0x22, 0x61, 0x0a, 0x29, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, 0x18, 0x0a, 0x07, 0x63, 0x6f, - 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, - 0x74, 0x65, 0x6e, 0x74, 0x2a, 0x41, 0x0a, 0x19, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, 0x97, 0x02, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x65, - 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, - 0x32, 0x12, 0x66, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x29, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, + 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, 0x41, 0x0a, 0x19, 0x44, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, + 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, 0x95, 0x02, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, - 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x12, 0x40, 0x0a, 0x04, 0x53, 0x79, 0x6e, - 0x63, 0x12, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, - 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, 0x54, 0x0a, 0x0d, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x12, 0x2f, 0x2e, 0x67, - 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, + 0x63, 0x65, 0x56, 0x32, 0x12, 0x64, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, + 0x29, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, + 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, + 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2a, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x40, 0x0a, 0x04, 0x53, 0x79, + 0x6e, 0x63, 0x12, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, + 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, 0x54, 0x0a, 0x0d, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x12, 0x2f, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, + 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 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, } var ( diff --git a/grpc/dependencies_service_v2_grpc.pb.go b/grpc/dependencies_service_v2_grpc.pb.go index b96e3178..e76d3bda 100644 --- a/grpc/dependencies_service_v2_grpc.pb.go +++ b/grpc/dependencies_service_v2_grpc.pb.go @@ -22,7 +22,7 @@ const _ = grpc.SupportPackageIsVersion7 // // 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 DependenciesServiceV2Client interface { - Connect(ctx context.Context, opts ...grpc.CallOption) (DependenciesServiceV2_ConnectClient, error) + Connect(ctx context.Context, in *DependenciesServiceV2ConnectRequest, opts ...grpc.CallOption) (DependenciesServiceV2_ConnectClient, error) Sync(ctx context.Context, in *DependenciesServiceV2SyncRequest, opts ...grpc.CallOption) (*Response, error) UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependenciesServiceV2_UpdateTaskLogClient, error) } @@ -35,17 +35,22 @@ func NewDependenciesServiceV2Client(cc grpc.ClientConnInterface) DependenciesSer return &dependenciesServiceV2Client{cc} } -func (c *dependenciesServiceV2Client) Connect(ctx context.Context, opts ...grpc.CallOption) (DependenciesServiceV2_ConnectClient, error) { +func (c *dependenciesServiceV2Client) Connect(ctx context.Context, in *DependenciesServiceV2ConnectRequest, opts ...grpc.CallOption) (DependenciesServiceV2_ConnectClient, error) { stream, err := c.cc.NewStream(ctx, &DependenciesServiceV2_ServiceDesc.Streams[0], "/grpc.DependenciesServiceV2/Connect", opts...) if err != nil { return nil, err } x := &dependenciesServiceV2ConnectClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } return x, nil } type DependenciesServiceV2_ConnectClient interface { - Send(*DependenciesServiceV2ConnectRequest) error Recv() (*DependenciesServiceV2ConnectResponse, error) grpc.ClientStream } @@ -54,10 +59,6 @@ type dependenciesServiceV2ConnectClient struct { grpc.ClientStream } -func (x *dependenciesServiceV2ConnectClient) Send(m *DependenciesServiceV2ConnectRequest) error { - return x.ClientStream.SendMsg(m) -} - func (x *dependenciesServiceV2ConnectClient) Recv() (*DependenciesServiceV2ConnectResponse, error) { m := new(DependenciesServiceV2ConnectResponse) if err := x.ClientStream.RecvMsg(m); err != nil { @@ -113,7 +114,7 @@ func (x *dependenciesServiceV2UpdateTaskLogClient) CloseAndRecv() (*Response, er // All implementations must embed UnimplementedDependenciesServiceV2Server // for forward compatibility type DependenciesServiceV2Server interface { - Connect(DependenciesServiceV2_ConnectServer) error + Connect(*DependenciesServiceV2ConnectRequest, DependenciesServiceV2_ConnectServer) error Sync(context.Context, *DependenciesServiceV2SyncRequest) (*Response, error) UpdateTaskLog(DependenciesServiceV2_UpdateTaskLogServer) error mustEmbedUnimplementedDependenciesServiceV2Server() @@ -123,7 +124,7 @@ type DependenciesServiceV2Server interface { type UnimplementedDependenciesServiceV2Server struct { } -func (UnimplementedDependenciesServiceV2Server) Connect(DependenciesServiceV2_ConnectServer) error { +func (UnimplementedDependenciesServiceV2Server) Connect(*DependenciesServiceV2ConnectRequest, DependenciesServiceV2_ConnectServer) error { return status.Errorf(codes.Unimplemented, "method Connect not implemented") } func (UnimplementedDependenciesServiceV2Server) Sync(context.Context, *DependenciesServiceV2SyncRequest) (*Response, error) { @@ -146,12 +147,15 @@ func RegisterDependenciesServiceV2Server(s grpc.ServiceRegistrar, srv Dependenci } func _DependenciesServiceV2_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DependenciesServiceV2Server).Connect(&dependenciesServiceV2ConnectServer{stream}) + m := new(DependenciesServiceV2ConnectRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DependenciesServiceV2Server).Connect(m, &dependenciesServiceV2ConnectServer{stream}) } type DependenciesServiceV2_ConnectServer interface { Send(*DependenciesServiceV2ConnectResponse) error - Recv() (*DependenciesServiceV2ConnectRequest, error) grpc.ServerStream } @@ -163,14 +167,6 @@ func (x *dependenciesServiceV2ConnectServer) Send(m *DependenciesServiceV2Connec return x.ServerStream.SendMsg(m) } -func (x *dependenciesServiceV2ConnectServer) Recv() (*DependenciesServiceV2ConnectRequest, error) { - m := new(DependenciesServiceV2ConnectRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - func _DependenciesServiceV2_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(DependenciesServiceV2SyncRequest) if err := dec(in); err != nil { @@ -232,7 +228,6 @@ var DependenciesServiceV2_ServiceDesc = grpc.ServiceDesc{ StreamName: "Connect", Handler: _DependenciesServiceV2_Connect_Handler, ServerStreams: true, - ClientStreams: true, }, { StreamName: "UpdateTaskLog", diff --git a/grpc/dependencies_service_v2_request.pb.go b/grpc/dependencies_service_v2_request.pb.go deleted file mode 100644 index cae03422..00000000 --- a/grpc/dependencies_service_v2_request.pb.go +++ /dev/null @@ -1,488 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.25.0 -// protoc v3.20.1 -// source: entity/dependencies_service_v2_request.proto - -package grpc - -import ( - proto "github.com/golang/protobuf/proto" - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// This is a compile-time assertion that a sufficiently up-to-date version -// of the legacy proto package is being used. -const _ = proto.ProtoPackageIsVersion4 - -type Dependency struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` -} - -func (x *Dependency) Reset() { - *x = Dependency{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Dependency) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Dependency) ProtoMessage() {} - -func (x *Dependency) ProtoReflect() protoreflect.Message { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use Dependency.ProtoReflect.Descriptor instead. -func (*Dependency) Descriptor() ([]byte, []int) { - return file_entity_dependencies_service_v2_request_proto_rawDescGZIP(), []int{0} -} - -func (x *Dependency) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Dependency) GetVersion() string { - if x != nil { - return x.Version - } - return "" -} - -type DependenciesServiceV2ConnectRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` -} - -func (x *DependenciesServiceV2ConnectRequest) Reset() { - *x = DependenciesServiceV2ConnectRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2ConnectRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2ConnectRequest) ProtoMessage() {} - -func (x *DependenciesServiceV2ConnectRequest) ProtoReflect() protoreflect.Message { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DependenciesServiceV2ConnectRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2ConnectRequest) Descriptor() ([]byte, []int) { - return file_entity_dependencies_service_v2_request_proto_rawDescGZIP(), []int{1} -} - -func (x *DependenciesServiceV2ConnectRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -type DependenciesServiceV2SyncRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - 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"` - Dependencies []*Dependency `protobuf:"bytes,3,rep,name=dependencies,proto3" json:"dependencies,omitempty"` -} - -func (x *DependenciesServiceV2SyncRequest) Reset() { - *x = DependenciesServiceV2SyncRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2SyncRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2SyncRequest) ProtoMessage() {} - -func (x *DependenciesServiceV2SyncRequest) ProtoReflect() protoreflect.Message { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DependenciesServiceV2SyncRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2SyncRequest) Descriptor() ([]byte, []int) { - return file_entity_dependencies_service_v2_request_proto_rawDescGZIP(), []int{2} -} - -func (x *DependenciesServiceV2SyncRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *DependenciesServiceV2SyncRequest) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *DependenciesServiceV2SyncRequest) GetDependencies() []*Dependency { - if x != nil { - return x.Dependencies - } - return nil -} - -type DependenciesServiceV2InstallRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - 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"` - Dependencies []*Dependency `protobuf:"bytes,3,rep,name=dependencies,proto3" json:"dependencies,omitempty"` - Proxy string `protobuf:"bytes,4,opt,name=proxy,proto3" json:"proxy,omitempty"` -} - -func (x *DependenciesServiceV2InstallRequest) Reset() { - *x = DependenciesServiceV2InstallRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2InstallRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2InstallRequest) ProtoMessage() {} - -func (x *DependenciesServiceV2InstallRequest) ProtoReflect() protoreflect.Message { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[3] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DependenciesServiceV2InstallRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2InstallRequest) Descriptor() ([]byte, []int) { - return file_entity_dependencies_service_v2_request_proto_rawDescGZIP(), []int{3} -} - -func (x *DependenciesServiceV2InstallRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *DependenciesServiceV2InstallRequest) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *DependenciesServiceV2InstallRequest) GetDependencies() []*Dependency { - if x != nil { - return x.Dependencies - } - return nil -} - -func (x *DependenciesServiceV2InstallRequest) GetProxy() string { - if x != nil { - return x.Proxy - } - return "" -} - -type DependenciesServiceV2UninstallRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - 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"` - Dependencies []*Dependency `protobuf:"bytes,3,rep,name=dependencies,proto3" json:"dependencies,omitempty"` -} - -func (x *DependenciesServiceV2UninstallRequest) Reset() { - *x = DependenciesServiceV2UninstallRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2UninstallRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2UninstallRequest) ProtoMessage() {} - -func (x *DependenciesServiceV2UninstallRequest) ProtoReflect() protoreflect.Message { - mi := &file_entity_dependencies_service_v2_request_proto_msgTypes[4] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use DependenciesServiceV2UninstallRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2UninstallRequest) Descriptor() ([]byte, []int) { - return file_entity_dependencies_service_v2_request_proto_rawDescGZIP(), []int{4} -} - -func (x *DependenciesServiceV2UninstallRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *DependenciesServiceV2UninstallRequest) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *DependenciesServiceV2UninstallRequest) GetDependencies() []*Dependency { - if x != nil { - return x.Dependencies - } - return nil -} - -var File_entity_dependencies_service_v2_request_proto protoreflect.FileDescriptor - -var file_entity_dependencies_service_v2_request_proto_rawDesc = []byte{ - 0x0a, 0x2c, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, - 0x6e, 0x63, 0x69, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x32, - 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, - 0x67, 0x72, 0x70, 0x63, 0x22, 0x3a, 0x0a, 0x0a, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x63, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x22, 0x40, 0x0a, 0x23, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 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, 0x22, 0x87, 0x01, 0x0a, 0x20, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, - 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x53, 0x79, 0x6e, 0x63, - 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, 0x34, 0x0a, 0x0c, 0x64, 0x65, 0x70, 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, 0xa0, 0x01, 0x0a, - 0x23, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x53, 0x65, 0x72, - 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x49, 0x6e, 0x73, 0x74, 0x61, 0x6c, 0x6c, 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, 0x34, 0x0a, 0x0c, 0x64, 0x65, 0x70, 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, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, - 0x78, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x22, - 0x8c, 0x01, 0x0a, 0x25, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x55, 0x6e, 0x69, 0x6e, 0x73, 0x74, 0x61, - 0x6c, 0x6c, 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, 0x34, 0x0a, 0x0c, 0x64, 0x65, 0x70, 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, 0x42, 0x08, - 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_dependencies_service_v2_request_proto_rawDescOnce sync.Once - file_entity_dependencies_service_v2_request_proto_rawDescData = file_entity_dependencies_service_v2_request_proto_rawDesc -) - -func file_entity_dependencies_service_v2_request_proto_rawDescGZIP() []byte { - file_entity_dependencies_service_v2_request_proto_rawDescOnce.Do(func() { - file_entity_dependencies_service_v2_request_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_dependencies_service_v2_request_proto_rawDescData) - }) - return file_entity_dependencies_service_v2_request_proto_rawDescData -} - -var file_entity_dependencies_service_v2_request_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_entity_dependencies_service_v2_request_proto_goTypes = []interface{}{ - (*Dependency)(nil), // 0: grpc.Dependency - (*DependenciesServiceV2ConnectRequest)(nil), // 1: grpc.DependenciesServiceV2ConnectRequest - (*DependenciesServiceV2SyncRequest)(nil), // 2: grpc.DependenciesServiceV2SyncRequest - (*DependenciesServiceV2InstallRequest)(nil), // 3: grpc.DependenciesServiceV2InstallRequest - (*DependenciesServiceV2UninstallRequest)(nil), // 4: grpc.DependenciesServiceV2UninstallRequest -} -var file_entity_dependencies_service_v2_request_proto_depIdxs = []int32{ - 0, // 0: grpc.DependenciesServiceV2SyncRequest.dependencies:type_name -> grpc.Dependency - 0, // 1: grpc.DependenciesServiceV2InstallRequest.dependencies:type_name -> grpc.Dependency - 0, // 2: grpc.DependenciesServiceV2UninstallRequest.dependencies:type_name -> grpc.Dependency - 3, // [3:3] is the sub-list for method output_type - 3, // [3:3] 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 -} - -func init() { file_entity_dependencies_service_v2_request_proto_init() } -func file_entity_dependencies_service_v2_request_proto_init() { - if File_entity_dependencies_service_v2_request_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_entity_dependencies_service_v2_request_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Dependency); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_entity_dependencies_service_v2_request_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DependenciesServiceV2ConnectRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_entity_dependencies_service_v2_request_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DependenciesServiceV2SyncRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_entity_dependencies_service_v2_request_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DependenciesServiceV2InstallRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_entity_dependencies_service_v2_request_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*DependenciesServiceV2UninstallRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_entity_dependencies_service_v2_request_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_dependencies_service_v2_request_proto_goTypes, - DependencyIndexes: file_entity_dependencies_service_v2_request_proto_depIdxs, - MessageInfos: file_entity_dependencies_service_v2_request_proto_msgTypes, - }.Build() - File_entity_dependencies_service_v2_request_proto = out.File - file_entity_dependencies_service_v2_request_proto_rawDesc = nil - file_entity_dependencies_service_v2_request_proto_goTypes = nil - file_entity_dependencies_service_v2_request_proto_depIdxs = nil -} diff --git a/grpc/proto/services/dependencies_service_v2.proto b/grpc/proto/services/dependencies_service_v2.proto index b09f9c94..6f4e0578 100644 --- a/grpc/proto/services/dependencies_service_v2.proto +++ b/grpc/proto/services/dependencies_service_v2.proto @@ -36,11 +36,11 @@ message DependenciesServiceV2SyncRequest { message DependenciesServiceV2UpdateTaskLogRequest { string task_id = 1; - string content = 2; + repeated string log_lines = 2; } service DependenciesServiceV2 { - rpc Connect(stream DependenciesServiceV2ConnectRequest) returns (stream DependenciesServiceV2ConnectResponse){}; + rpc Connect(DependenciesServiceV2ConnectRequest) returns (stream DependenciesServiceV2ConnectResponse){}; rpc Sync(DependenciesServiceV2SyncRequest) returns (Response){}; rpc UpdateTaskLog(stream DependenciesServiceV2UpdateTaskLogRequest) returns (Response){}; }