diff --git a/core/apps/server_v2.go b/core/apps/server_v2.go index 80a67dfa..71fd6c5a 100644 --- a/core/apps/server_v2.go +++ b/core/apps/server_v2.go @@ -104,9 +104,9 @@ func NewServerV2() (app NodeApp) { // node service var err error if utils.IsMaster() { - svr.nodeSvc, err = service.GetMasterServiceV2() + svr.nodeSvc, err = service.GetMasterService() } else { - svr.nodeSvc, err = service.GetWorkerServiceV2() + svr.nodeSvc, err = service.GetWorkerService() } if err != nil { panic(err) diff --git a/core/grpc/server/dependencies_server_v2.go b/core/grpc/server/dependency_service_server.go similarity index 71% rename from core/grpc/server/dependencies_server_v2.go rename to core/grpc/server/dependency_service_server.go index 32c39760..27f6d94c 100644 --- a/core/grpc/server/dependencies_server_v2.go +++ b/core/grpc/server/dependency_service_server.go @@ -17,29 +17,29 @@ import ( "time" ) -type DependenciesServerV2 struct { - grpc.UnimplementedDependenciesServiceV2Server +type DependencyServiceServer struct { + grpc.UnimplementedDependencyServiceV2Server mu *sync.Mutex - streams map[string]*grpc.DependenciesServiceV2_ConnectServer + streams map[string]*grpc.DependencyServiceV2_ConnectServer } -func (svr DependenciesServerV2) Connect(req *grpc.DependenciesServiceV2ConnectRequest, stream grpc.DependenciesServiceV2_ConnectServer) (err error) { +func (svr DependencyServiceServer) Connect(req *grpc.DependencyServiceV2ConnectRequest, stream grpc.DependencyServiceV2_ConnectServer) (err error) { svr.mu.Lock() svr.streams[req.NodeKey] = &stream svr.mu.Unlock() - log.Info("[DependenciesServerV2] connected: " + req.NodeKey) + log.Info("[DependencyServiceServer] 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) + log.Info("[DependencyServiceServer] disconnected: " + req.NodeKey) return nil } } } -func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.DependenciesServiceV2SyncRequest) (response *grpc.Response, err error) { +func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.DependencyServiceV2SyncRequest) (response *grpc.Response, err error) { n, err := service.NewModelServiceV2[models2.NodeV2]().GetOne(bson.M{"key": request.NodeKey}, nil) if err != nil { return nil, err @@ -51,7 +51,7 @@ func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.Dependen }, nil) if err != nil { if !errors.Is(err, mongo.ErrNoDocuments) { - log.Errorf("[DependenciesServiceV2] get dependencies from db error: %v", err) + log.Errorf("[DependencyServiceV2] get dependencies from db error: %v", err) return nil, err } } @@ -94,7 +94,7 @@ func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.Dependen "_id": bson.M{"$in": depIdsToDelete}, }) if err != nil { - log.Errorf("[DependenciesServerV2] delete dependencies in db error: %v", err) + log.Errorf("[DependencyServiceServer] delete dependencies in db error: %v", err) trace.PrintError(err) return err } @@ -103,7 +103,7 @@ func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.Dependen if len(depsToInsert) > 0 { _, err = service.NewModelServiceV2[models2.DependencyV2]().InsertMany(depsToInsert) if err != nil { - log.Errorf("[DependenciesServerV2] insert dependencies in db error: %v", err) + log.Errorf("[DependencyServiceServer] insert dependencies in db error: %v", err) trace.PrintError(err) return err } @@ -115,7 +115,7 @@ func (svr DependenciesServerV2) Sync(ctx context.Context, request *grpc.Dependen return nil, err } -func (svr DependenciesServerV2) UpdateTaskLog(stream grpc.DependenciesServiceV2_UpdateTaskLogServer) (err error) { +func (svr DependencyServiceServer) UpdateTaskLog(stream grpc.DependencyServiceV2_UpdateTaskLogServer) (err error) { var t *models2.DependencyTaskV2 for { req, err := stream.Recv() @@ -152,7 +152,7 @@ func (svr DependenciesServerV2) UpdateTaskLog(stream grpc.DependenciesServiceV2_ } } -func (svr DependenciesServerV2) GetStream(key string) (stream *grpc.DependenciesServiceV2_ConnectServer, err error) { +func (svr DependencyServiceServer) GetStream(key string) (stream *grpc.DependencyServiceV2_ConnectServer, err error) { svr.mu.Lock() defer svr.mu.Unlock() stream, ok := svr.streams[key] @@ -162,19 +162,19 @@ func (svr DependenciesServerV2) GetStream(key string) (stream *grpc.Dependencies return stream, nil } -func NewDependenciesServerV2() *DependenciesServerV2 { - return &DependenciesServerV2{ +func NewDependencyServerV2() *DependencyServiceServer { + return &DependencyServiceServer{ mu: new(sync.Mutex), - streams: make(map[string]*grpc.DependenciesServiceV2_ConnectServer), + streams: make(map[string]*grpc.DependencyServiceV2_ConnectServer), } } -var depSvc *DependenciesServerV2 +var depSvc *DependencyServiceServer -func GetDependenciesServerV2() *DependenciesServerV2 { +func GetDependencyServerV2() *DependencyServiceServer { if depSvc != nil { return depSvc } - depSvc = NewDependenciesServerV2() + depSvc = NewDependencyServerV2() return depSvc } diff --git a/core/grpc/server/metrics_server_v2.go b/core/grpc/server/metric_service_server.go similarity index 71% rename from core/grpc/server/metrics_server_v2.go rename to core/grpc/server/metric_service_server.go index 60a92569..e36ef0c0 100644 --- a/core/grpc/server/metrics_server_v2.go +++ b/core/grpc/server/metric_service_server.go @@ -11,15 +11,15 @@ import ( "time" ) -type MetricsServerV2 struct { - grpc.UnimplementedMetricsServiceV2Server +type MetricServiceServer struct { + grpc.UnimplementedMetricServiceV2Server } -func (svr MetricsServerV2) Send(_ context.Context, req *grpc.MetricsServiceV2SendRequest) (res *grpc.Response, err error) { - log.Info("[MetricsServerV2] received metric from node: " + req.NodeKey) +func (svr MetricServiceServer) Send(_ context.Context, req *grpc.MetricServiceV2SendRequest) (res *grpc.Response, err error) { + log.Info("[MetricServiceServer] received metric from node: " + req.NodeKey) n, err := service.NewModelServiceV2[models2.NodeV2]().GetOne(bson.M{"key": req.NodeKey}, nil) if err != nil { - log.Errorf("[MetricsServerV2] error getting node: %v", err) + log.Errorf("[MetricServiceServer] error getting node: %v", err) return HandleError(err) } metric := models2.MetricV2{ @@ -42,20 +42,20 @@ func (svr MetricsServerV2) Send(_ context.Context, req *grpc.MetricsServiceV2Sen metric.CreatedAt = time.Unix(req.Timestamp, 0) _, err = service.NewModelServiceV2[models2.MetricV2]().InsertOne(metric) if err != nil { - log.Errorf("[MetricsServerV2] error inserting metric: %v", err) + log.Errorf("[MetricServiceServer] error inserting metric: %v", err) return HandleError(err) } return HandleSuccess() } -func newMetricsServerV2() *MetricsServerV2 { - return &MetricsServerV2{} +func newMetricsServerV2() *MetricServiceServer { + return &MetricServiceServer{} } -var metricsServerV2 *MetricsServerV2 +var metricsServerV2 *MetricServiceServer var metricsServerV2Once = &sync.Once{} -func GetMetricsServerV2() *MetricsServerV2 { +func GetMetricsServerV2() *MetricServiceServer { if metricsServerV2 != nil { return metricsServerV2 } diff --git a/core/grpc/server/node_server_v2.go b/core/grpc/server/node_service_server.go similarity index 55% rename from core/grpc/server/node_server_v2.go rename to core/grpc/server/node_service_server.go index d1936e3e..3c504266 100644 --- a/core/grpc/server/node_server_v2.go +++ b/core/grpc/server/node_service_server.go @@ -4,7 +4,6 @@ import ( "context" "github.com/apex/log" "github.com/crawlab-team/crawlab/core/constants" - "github.com/crawlab-team/crawlab/core/entity" "github.com/crawlab-team/crawlab/core/errors" "github.com/crawlab-team/crawlab/core/interfaces" "github.com/crawlab-team/crawlab/core/models/models/v2" @@ -17,36 +16,34 @@ import ( "go.mongodb.org/mongo-driver/bson" "go.mongodb.org/mongo-driver/bson/primitive" "go.mongodb.org/mongo-driver/mongo" + "io" "sync" "time" ) -type NodeServerV2 struct { +var nodeServiceMutex = sync.Mutex{} + +type NodeServiceServer struct { grpc.UnimplementedNodeServiceServer // dependencies cfgSvc interfaces.NodeConfigService // internals - server *GrpcServerV2 + server *GrpcServer + subs map[primitive.ObjectID]grpc.NodeService_SubscribeServer } // Register from handler/worker to master -func (svr NodeServerV2) Register(_ context.Context, req *grpc.NodeServiceRegisterRequest) (res *grpc.Response, err error) { - // unmarshall data - if req.IsMaster { - // error: cannot register master node - return HandleError(errors.ErrorGrpcNotAllowed) - } - +func (svr NodeServiceServer) Register(_ context.Context, req *grpc.NodeServiceRegisterRequest) (res *grpc.Response, err error) { // node key - if req.Key == "" { + if req.NodeKey == "" { return HandleError(errors.ErrorModelMissingRequiredData) } // find in db var node *models.NodeV2 - node, err = service.NewModelServiceV2[models.NodeV2]().GetOne(bson.M{"key": req.Key}, nil) + node, err = service.NewModelServiceV2[models.NodeV2]().GetOne(bson.M{"key": req.NodeKey}, nil) if err == nil { // register existing node.Status = constants.NodeStatusRegistered @@ -56,12 +53,12 @@ func (svr NodeServerV2) Register(_ context.Context, req *grpc.NodeServiceRegiste if err != nil { return HandleError(err) } - log.Infof("[NodeServerV2] updated worker[%s] in db. id: %s", req.Key, node.Id.Hex()) + log.Infof("[NodeServiceServer] updated worker[%s] in db. id: %s", req.NodeKey, node.Id.Hex()) } else if errors2.Is(err, mongo.ErrNoDocuments) { // register new node = &models.NodeV2{ - Key: req.Key, - Name: req.Name, + Key: req.NodeKey, + Name: req.NodeName, Status: constants.NodeStatusRegistered, Active: true, ActiveAt: time.Now(), @@ -74,21 +71,21 @@ func (svr NodeServerV2) Register(_ context.Context, req *grpc.NodeServiceRegiste if err != nil { return HandleError(err) } - log.Infof("[NodeServerV2] added worker[%s] in db. id: %s", req.Key, node.Id.Hex()) + log.Infof("[NodeServiceServer] added worker[%s] in db. id: %s", req.NodeKey, node.Id.Hex()) } else { // error return HandleError(err) } - log.Infof("[NodeServerV2] master registered worker[%s]", req.Key) + log.Infof("[NodeServiceServer] master registered worker[%s]", req.NodeKey) return HandleSuccessWithData(node) } // SendHeartbeat from worker to master -func (svr NodeServerV2) SendHeartbeat(_ context.Context, req *grpc.NodeServiceSendHeartbeatRequest) (res *grpc.Response, err error) { +func (svr NodeServiceServer) SendHeartbeat(_ context.Context, req *grpc.NodeServiceSendHeartbeatRequest) (res *grpc.Response, err error) { // find in db - node, err := service.NewModelServiceV2[models.NodeV2]().GetOne(bson.M{"key": req.Key}, nil) + node, err := service.NewModelServiceV2[models.NodeV2]().GetOne(bson.M{"key": req.NodeKey}, nil) if err != nil { if errors2.Is(err, mongo.ErrNoDocuments) { return HandleError(errors.ErrorNodeNotExists) @@ -122,64 +119,66 @@ func (svr NodeServerV2) SendHeartbeat(_ context.Context, req *grpc.NodeServiceSe return HandleSuccessWithData(node) } -func (svr NodeServerV2) Subscribe(request *grpc.Request, stream grpc.NodeService_SubscribeServer) (err error) { - log.Infof("[NodeServerV2] master received subscribe request from node[%s]", request.NodeKey) +func (svr NodeServiceServer) Subscribe(request *grpc.NodeServiceSubscribeRequest, stream grpc.NodeService_SubscribeServer) (err error) { + log.Infof("[NodeServiceServer] master received subscribe request from node[%s]", request.NodeKey) - // finished channel - finished := make(chan bool) - - // set subscribe - svr.server.SetSubscribe("node:"+request.NodeKey, &entity.GrpcSubscribe{ - Stream: stream, - Finished: finished, - }) - ctx := stream.Context() - - log.Infof("[NodeServerV2] master subscribed node[%s]", request.NodeKey) - - // Keep this scope alive because once this scope exits - the stream is closed - for { - select { - case <-finished: - log.Infof("[NodeServerV2] closing stream for node[%s]", request.NodeKey) - return nil - case <-ctx.Done(): - log.Infof("[NodeServerV2] node[%s] has disconnected", request.NodeKey) - return nil - } - } -} - -func (svr NodeServerV2) Unsubscribe(_ context.Context, req *grpc.Request) (res *grpc.Response, err error) { - sub, err := svr.server.GetSubscribe("node:" + req.NodeKey) + // find in db + node, err := service.NewModelServiceV2[models.NodeV2]().GetOne(bson.M{"key": request.NodeKey}, nil) if err != nil { - return nil, errors.ErrorGrpcSubscribeNotExists + log.Errorf("[NodeServiceServer] error getting node: %v", err) + return err } - select { - case sub.GetFinished() <- true: - log.Infof("unsubscribed node[%s]", req.NodeKey) - default: - // Default case is to avoid blocking in case client has already unsubscribed - } - svr.server.DeleteSubscribe(req.NodeKey) - return &grpc.Response{ - Code: grpc.ResponseCode_OK, - Message: "unsubscribed successfully", - }, nil + + // subscribe + nodeServiceMutex.Lock() + svr.subs[node.Id] = stream + nodeServiceMutex.Unlock() + + // TODO: send notification + + // create a new goroutine to receive messages from the stream to listen for EOF (end of stream) + go func() { + for { + select { + case <-stream.Context().Done(): + nodeServiceMutex.Lock() + delete(svr.subs, node.Id) + nodeServiceMutex.Unlock() + return + default: + err := stream.RecvMsg(nil) + if err == io.EOF { + nodeServiceMutex.Lock() + delete(svr.subs, node.Id) + nodeServiceMutex.Unlock() + return + } + } + } + }() + + return nil } -var nodeSvrV2 *NodeServerV2 +func (svr NodeServiceServer) GetSubscribeStream(nodeId primitive.ObjectID) (stream grpc.NodeService_SubscribeServer, ok bool) { + nodeServiceMutex.Lock() + defer nodeServiceMutex.Unlock() + stream, ok = svr.subs[nodeId] + return stream, ok +} + +var nodeSvrV2 *NodeServiceServer var nodeSvrV2Once = new(sync.Once) -func NewNodeServerV2() (res *NodeServerV2, err error) { +func NewNodeServiceServer() (res *NodeServiceServer, err error) { if nodeSvrV2 != nil { return nodeSvrV2, nil } nodeSvrV2Once.Do(func() { - nodeSvrV2 = &NodeServerV2{} + nodeSvrV2 = &NodeServiceServer{} nodeSvrV2.cfgSvc = nodeconfig.GetNodeConfigService() if err != nil { - log.Errorf("[NodeServerV2] error: %s", err.Error()) + log.Errorf("[NodeServiceServer] error: %s", err.Error()) } }) if err != nil { diff --git a/core/grpc/server/server_v2.go b/core/grpc/server/server_v2.go index e8c8ba06..e8c21ccc 100644 --- a/core/grpc/server/server_v2.go +++ b/core/grpc/server/server_v2.go @@ -1,7 +1,6 @@ package server import ( - "encoding/json" "fmt" "github.com/apex/log" "github.com/crawlab-team/crawlab/core/constants" @@ -17,7 +16,6 @@ import ( grpc_recovery "github.com/grpc-ecosystem/go-grpc-middleware/recovery" errors2 "github.com/pkg/errors" "github.com/spf13/viper" - "go/types" "google.golang.org/grpc" "net" "sync" @@ -28,7 +26,7 @@ var ( mutexSubsV2 = &sync.Mutex{} ) -type GrpcServerV2 struct { +type GrpcServer struct { // settings cfgPath string address interfaces.Address @@ -42,22 +40,22 @@ type GrpcServerV2 struct { nodeCfgSvc interfaces.NodeConfigService // servers - NodeSvr *NodeServerV2 - TaskSvr *TaskServerV2 + NodeSvr *NodeServiceServer + TaskSvr *TaskServiceServer ModelBaseServiceSvr *ModelBaseServiceServerV2 - DependenciesSvr *DependenciesServerV2 - MetricsSvr *MetricsServerV2 + DependencySvr *DependencyServiceServer + MetricSvr *MetricServiceServer } -func (svr *GrpcServerV2) GetConfigPath() (path string) { +func (svr *GrpcServer) GetConfigPath() (path string) { return svr.cfgPath } -func (svr *GrpcServerV2) SetConfigPath(path string) { +func (svr *GrpcServer) SetConfigPath(path string) { svr.cfgPath = path } -func (svr *GrpcServerV2) Init() (err error) { +func (svr *GrpcServer) Init() (err error) { // register if err := svr.Register(); err != nil { return err @@ -66,7 +64,7 @@ func (svr *GrpcServerV2) Init() (err error) { return nil } -func (svr *GrpcServerV2) Start() (err error) { +func (svr *GrpcServer) Start() (err error) { // grpc server binding address address := svr.address.String() @@ -92,7 +90,7 @@ func (svr *GrpcServerV2) Start() (err error) { return nil } -func (svr *GrpcServerV2) Stop() (err error) { +func (svr *GrpcServer) Stop() (err error) { // skip if listener is nil if svr.l == nil { return nil @@ -115,27 +113,27 @@ func (svr *GrpcServerV2) Stop() (err error) { return nil } -func (svr *GrpcServerV2) Register() (err error) { +func (svr *GrpcServer) Register() (err error) { grpc2.RegisterNodeServiceServer(svr.svr, *svr.NodeSvr) grpc2.RegisterModelBaseServiceV2Server(svr.svr, *svr.ModelBaseServiceSvr) grpc2.RegisterTaskServiceServer(svr.svr, *svr.TaskSvr) - grpc2.RegisterDependenciesServiceV2Server(svr.svr, *svr.DependenciesSvr) - grpc2.RegisterMetricsServiceV2Server(svr.svr, *svr.MetricsSvr) + grpc2.RegisterDependencyServiceV2Server(svr.svr, *svr.DependencySvr) + grpc2.RegisterMetricServiceV2Server(svr.svr, *svr.MetricSvr) return nil } -func (svr *GrpcServerV2) recoveryHandlerFunc(p interface{}) (err error) { +func (svr *GrpcServer) recoveryHandlerFunc(p interface{}) (err error) { err = errors.NewError(errors.ErrorPrefixGrpc, fmt.Sprintf("%v", p)) trace.PrintError(err) return err } -func (svr *GrpcServerV2) SetAddress(address interfaces.Address) { +func (svr *GrpcServer) SetAddress(address interfaces.Address) { } -func (svr *GrpcServerV2) GetSubscribe(key string) (sub interfaces.GrpcSubscribe, err error) { +func (svr *GrpcServer) GetSubscribe(key string) (sub interfaces.GrpcSubscribe, err error) { mutexSubsV2.Lock() defer mutexSubsV2.Unlock() sub, ok := subsV2[key] @@ -145,55 +143,25 @@ func (svr *GrpcServerV2) GetSubscribe(key string) (sub interfaces.GrpcSubscribe, return sub, nil } -func (svr *GrpcServerV2) SetSubscribe(key string, sub interfaces.GrpcSubscribe) { +func (svr *GrpcServer) SetSubscribe(key string, sub interfaces.GrpcSubscribe) { mutexSubsV2.Lock() defer mutexSubsV2.Unlock() subsV2[key] = sub } -func (svr *GrpcServerV2) DeleteSubscribe(key string) { +func (svr *GrpcServer) DeleteSubscribe(key string) { mutexSubsV2.Lock() defer mutexSubsV2.Unlock() delete(subsV2, key) } -func (svr *GrpcServerV2) SendStreamMessage(key string, code grpc2.StreamMessageCode) (err error) { - return svr.SendStreamMessageWithData(key, code, nil) -} - -func (svr *GrpcServerV2) SendStreamMessageWithData(key string, code grpc2.StreamMessageCode, d interface{}) (err error) { - var data []byte - switch d.(type) { - case types.Nil: - // do nothing - case []byte: - data = d.([]byte) - default: - var err error - data, err = json.Marshal(d) - if err != nil { - return err - } - } - sub, err := svr.GetSubscribe(key) - if err != nil { - return err - } - msg := &grpc2.StreamMessage{ - Code: code, - Key: svr.nodeCfgSvc.GetNodeKey(), - Data: data, - } - return sub.GetStream().Send(msg) -} - -func (svr *GrpcServerV2) IsStopped() (res bool) { +func (svr *GrpcServer) IsStopped() (res bool) { return svr.stopped } -func NewGrpcServerV2() (svr *GrpcServerV2, err error) { +func NewGrpcServerV2() (svr *GrpcServer, err error) { // server - svr = &GrpcServerV2{ + svr = &GrpcServer{ address: entity.NewAddress(&entity.AddressOptions{ Host: constants.DefaultGrpcServerHost, Port: constants.DefaultGrpcServerPort, @@ -209,17 +177,17 @@ func NewGrpcServerV2() (svr *GrpcServerV2, err error) { svr.nodeCfgSvc = nodeconfig.GetNodeConfigService() - svr.NodeSvr, err = NewNodeServerV2() + svr.NodeSvr, err = NewNodeServiceServer() if err != nil { return nil, err } svr.ModelBaseServiceSvr = NewModelBaseServiceV2Server() - svr.TaskSvr, err = NewTaskServerV2() + svr.TaskSvr, err = NewTaskServiceServer() if err != nil { return nil, err } - svr.DependenciesSvr = GetDependenciesServerV2() - svr.MetricsSvr = GetMetricsServerV2() + svr.DependencySvr = GetDependenciesServerV2() + svr.MetricSvr = GetMetricsServerV2() // recovery options recoveryOpts := []grpc_recovery.Option{ @@ -246,9 +214,9 @@ func NewGrpcServerV2() (svr *GrpcServerV2, err error) { return svr, nil } -var _serverV2 *GrpcServerV2 +var _serverV2 *GrpcServer -func GetGrpcServerV2() (svr *GrpcServerV2, err error) { +func GetGrpcServerV2() (svr *GrpcServer, err error) { if _serverV2 != nil { return _serverV2, nil } diff --git a/core/grpc/server/task_server_v2.go b/core/grpc/server/task_service_server.go similarity index 66% rename from core/grpc/server/task_server_v2.go rename to core/grpc/server/task_service_server.go index 3f53455b..bb326894 100644 --- a/core/grpc/server/task_server_v2.go +++ b/core/grpc/server/task_service_server.go @@ -6,7 +6,6 @@ import ( "errors" "github.com/apex/log" "github.com/crawlab-team/crawlab/core/constants" - "github.com/crawlab-team/crawlab/core/entity" "github.com/crawlab-team/crawlab/core/interfaces" models2 "github.com/crawlab-team/crawlab/core/models/models/v2" "github.com/crawlab-team/crawlab/core/models/service" @@ -22,9 +21,12 @@ import ( mongo2 "go.mongodb.org/mongo-driver/mongo" "io" "strings" + "sync" ) -type TaskServerV2 struct { +var taskServiceMutex = sync.Mutex{} + +type TaskServiceServer struct { grpc.UnimplementedTaskServiceServer // dependencies @@ -33,10 +35,52 @@ type TaskServerV2 struct { // internals server interfaces.GrpcServer + subs map[primitive.ObjectID]grpc.TaskService_SubscribeServer } -// Subscribe to task stream when a task runner in a node starts -func (svr TaskServerV2) Subscribe(stream grpc.TaskService_SubscribeServer) (err error) { +func (svr TaskServiceServer) Subscribe(req *grpc.TaskServiceSubscribeRequest, stream grpc.TaskService_SubscribeServer) (err error) { + // task id + taskId, err := primitive.ObjectIDFromHex(req.TaskId) + if err != nil { + return errors.New("invalid task id") + } + + // validate stream + if stream == nil { + return errors.New("invalid stream") + } + + // add stream + taskServiceMutex.Lock() + svr.subs[taskId] = stream + taskServiceMutex.Unlock() + + // create a new goroutine to receive messages from the stream to listen for EOF (end of stream) + go func() { + for { + select { + case <-stream.Context().Done(): + taskServiceMutex.Lock() + delete(svr.subs, taskId) + taskServiceMutex.Unlock() + return + default: + err := stream.RecvMsg(nil) + if err == io.EOF { + taskServiceMutex.Lock() + delete(svr.subs, taskId) + taskServiceMutex.Unlock() + return + } + } + } + }() + + return nil +} + +// Connect to task stream when a task runner in a node starts +func (svr TaskServiceServer) Connect(stream grpc.TaskService_ConnectServer) (err error) { for { msg, err := stream.Recv() if err == io.EOF { @@ -49,11 +93,19 @@ func (svr TaskServerV2) Subscribe(stream grpc.TaskService_SubscribeServer) (err trace.PrintError(err) continue } + + // validate task id + taskId, err := primitive.ObjectIDFromHex(msg.TaskId) + if err != nil { + log.Errorf("invalid task id: %s", msg.TaskId) + continue + } + switch msg.Code { - case grpc.StreamMessageCode_INSERT_DATA: - err = svr.handleInsertData(msg) - case grpc.StreamMessageCode_INSERT_LOGS: - err = svr.handleInsertLogs(msg) + case grpc.TaskServiceConnectCode_INSERT_DATA: + err = svr.handleInsertData(taskId, msg) + case grpc.TaskServiceConnectCode_INSERT_LOGS: + err = svr.handleInsertLogs(taskId, msg) default: err = errors.New("invalid stream message code") log.Errorf("invalid stream message code: %d", msg.Code) @@ -65,8 +117,8 @@ func (svr TaskServerV2) Subscribe(stream grpc.TaskService_SubscribeServer) (err } } -// Fetch tasks to be executed by a task handler -func (svr TaskServerV2) Fetch(ctx context.Context, request *grpc.Request) (response *grpc.Response, err error) { +// FetchTask tasks to be executed by a task handler +func (svr TaskServiceServer) FetchTask(ctx context.Context, request *grpc.TaskServiceFetchTaskRequest) (response *grpc.TaskServiceFetchTaskResponse, err error) { nodeKey := request.GetNodeKey() if nodeKey == "" { return nil, errors.New("invalid node key") @@ -105,10 +157,10 @@ func (svr TaskServerV2) Fetch(ctx context.Context, request *grpc.Request) (respo }); err != nil { return nil, err } - return HandleSuccessWithData(tid) + return &grpc.TaskServiceFetchTaskResponse{TaskId: tid.Hex()}, nil } -func (svr TaskServerV2) SendNotification(_ context.Context, request *grpc.TaskServiceSendNotificationRequest) (response *grpc.Response, err error) { +func (svr TaskServiceServer) SendNotification(_ context.Context, request *grpc.TaskServiceSendNotificationRequest) (response *grpc.Response, err error) { if !utils.IsPro() { return nil, nil } @@ -208,27 +260,32 @@ func (svr TaskServerV2) SendNotification(_ context.Context, request *grpc.TaskSe return nil, nil } -func (svr TaskServerV2) handleInsertData(msg *grpc.StreamMessage) (err error) { - data, err := svr.deserialize(msg) - if err != nil { - return err - } +func (svr TaskServiceServer) GetSubscribeStream(taskId primitive.ObjectID) (stream grpc.TaskService_SubscribeServer, ok bool) { + taskServiceMutex.Lock() + defer taskServiceMutex.Unlock() + stream, ok = svr.subs[taskId] + return stream, ok +} + +func (svr TaskServiceServer) handleInsertData(taskId primitive.ObjectID, msg *grpc.TaskServiceConnectRequest) (err error) { var records []map[string]interface{} - for _, d := range data.Records { - records = append(records, d) - } - return svr.statsSvc.InsertData(data.TaskId, records...) -} - -func (svr TaskServerV2) handleInsertLogs(msg *grpc.StreamMessage) (err error) { - data, err := svr.deserialize(msg) + err = json.Unmarshal(msg.Data, &records) if err != nil { - return err + return trace.TraceError(err) } - return svr.statsSvc.InsertLogs(data.TaskId, data.Logs...) + return svr.statsSvc.InsertData(taskId, records...) } -func (svr TaskServerV2) getTaskQueueItemIdAndDequeue(query bson.M, opts *mongo.FindOptions, nid primitive.ObjectID) (tid primitive.ObjectID, err error) { +func (svr TaskServiceServer) handleInsertLogs(taskId primitive.ObjectID, msg *grpc.TaskServiceConnectRequest) (err error) { + var logs []string + err = json.Unmarshal(msg.Data, &logs) + if err != nil { + return trace.TraceError(err) + } + return svr.statsSvc.InsertLogs(taskId, logs...) +} + +func (svr TaskServiceServer) getTaskQueueItemIdAndDequeue(query bson.M, opts *mongo.FindOptions, nid primitive.ObjectID) (tid primitive.ObjectID, err error) { tq, err := service.NewModelServiceV2[models2.TaskQueueItemV2]().GetOne(query, opts) if err != nil { if errors.Is(err, mongo2.ErrNoDocuments) { @@ -251,19 +308,9 @@ func (svr TaskServerV2) getTaskQueueItemIdAndDequeue(query bson.M, opts *mongo.F return tq.Id, nil } -func (svr TaskServerV2) deserialize(msg *grpc.StreamMessage) (data entity.StreamMessageTaskData, err error) { - if err := json.Unmarshal(msg.Data, &data); err != nil { - return data, trace.TraceError(err) - } - if data.TaskId.IsZero() { - return data, errors.New("invalid task id") - } - return data, nil -} - -func NewTaskServerV2() (res *TaskServerV2, err error) { +func NewTaskServiceServer() (res *TaskServiceServer, err error) { // task server - svr := &TaskServerV2{} + svr := &TaskServiceServer{} svr.cfgSvc = nodeconfig.GetNodeConfigService() diff --git a/core/interfaces/node_master_service.go b/core/interfaces/node_master_service.go index dc9dcfc8..8c9ab572 100644 --- a/core/interfaces/node_master_service.go +++ b/core/interfaces/node_master_service.go @@ -9,6 +9,4 @@ type NodeMasterService interface { Monitor() SetMonitorInterval(duration time.Duration) Register() error - StopOnError() - GetServer() GrpcServer } diff --git a/core/interfaces/node_service.go b/core/interfaces/node_service.go index 54cf7885..36ab35f2 100644 --- a/core/interfaces/node_service.go +++ b/core/interfaces/node_service.go @@ -3,6 +3,5 @@ package interfaces type NodeService interface { Module WithConfigPath - WithAddress GetConfigService() NodeConfigService } diff --git a/core/interfaces/node_worker_service.go b/core/interfaces/node_worker_service.go index b25c654a..15f136e8 100644 --- a/core/interfaces/node_worker_service.go +++ b/core/interfaces/node_worker_service.go @@ -5,7 +5,6 @@ import "time" type NodeWorkerService interface { NodeService Register() - Recv() ReportStatus() SetHeartbeatInterval(duration time.Duration) } diff --git a/core/interfaces/task_runner.go b/core/interfaces/task_runner.go index 90714e04..9815c3a1 100644 --- a/core/interfaces/task_runner.go +++ b/core/interfaces/task_runner.go @@ -11,5 +11,4 @@ type TaskRunner interface { Cancel(force bool) (err error) SetSubscribeTimeout(timeout time.Duration) GetTaskId() (id primitive.ObjectID) - CleanUp() (err error) } diff --git a/core/models/client/model_service_v2_test.go b/core/models/client/model_service_v2_test.go index 9ed1b05d..f8a4b2f2 100644 --- a/core/models/client/model_service_v2_test.go +++ b/core/models/client/model_service_v2_test.go @@ -29,14 +29,14 @@ func teardownTestDB() { db.Drop(context.Background()) } -func startSvr(svr *server.GrpcServerV2) { +func startSvr(svr *server.GrpcServer) { err := svr.Start() if err != nil { log.Errorf("failed to start grpc server: %v", err) } } -func stopSvr(svr *server.GrpcServerV2) { +func stopSvr(svr *server.GrpcServer) { err := svr.Stop() if err != nil { log.Errorf("failed to stop grpc server: %v", err) diff --git a/core/node/service/master_service_v2.go b/core/node/service/master_service.go similarity index 77% rename from core/node/service/master_service_v2.go rename to core/node/service/master_service.go index 610829a8..b444ab3f 100644 --- a/core/node/service/master_service_v2.go +++ b/core/node/service/master_service.go @@ -27,10 +27,10 @@ import ( "time" ) -type MasterServiceV2 struct { +type MasterService struct { // dependencies cfgSvc interfaces.NodeConfigService - server *server.GrpcServerV2 + server *server.GrpcServer schedulerSvc *scheduler.ServiceV2 handlerSvc *handler.ServiceV2 scheduleSvc *schedule.ServiceV2 @@ -43,12 +43,12 @@ type MasterServiceV2 struct { stopOnError bool } -func (svc *MasterServiceV2) Init() (err error) { +func (svc *MasterService) Init() (err error) { // do nothing return nil } -func (svc *MasterServiceV2) Start() { +func (svc *MasterService) Start() { // create indexes common.InitIndexes() @@ -81,17 +81,17 @@ func (svc *MasterServiceV2) Start() { svc.Stop() } -func (svc *MasterServiceV2) Wait() { +func (svc *MasterService) Wait() { utils.DefaultWait() } -func (svc *MasterServiceV2) Stop() { +func (svc *MasterService) Stop() { _ = svc.server.Stop() svc.handlerSvc.Stop() log.Infof("master[%s] service has stopped", svc.GetConfigService().GetNodeKey()) } -func (svc *MasterServiceV2) Monitor() { +func (svc *MasterService) Monitor() { log.Infof("master[%s] monitoring started", svc.GetConfigService().GetNodeKey()) // ticker @@ -114,31 +114,23 @@ func (svc *MasterServiceV2) Monitor() { } } -func (svc *MasterServiceV2) GetConfigService() (cfgSvc interfaces.NodeConfigService) { +func (svc *MasterService) GetConfigService() (cfgSvc interfaces.NodeConfigService) { return svc.cfgSvc } -func (svc *MasterServiceV2) GetConfigPath() (path string) { +func (svc *MasterService) GetConfigPath() (path string) { return svc.cfgPath } -func (svc *MasterServiceV2) SetConfigPath(path string) { +func (svc *MasterService) SetConfigPath(path string) { svc.cfgPath = path } -func (svc *MasterServiceV2) GetAddress() (address interfaces.Address) { - return svc.address -} - -func (svc *MasterServiceV2) SetAddress(address interfaces.Address) { - svc.address = address -} - -func (svc *MasterServiceV2) SetMonitorInterval(duration time.Duration) { +func (svc *MasterService) SetMonitorInterval(duration time.Duration) { svc.monitorInterval = duration } -func (svc *MasterServiceV2) Register() (err error) { +func (svc *MasterService) Register() (err error) { nodeKey := svc.GetConfigService().GetNodeKey() nodeName := svc.GetConfigService().GetNodeName() node, err := service.NewModelServiceV2[models2.NodeV2]().GetOne(bson.M{"key": nodeKey}, nil) @@ -181,15 +173,7 @@ func (svc *MasterServiceV2) Register() (err error) { } } -func (svc *MasterServiceV2) StopOnError() { - svc.stopOnError = true -} - -func (svc *MasterServiceV2) GetServer() (svr interfaces.GrpcServer) { - return svc.server -} - -func (svc *MasterServiceV2) monitor() (err error) { +func (svc *MasterService) monitor() (err error) { // update master node status in db if err := svc.updateMasterNodeStatus(); err != nil { if err.Error() == mongo2.ErrNoDocuments.Error() { @@ -238,7 +222,7 @@ func (svc *MasterServiceV2) monitor() (err error) { return nil } -func (svc *MasterServiceV2) getAllWorkerNodes() (nodes []models2.NodeV2, err error) { +func (svc *MasterService) getAllWorkerNodes() (nodes []models2.NodeV2, err error) { query := bson.M{ "key": bson.M{"$ne": svc.cfgSvc.GetNodeKey()}, // not self "active": true, // active @@ -253,7 +237,7 @@ func (svc *MasterServiceV2) getAllWorkerNodes() (nodes []models2.NodeV2, err err return nodes, nil } -func (svc *MasterServiceV2) updateMasterNodeStatus() (err error) { +func (svc *MasterService) updateMasterNodeStatus() (err error) { nodeKey := svc.GetConfigService().GetNodeKey() node, err := service.NewModelServiceV2[models2.NodeV2]().GetOne(bson.M{"key": nodeKey}, nil) if err != nil { @@ -280,7 +264,7 @@ func (svc *MasterServiceV2) updateMasterNodeStatus() (err error) { return nil } -func (svc *MasterServiceV2) setWorkerNodeOffline(node *models2.NodeV2) { +func (svc *MasterService) setWorkerNodeOffline(node *models2.NodeV2) { node.Status = constants.NodeStatusOffline node.Active = false err := backoff.Retry(func() error { @@ -292,24 +276,28 @@ func (svc *MasterServiceV2) setWorkerNodeOffline(node *models2.NodeV2) { svc.sendNotification(node) } -func (svc *MasterServiceV2) subscribeNode(n *models2.NodeV2) (ok bool) { - _, err := svc.server.GetSubscribe("node:" + n.Key) +func (svc *MasterService) subscribeNode(n *models2.NodeV2) (ok bool) { + _, ok = svc.server.NodeSvr.GetSubscribeStream(n.Id) + return ok +} + +func (svc *MasterService) pingNodeClient(n *models2.NodeV2) (ok bool) { + stream, ok := svc.server.NodeSvr.GetSubscribeStream(n.Id) + if !ok { + log.Errorf("cannot get worker node client[%s]", n.Key) + return false + } + err := stream.Send(&grpc.NodeServiceSubscribeResponse{ + Code: grpc.NodeServiceSubscribeCode_PING, + }) if err != nil { - log.Errorf("cannot subscribe worker node[%s]: %v", n.Key, err) + log.Errorf("failed to ping worker node client[%s]: %v", n.Key, err) return false } return true } -func (svc *MasterServiceV2) pingNodeClient(n *models2.NodeV2) (ok bool) { - if err := svc.server.SendStreamMessage("node:"+n.Key, grpc.StreamMessageCode_PING); err != nil { - log.Errorf("cannot ping worker node client[%s]: %v", n.Key, err) - return false - } - return true -} - -func (svc *MasterServiceV2) updateNodeAvailableRunners(node *models2.NodeV2) (err error) { +func (svc *MasterService) updateNodeAvailableRunners(node *models2.NodeV2) (err error) { query := bson.M{ "node_id": node.Id, "status": constants.TaskStatusRunning, @@ -326,16 +314,16 @@ func (svc *MasterServiceV2) updateNodeAvailableRunners(node *models2.NodeV2) (er return nil } -func (svc *MasterServiceV2) sendNotification(node *models2.NodeV2) { +func (svc *MasterService) sendNotification(node *models2.NodeV2) { if !utils.IsPro() { return } go notification.GetNotificationServiceV2().SendNodeNotification(node) } -func newMasterServiceV2() (res *MasterServiceV2, err error) { +func newMasterServiceV2() (res *MasterService, err error) { // master service - svc := &MasterServiceV2{ + svc := &MasterService{ cfgPath: config2.GetConfigPath(), monitorInterval: 15 * time.Second, stopOnError: false, @@ -379,15 +367,15 @@ func newMasterServiceV2() (res *MasterServiceV2, err error) { return svc, nil } -var masterServiceV2 *MasterServiceV2 -var masterServiceV2Once = new(sync.Once) +var masterService *MasterService +var masterServiceOnce = new(sync.Once) -func GetMasterServiceV2() (res *MasterServiceV2, err error) { - masterServiceV2Once.Do(func() { - masterServiceV2, err = newMasterServiceV2() +func GetMasterService() (res *MasterService, err error) { + masterServiceOnce.Do(func() { + masterService, err = newMasterServiceV2() if err != nil { log.Errorf("failed to get master service: %v", err) } }) - return masterServiceV2, err + return masterService, err } diff --git a/core/node/service/worker_service_v2.go b/core/node/service/worker_service.go similarity index 56% rename from core/node/service/worker_service_v2.go rename to core/node/service/worker_service.go index 7d525486..6b674aa2 100644 --- a/core/node/service/worker_service_v2.go +++ b/core/node/service/worker_service.go @@ -2,7 +2,7 @@ package service import ( "context" - "encoding/json" + "errors" "github.com/apex/log" "github.com/crawlab-team/crawlab/core/config" "github.com/crawlab-team/crawlab/core/grpc/client" @@ -15,11 +15,12 @@ import ( "github.com/crawlab-team/crawlab/grpc" "github.com/crawlab-team/crawlab/trace" "go.mongodb.org/mongo-driver/bson" + "io" "sync" "time" ) -type WorkerServiceV2 struct { +type WorkerService struct { // dependencies cfgSvc interfaces.NodeConfigService client *client.GrpcClientV2 @@ -31,16 +32,17 @@ type WorkerServiceV2 struct { heartbeatInterval time.Duration // internals - n *models.NodeV2 - s grpc.NodeService_SubscribeClient + stopped bool + n *models.NodeV2 + s grpc.NodeService_SubscribeClient } -func (svc *WorkerServiceV2) Init() (err error) { +func (svc *WorkerService) Init() (err error) { // do nothing return nil } -func (svc *WorkerServiceV2) Start() { +func (svc *WorkerService) Start() { // start grpc client if err := svc.client.Start(); err != nil { panic(err) @@ -49,8 +51,8 @@ func (svc *WorkerServiceV2) Start() { // register to master svc.Register() - // start receiving stream messages - go svc.Recv() + // subscribe + svc.Subscribe() // start sending heartbeat to master go svc.ReportStatus() @@ -65,24 +67,23 @@ func (svc *WorkerServiceV2) Start() { svc.Stop() } -func (svc *WorkerServiceV2) Wait() { +func (svc *WorkerService) Wait() { utils.DefaultWait() } -func (svc *WorkerServiceV2) Stop() { +func (svc *WorkerService) Stop() { + svc.stopped = true _ = svc.client.Stop() svc.handlerSvc.Stop() log.Infof("worker[%s] service has stopped", svc.cfgSvc.GetNodeKey()) } -func (svc *WorkerServiceV2) Register() { +func (svc *WorkerService) Register() { ctx, cancel := svc.client.Context() defer cancel() _, err := svc.client.NodeClient.Register(ctx, &grpc.NodeServiceRegisterRequest{ - Key: svc.cfgSvc.GetNodeKey(), - Name: svc.cfgSvc.GetNodeName(), - IsMaster: svc.cfgSvc.IsMaster(), - AuthKey: svc.cfgSvc.GetAuthKey(), + NodeKey: svc.cfgSvc.GetNodeKey(), + NodeName: svc.cfgSvc.GetNodeName(), MaxRunners: int32(svc.cfgSvc.GetMaxRunners()), }) if err != nil { @@ -96,56 +97,7 @@ func (svc *WorkerServiceV2) Register() { return } -func (svc *WorkerServiceV2) Recv() { - msgCh := svc.client.GetMessageChannel() - for { - // return if client is closed - if svc.client.IsClosed() { - return - } - - // receive message from channel - msg := <-msgCh - - // handle message - if err := svc.handleStreamMessage(msg); err != nil { - continue - } - } -} - -func (svc *WorkerServiceV2) handleStreamMessage(msg *grpc.StreamMessage) (err error) { - log.Debugf("[WorkerServiceV2] handle msg: %v", msg) - switch msg.Code { - case grpc.StreamMessageCode_PING: - _, err := svc.client.NodeClient.SendHeartbeat(context.Background(), &grpc.NodeServiceSendHeartbeatRequest{ - Key: svc.cfgSvc.GetNodeKey(), - }) - if err != nil { - return trace.TraceError(err) - } - case grpc.StreamMessageCode_RUN_TASK: - var t models.TaskV2 - if err := json.Unmarshal(msg.Data, &t); err != nil { - return trace.TraceError(err) - } - if err := svc.handlerSvc.Run(t.Id); err != nil { - return trace.TraceError(err) - } - case grpc.StreamMessageCode_CANCEL_TASK: - var t models.TaskV2 - if err := json.Unmarshal(msg.Data, &t); err != nil { - return trace.TraceError(err) - } - if err := svc.handlerSvc.Cancel(t.Id); err != nil { - return trace.TraceError(err) - } - } - - return nil -} - -func (svc *WorkerServiceV2) ReportStatus() { +func (svc *WorkerService) ReportStatus() { ticker := time.NewTicker(svc.heartbeatInterval) for { // return if client is closed @@ -162,46 +114,76 @@ func (svc *WorkerServiceV2) ReportStatus() { } } -func (svc *WorkerServiceV2) GetConfigService() (cfgSvc interfaces.NodeConfigService) { +func (svc *WorkerService) GetConfigService() (cfgSvc interfaces.NodeConfigService) { return svc.cfgSvc } -func (svc *WorkerServiceV2) GetConfigPath() (path string) { +func (svc *WorkerService) GetConfigPath() (path string) { return svc.cfgPath } -func (svc *WorkerServiceV2) SetConfigPath(path string) { +func (svc *WorkerService) SetConfigPath(path string) { svc.cfgPath = path } -func (svc *WorkerServiceV2) GetAddress() (address interfaces.Address) { +func (svc *WorkerService) GetAddress() (address interfaces.Address) { return svc.address } -func (svc *WorkerServiceV2) SetAddress(address interfaces.Address) { +func (svc *WorkerService) SetAddress(address interfaces.Address) { svc.address = address } -func (svc *WorkerServiceV2) SetHeartbeatInterval(duration time.Duration) { +func (svc *WorkerService) SetHeartbeatInterval(duration time.Duration) { svc.heartbeatInterval = duration } -func (svc *WorkerServiceV2) reportStatus() { +func (svc *WorkerService) Subscribe() { + stream, err := svc.client.NodeClient.Subscribe(context.Background(), &grpc.NodeServiceSubscribeRequest{ + NodeKey: svc.cfgSvc.GetNodeKey(), + }) + if err != nil { + log.Errorf("failed to subscribe to master: %v", err) + return + } + for { + if svc.stopped { + return + } + select { + default: + msg, err := stream.Recv() + if err != nil { + if errors.Is(err, io.EOF) { + return + } + log.Errorf("failed to receive message from master: %v", err) + continue + } + switch msg.Code { + case grpc.NodeServiceSubscribeCode_PING: + // do nothing + } + } + } +} + +func (svc *WorkerService) reportStatus() { ctx, cancel := context.WithTimeout(context.Background(), svc.heartbeatInterval) defer cancel() _, err := svc.client.NodeClient.SendHeartbeat(ctx, &grpc.NodeServiceSendHeartbeatRequest{ - Key: svc.cfgSvc.GetNodeKey(), + NodeKey: svc.cfgSvc.GetNodeKey(), }) if err != nil { trace.PrintError(err) } } -var workerServiceV2 *WorkerServiceV2 +var workerServiceV2 *WorkerService var workerServiceV2Once = new(sync.Once) -func newWorkerServiceV2() (res *WorkerServiceV2, err error) { - svc := &WorkerServiceV2{ +func newWorkerService() (res *WorkerService, err error) { + svc := &WorkerService{ cfgPath: config.GetConfigPath(), heartbeatInterval: 15 * time.Second, } @@ -233,9 +215,9 @@ func newWorkerServiceV2() (res *WorkerServiceV2, err error) { return svc, nil } -func GetWorkerServiceV2() (res *WorkerServiceV2, err error) { +func GetWorkerService() (res *WorkerService, err error) { workerServiceV2Once.Do(func() { - workerServiceV2, err = newWorkerServiceV2() + workerServiceV2, err = newWorkerService() if err != nil { log.Errorf("failed to get worker service: %v", err) } diff --git a/core/task/handler/runner_v2.go b/core/task/handler/runner_v2.go index bb61c5f4..d273ad81 100644 --- a/core/task/handler/runner_v2.go +++ b/core/task/handler/runner_v2.go @@ -7,7 +7,6 @@ import ( "errors" "fmt" "github.com/apex/log" - "github.com/cenkalti/backoff/v4" "github.com/crawlab-team/crawlab/core/constants" "github.com/crawlab-team/crawlab/core/entity" "github.com/crawlab-team/crawlab/core/fs" @@ -44,16 +43,16 @@ type RunnerV2 struct { bufferSize int // internals - cmd *exec.Cmd // process command instance - pid int // process id - tid primitive.ObjectID // task id - t *models.TaskV2 // task model.Task - s *models.SpiderV2 // spider model.Spider - ch chan constants.TaskSignal // channel to communicate between Service and RunnerV2 - err error // standard process error - cwd string // working directory - c *client2.GrpcClientV2 // grpc client - sub grpc.TaskService_SubscribeClient // grpc task service stream client + cmd *exec.Cmd // process command instance + pid int // process id + tid primitive.ObjectID // task id + t *models.TaskV2 // task model.Task + s *models.SpiderV2 // spider model.Spider + ch chan constants.TaskSignal // channel to communicate between Service and RunnerV2 + err error // standard process error + cwd string // working directory + c *client2.GrpcClientV2 // grpc client + conn grpc.TaskService_ConnectClient // grpc task service stream client // log internals scannerStdout *bufio.Reader @@ -76,7 +75,7 @@ func (r *RunnerV2) Init() (err error) { } // grpc task service stream client - if err := r.initSub(); err != nil { + if err := r.initConnection(); err != nil { return err } @@ -177,26 +176,19 @@ func (r *RunnerV2) Cancel(force bool) (err error) { } // make sure the process does not exist - op := func() error { - if exists, _ := process.PidExists(int32(r.pid)); exists { + ticker := time.NewTicker(1 * time.Second) + timeout := time.After(r.svc.GetCancelTimeout()) + for { + select { + case <-timeout: return errors.New(fmt.Sprintf("task process %d still exists", r.pid)) + case <-ticker.C: + if exists, _ := process.PidExists(int32(r.pid)); exists { + return errors.New(fmt.Sprintf("task process %d still exists", r.pid)) + } + return nil } - return nil } - ctx, cancel := context.WithTimeout(context.Background(), r.svc.GetExitWatchDuration()) - defer cancel() - b := backoff.WithContext(backoff.NewConstantBackOff(1*time.Second), ctx) - if err := backoff.Retry(op, b); err != nil { - log.Errorf("Error canceling task %s: %v", r.tid, err) - return trace.TraceError(err) - } - - return nil -} - -// CleanUp clean up task runner -func (r *RunnerV2) CleanUp() (err error) { - return nil } func (r *RunnerV2) SetSubscribeTimeout(timeout time.Duration) { @@ -537,8 +529,8 @@ func (r *RunnerV2) updateTask(status string, e error) (err error) { return nil } -func (r *RunnerV2) initSub() (err error) { - r.sub, err = r.c.TaskClient.Subscribe(context.Background()) +func (r *RunnerV2) initConnection() (err error) { + r.conn, err = r.c.TaskClient.Connect(context.Background()) if err != nil { return trace.TraceError(err) } @@ -546,20 +538,18 @@ func (r *RunnerV2) initSub() (err error) { } func (r *RunnerV2) writeLogLines(lines []string) { - data, err := json.Marshal(&entity.StreamMessageTaskData{ - TaskId: r.tid, - Logs: lines, - }) + linesBytes, err := json.Marshal(lines) if err != nil { - trace.PrintError(err) + log.Errorf("Error marshaling log lines: %v", err) return } - msg := &grpc.StreamMessage{ - Code: grpc.StreamMessageCode_INSERT_LOGS, - Data: data, + msg := &grpc.TaskServiceConnectRequest{ + Code: grpc.TaskServiceConnectCode_INSERT_LOGS, + TaskId: r.tid.Hex(), + Data: linesBytes, } - if err := r.sub.Send(msg); err != nil { - trace.PrintError(err) + if err := r.conn.Send(msg); err != nil { + log.Errorf("Error sending log lines: %v", err) return } } diff --git a/core/task/handler/service_v2.go b/core/task/handler/service_v2.go index 763fa622..245faf1f 100644 --- a/core/task/handler/service_v2.go +++ b/core/task/handler/service_v2.go @@ -2,8 +2,8 @@ package handler import ( "context" - "encoding/json" "errors" + "fmt" "github.com/apex/log" "github.com/crawlab-team/crawlab/core/constants" errors2 "github.com/crawlab-team/crawlab/core/errors" @@ -13,9 +13,11 @@ import ( models2 "github.com/crawlab-team/crawlab/core/models/models/v2" "github.com/crawlab-team/crawlab/core/models/service" nodeconfig "github.com/crawlab-team/crawlab/core/node/config" + "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" + "io" "sync" "time" ) @@ -50,7 +52,7 @@ func (svc *ServiceV2) Start() { } go svc.ReportStatus() - go svc.Fetch() + go svc.FetchAndRunTasks() } func (svc *ServiceV2) Stop() { @@ -58,12 +60,7 @@ func (svc *ServiceV2) Stop() { } func (svc *ServiceV2) Run(taskId primitive.ObjectID) (err error) { - return svc.run(taskId) -} - -func (svc *ServiceV2) Reset() { - svc.mu.Lock() - defer svc.mu.Unlock() + return svc.runTask(taskId) } func (svc *ServiceV2) Cancel(taskId primitive.ObjectID, force bool) (err error) { @@ -77,7 +74,7 @@ func (svc *ServiceV2) Cancel(taskId primitive.ObjectID, force bool) (err error) return nil } -func (svc *ServiceV2) Fetch() { +func (svc *ServiceV2) FetchAndRunTasks() { ticker := time.NewTicker(svc.fetchInterval) for { if svc.stopped { @@ -102,10 +99,9 @@ func (svc *ServiceV2) Fetch() { continue } - // fetch task - tid, err := svc.fetch() + // fetch task id + tid, err := svc.fetchTask() if err != nil { - trace.PrintError(err) continue } @@ -115,8 +111,7 @@ func (svc *ServiceV2) Fetch() { } // run task - if err := svc.run(tid); err != nil { - trace.PrintError(err) + if err := svc.runTask(tid); err != nil { t, err := svc.GetTaskById(tid) if err != nil && t.Status != constants.TaskStatusCancelled { t.Error = err.Error() @@ -281,30 +276,36 @@ func (svc *ServiceV2) reportStatus() (err error) { return nil } -func (svc *ServiceV2) fetch() (tid primitive.ObjectID, err error) { +func (svc *ServiceV2) fetchTask() (tid primitive.ObjectID, err error) { ctx, cancel := context.WithTimeout(context.Background(), svc.fetchTimeout) defer cancel() - res, err := svc.c.TaskClient.Fetch(ctx, svc.c.NewRequest(nil)) + res, err := svc.c.TaskClient.FetchTask(ctx, svc.c.NewRequest(nil)) if err != nil { - return tid, trace.TraceError(err) + return primitive.NilObjectID, fmt.Errorf("fetchTask task error: %v", err) } - if err := json.Unmarshal(res.Data, &tid); err != nil { - return tid, trace.TraceError(err) + // validate task id + tid, err = primitive.ObjectIDFromHex(res.GetTaskId()) + if err != nil { + return primitive.NilObjectID, fmt.Errorf("invalid task id: %s", res.GetTaskId()) } return tid, nil } -func (svc *ServiceV2) run(taskId primitive.ObjectID) (err error) { +func (svc *ServiceV2) runTask(taskId primitive.ObjectID) (err error) { // attempt to get runner from pool _, ok := svc.runners.Load(taskId) if ok { - return trace.TraceError(errors2.ErrorTaskAlreadyExists) + err = fmt.Errorf("task[%s] already exists", taskId.Hex()) + log.Errorf("run task error: %v", err) + return err } // create a new task runner r, err := NewTaskRunnerV2(taskId, svc) if err != nil { - return trace.TraceError(err) + err = fmt.Errorf("failed to create task runner: %v", err) + log.Errorf("run task error: %v", err) + return err } // add runner to pool @@ -312,16 +313,18 @@ func (svc *ServiceV2) run(taskId primitive.ObjectID) (err error) { // create a goroutine to run task go func() { - // delete runner from pool - defer svc.deleteRunner(r.GetTaskId()) - defer func(r interfaces.TaskRunner) { - err := r.CleanUp() - if err != nil { - log.Errorf("task[%s] clean up error: %v", r.GetTaskId().Hex(), err) - } - }(r) - // run task process (blocking) - // error or finish after task runner ends + // get subscription stream + stopCh := make(chan struct{}) + stream, err := svc.subscribeTask(r.GetTaskId()) + if err == nil { + // create a goroutine to handle stream messages + go svc.handleStreamMessages(r.GetTaskId(), stream, stopCh) + } else { + log.Errorf("failed to subscribe task[%s]: %v", r.GetTaskId().Hex(), err) + log.Warnf("task[%s] will not be able to receive stream messages", r.GetTaskId().Hex()) + } + + // run task process (blocking) error or finish after task runner ends if err := r.Run(); err != nil { switch { case errors.Is(err, constants.ErrTaskError): @@ -333,11 +336,64 @@ func (svc *ServiceV2) run(taskId primitive.ObjectID) (err error) { } } log.Infof("task[%s] finished", r.GetTaskId().Hex()) + + // send stopCh signal to stream message handler + stopCh <- struct{}{} + + // delete runner from pool + svc.deleteRunner(r.GetTaskId()) }() return nil } +func (svc *ServiceV2) subscribeTask(taskId primitive.ObjectID) (stream grpc.TaskService_SubscribeClient, err error) { + ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + req := &grpc.TaskServiceSubscribeRequest{ + TaskId: taskId.Hex(), + } + stream, err = svc.c.TaskClient.Subscribe(ctx, req) + if err != nil { + log.Errorf("failed to subscribe task[%s]: %v", taskId.Hex(), err) + return nil, err + } + return stream, nil +} + +func (svc *ServiceV2) handleStreamMessages(id primitive.ObjectID, stream grpc.TaskService_SubscribeClient, stopCh chan struct{}) { + for { + select { + case <-stopCh: + err := stream.CloseSend() + if err != nil { + log.Errorf("task[%s] failed to close stream: %v", id.Hex(), err) + return + } + return + default: + msg, err := stream.Recv() + if err != nil { + if errors.Is(err, io.EOF) { + return + } + log.Errorf("task[%s] stream error: %v", id.Hex(), err) + continue + } + switch msg.Code { + case grpc.TaskServiceSubscribeCode_CANCEL: + log.Infof("task[%s] received cancel signal", id.Hex()) + go func() { + if err := svc.Cancel(id, true); err != nil { + log.Errorf("task[%s] failed to cancel: %v", id.Hex(), err) + } + log.Infof("task[%s] cancelled", id.Hex()) + }() + } + } + } +} + func newTaskHandlerServiceV2() (svc2 *ServiceV2, err error) { // service svc := &ServiceV2{ diff --git a/core/task/scheduler/service_v2.go b/core/task/scheduler/service_v2.go index 65cf6449..b2bf6b18 100644 --- a/core/task/scheduler/service_v2.go +++ b/core/task/scheduler/service_v2.go @@ -23,7 +23,7 @@ import ( type ServiceV2 struct { // dependencies nodeCfgSvc interfaces.NodeConfigService - svr *server.GrpcServerV2 + svr *server.GrpcServer handlerSvc *handler.ServiceV2 // settings diff --git a/grpc/dependencies_service_v2.pb.go b/grpc/dependencies_service_v2.pb.go deleted file mode 100644 index f703c5e7..00000000 --- a/grpc/dependencies_service_v2.pb.go +++ /dev/null @@ -1,567 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/dependencies_service_v2.proto - -package grpc - -import ( - 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) -) - -type DependenciesServiceV2Code int32 - -const ( - DependenciesServiceV2Code_SYNC DependenciesServiceV2Code = 0 - DependenciesServiceV2Code_INSTALL DependenciesServiceV2Code = 1 - DependenciesServiceV2Code_UNINSTALL DependenciesServiceV2Code = 2 -) - -// Enum value maps for DependenciesServiceV2Code. -var ( - DependenciesServiceV2Code_name = map[int32]string{ - 0: "SYNC", - 1: "INSTALL", - 2: "UNINSTALL", - } - DependenciesServiceV2Code_value = map[string]int32{ - "SYNC": 0, - "INSTALL": 1, - "UNINSTALL": 2, - } -) - -func (x DependenciesServiceV2Code) Enum() *DependenciesServiceV2Code { - p := new(DependenciesServiceV2Code) - *p = x - return p -} - -func (x DependenciesServiceV2Code) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (DependenciesServiceV2Code) Descriptor() protoreflect.EnumDescriptor { - return file_services_dependencies_service_v2_proto_enumTypes[0].Descriptor() -} - -func (DependenciesServiceV2Code) Type() protoreflect.EnumType { - return &file_services_dependencies_service_v2_proto_enumTypes[0] -} - -func (x DependenciesServiceV2Code) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use DependenciesServiceV2Code.Descriptor instead. -func (DependenciesServiceV2Code) EnumDescriptor() ([]byte, []int) { - return file_services_dependencies_service_v2_proto_rawDescGZIP(), []int{0} -} - -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_services_dependencies_service_v2_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_services_dependencies_service_v2_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_services_dependencies_service_v2_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_services_dependencies_service_v2_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_services_dependencies_service_v2_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_services_dependencies_service_v2_proto_rawDescGZIP(), []int{1} -} - -func (x *DependenciesServiceV2ConnectRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -type DependenciesServiceV2ConnectResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code DependenciesServiceV2Code `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.DependenciesServiceV2Code" json:"code,omitempty"` - TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` - Lang string `protobuf:"bytes,3,opt,name=lang,proto3" json:"lang,omitempty"` - Proxy string `protobuf:"bytes,4,opt,name=proxy,proto3" json:"proxy,omitempty"` - Dependencies []*Dependency `protobuf:"bytes,5,rep,name=dependencies,proto3" json:"dependencies,omitempty"` -} - -func (x *DependenciesServiceV2ConnectResponse) Reset() { - *x = DependenciesServiceV2ConnectResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_services_dependencies_service_v2_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2ConnectResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2ConnectResponse) ProtoMessage() {} - -func (x *DependenciesServiceV2ConnectResponse) ProtoReflect() protoreflect.Message { - mi := &file_services_dependencies_service_v2_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 DependenciesServiceV2ConnectResponse.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2ConnectResponse) Descriptor() ([]byte, []int) { - return file_services_dependencies_service_v2_proto_rawDescGZIP(), []int{2} -} - -func (x *DependenciesServiceV2ConnectResponse) GetCode() DependenciesServiceV2Code { - if x != nil { - return x.Code - } - return DependenciesServiceV2Code_SYNC -} - -func (x *DependenciesServiceV2ConnectResponse) GetTaskId() string { - if x != nil { - return x.TaskId - } - return "" -} - -func (x *DependenciesServiceV2ConnectResponse) GetLang() string { - if x != nil { - return x.Lang - } - return "" -} - -func (x *DependenciesServiceV2ConnectResponse) GetProxy() string { - if x != nil { - return x.Proxy - } - return "" -} - -func (x *DependenciesServiceV2ConnectResponse) GetDependencies() []*Dependency { - if x != nil { - return x.Dependencies - } - return nil -} - -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_services_dependencies_service_v2_proto_msgTypes[3] - 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_services_dependencies_service_v2_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 DependenciesServiceV2SyncRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2SyncRequest) Descriptor() ([]byte, []int) { - return file_services_dependencies_service_v2_proto_rawDescGZIP(), []int{3} -} - -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 DependenciesServiceV2UpdateTaskLogRequest 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"` -} - -func (x *DependenciesServiceV2UpdateTaskLogRequest) Reset() { - *x = DependenciesServiceV2UpdateTaskLogRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_services_dependencies_service_v2_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *DependenciesServiceV2UpdateTaskLogRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*DependenciesServiceV2UpdateTaskLogRequest) ProtoMessage() {} - -func (x *DependenciesServiceV2UpdateTaskLogRequest) ProtoReflect() protoreflect.Message { - mi := &file_services_dependencies_service_v2_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 DependenciesServiceV2UpdateTaskLogRequest.ProtoReflect.Descriptor instead. -func (*DependenciesServiceV2UpdateTaskLogRequest) Descriptor() ([]byte, []int) { - return file_services_dependencies_service_v2_proto_rawDescGZIP(), []int{4} -} - -func (x *DependenciesServiceV2UpdateTaskLogRequest) GetTaskId() string { - if x != nil { - return x.TaskId - } - return "" -} - -func (x *DependenciesServiceV2UpdateTaskLogRequest) GetLogLines() []string { - if x != nil { - return x.LogLines - } - return nil -} - -var File_services_dependencies_service_v2_proto protoreflect.FileDescriptor - -var file_services_dependencies_service_v2_proto_rawDesc = []byte{ - 0x0a, 0x26, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x65, 0x6e, - 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, - 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x15, - 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0xd4, 0x01, 0x0a, 0x24, 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, 0x12, 0x33, 0x0a, 0x04, - 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1f, 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, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, - 0x65, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, - 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x14, - 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, - 0x72, 0x6f, 0x78, 0x79, 0x12, 0x34, 0x0a, 0x0c, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, - 0x63, 0x69, 0x65, 0x73, 0x18, 0x05, 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, 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, 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, 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, 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 ( - file_services_dependencies_service_v2_proto_rawDescOnce sync.Once - file_services_dependencies_service_v2_proto_rawDescData = file_services_dependencies_service_v2_proto_rawDesc -) - -func file_services_dependencies_service_v2_proto_rawDescGZIP() []byte { - file_services_dependencies_service_v2_proto_rawDescOnce.Do(func() { - file_services_dependencies_service_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_dependencies_service_v2_proto_rawDescData) - }) - return file_services_dependencies_service_v2_proto_rawDescData -} - -var file_services_dependencies_service_v2_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_services_dependencies_service_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_services_dependencies_service_v2_proto_goTypes = []any{ - (DependenciesServiceV2Code)(0), // 0: grpc.DependenciesServiceV2Code - (*Dependency)(nil), // 1: grpc.Dependency - (*DependenciesServiceV2ConnectRequest)(nil), // 2: grpc.DependenciesServiceV2ConnectRequest - (*DependenciesServiceV2ConnectResponse)(nil), // 3: grpc.DependenciesServiceV2ConnectResponse - (*DependenciesServiceV2SyncRequest)(nil), // 4: grpc.DependenciesServiceV2SyncRequest - (*DependenciesServiceV2UpdateTaskLogRequest)(nil), // 5: grpc.DependenciesServiceV2UpdateTaskLogRequest - (*Response)(nil), // 6: grpc.Response -} -var file_services_dependencies_service_v2_proto_depIdxs = []int32{ - 0, // 0: grpc.DependenciesServiceV2ConnectResponse.code:type_name -> grpc.DependenciesServiceV2Code - 1, // 1: grpc.DependenciesServiceV2ConnectResponse.dependencies:type_name -> grpc.Dependency - 1, // 2: grpc.DependenciesServiceV2SyncRequest.dependencies:type_name -> grpc.Dependency - 2, // 3: grpc.DependenciesServiceV2.Connect:input_type -> grpc.DependenciesServiceV2ConnectRequest - 4, // 4: grpc.DependenciesServiceV2.Sync:input_type -> grpc.DependenciesServiceV2SyncRequest - 5, // 5: grpc.DependenciesServiceV2.UpdateTaskLog:input_type -> grpc.DependenciesServiceV2UpdateTaskLogRequest - 3, // 6: grpc.DependenciesServiceV2.Connect:output_type -> grpc.DependenciesServiceV2ConnectResponse - 6, // 7: grpc.DependenciesServiceV2.Sync:output_type -> grpc.Response - 6, // 8: grpc.DependenciesServiceV2.UpdateTaskLog: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 - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_services_dependencies_service_v2_proto_init() } -func file_services_dependencies_service_v2_proto_init() { - if File_services_dependencies_service_v2_proto != nil { - return - } - file_entity_response_proto_init() - if !protoimpl.UnsafeEnabled { - file_services_dependencies_service_v2_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Dependency); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_dependencies_service_v2_proto_msgTypes[1].Exporter = func(v any, i int) any { - switch v := v.(*DependenciesServiceV2ConnectRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_dependencies_service_v2_proto_msgTypes[2].Exporter = func(v any, i int) any { - switch v := v.(*DependenciesServiceV2ConnectResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_dependencies_service_v2_proto_msgTypes[3].Exporter = func(v any, i int) any { - switch v := v.(*DependenciesServiceV2SyncRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_services_dependencies_service_v2_proto_msgTypes[4].Exporter = func(v any, i int) any { - switch v := v.(*DependenciesServiceV2UpdateTaskLogRequest); 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_services_dependencies_service_v2_proto_rawDesc, - NumEnums: 1, - NumMessages: 5, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_dependencies_service_v2_proto_goTypes, - DependencyIndexes: file_services_dependencies_service_v2_proto_depIdxs, - EnumInfos: file_services_dependencies_service_v2_proto_enumTypes, - MessageInfos: file_services_dependencies_service_v2_proto_msgTypes, - }.Build() - File_services_dependencies_service_v2_proto = out.File - file_services_dependencies_service_v2_proto_rawDesc = nil - file_services_dependencies_service_v2_proto_goTypes = nil - file_services_dependencies_service_v2_proto_depIdxs = nil -} diff --git a/grpc/dependencies_service_v2_grpc.pb.go b/grpc/dependencies_service_v2_grpc.pb.go deleted file mode 100644 index 6a3fc1a3..00000000 --- a/grpc/dependencies_service_v2_grpc.pb.go +++ /dev/null @@ -1,248 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/dependencies_service_v2.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - DependenciesServiceV2_Connect_FullMethodName = "/grpc.DependenciesServiceV2/Connect" - DependenciesServiceV2_Sync_FullMethodName = "/grpc.DependenciesServiceV2/Sync" - DependenciesServiceV2_UpdateTaskLog_FullMethodName = "/grpc.DependenciesServiceV2/UpdateTaskLog" -) - -// DependenciesServiceV2Client is the client API for DependenciesServiceV2 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 DependenciesServiceV2Client interface { - 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) -} - -type dependenciesServiceV2Client struct { - cc grpc.ClientConnInterface -} - -func NewDependenciesServiceV2Client(cc grpc.ClientConnInterface) DependenciesServiceV2Client { - return &dependenciesServiceV2Client{cc} -} - -func (c *dependenciesServiceV2Client) Connect(ctx context.Context, in *DependenciesServiceV2ConnectRequest, opts ...grpc.CallOption) (DependenciesServiceV2_ConnectClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &DependenciesServiceV2_ServiceDesc.Streams[0], DependenciesServiceV2_Connect_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &dependenciesServiceV2ConnectClient{ClientStream: 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 { - Recv() (*DependenciesServiceV2ConnectResponse, error) - grpc.ClientStream -} - -type dependenciesServiceV2ConnectClient struct { - grpc.ClientStream -} - -func (x *dependenciesServiceV2ConnectClient) Recv() (*DependenciesServiceV2ConnectResponse, error) { - m := new(DependenciesServiceV2ConnectResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *dependenciesServiceV2Client) Sync(ctx context.Context, in *DependenciesServiceV2SyncRequest, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, DependenciesServiceV2_Sync_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *dependenciesServiceV2Client) UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependenciesServiceV2_UpdateTaskLogClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &DependenciesServiceV2_ServiceDesc.Streams[1], DependenciesServiceV2_UpdateTaskLog_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &dependenciesServiceV2UpdateTaskLogClient{ClientStream: stream} - return x, nil -} - -type DependenciesServiceV2_UpdateTaskLogClient interface { - Send(*DependenciesServiceV2UpdateTaskLogRequest) error - CloseAndRecv() (*Response, error) - grpc.ClientStream -} - -type dependenciesServiceV2UpdateTaskLogClient struct { - grpc.ClientStream -} - -func (x *dependenciesServiceV2UpdateTaskLogClient) Send(m *DependenciesServiceV2UpdateTaskLogRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *dependenciesServiceV2UpdateTaskLogClient) CloseAndRecv() (*Response, error) { - if err := x.ClientStream.CloseSend(); err != nil { - return nil, err - } - m := new(Response) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// DependenciesServiceV2Server is the server API for DependenciesServiceV2 service. -// All implementations must embed UnimplementedDependenciesServiceV2Server -// for forward compatibility -type DependenciesServiceV2Server interface { - Connect(*DependenciesServiceV2ConnectRequest, DependenciesServiceV2_ConnectServer) error - Sync(context.Context, *DependenciesServiceV2SyncRequest) (*Response, error) - UpdateTaskLog(DependenciesServiceV2_UpdateTaskLogServer) error - mustEmbedUnimplementedDependenciesServiceV2Server() -} - -// UnimplementedDependenciesServiceV2Server must be embedded to have forward compatible implementations. -type UnimplementedDependenciesServiceV2Server struct { -} - -func (UnimplementedDependenciesServiceV2Server) Connect(*DependenciesServiceV2ConnectRequest, DependenciesServiceV2_ConnectServer) error { - return status.Errorf(codes.Unimplemented, "method Connect not implemented") -} -func (UnimplementedDependenciesServiceV2Server) Sync(context.Context, *DependenciesServiceV2SyncRequest) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") -} -func (UnimplementedDependenciesServiceV2Server) UpdateTaskLog(DependenciesServiceV2_UpdateTaskLogServer) error { - return status.Errorf(codes.Unimplemented, "method UpdateTaskLog not implemented") -} -func (UnimplementedDependenciesServiceV2Server) mustEmbedUnimplementedDependenciesServiceV2Server() {} - -// UnsafeDependenciesServiceV2Server may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to DependenciesServiceV2Server will -// result in compilation errors. -type UnsafeDependenciesServiceV2Server interface { - mustEmbedUnimplementedDependenciesServiceV2Server() -} - -func RegisterDependenciesServiceV2Server(s grpc.ServiceRegistrar, srv DependenciesServiceV2Server) { - s.RegisterService(&DependenciesServiceV2_ServiceDesc, srv) -} - -func _DependenciesServiceV2_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(DependenciesServiceV2ConnectRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(DependenciesServiceV2Server).Connect(m, &dependenciesServiceV2ConnectServer{ServerStream: stream}) -} - -type DependenciesServiceV2_ConnectServer interface { - Send(*DependenciesServiceV2ConnectResponse) error - grpc.ServerStream -} - -type dependenciesServiceV2ConnectServer struct { - grpc.ServerStream -} - -func (x *dependenciesServiceV2ConnectServer) Send(m *DependenciesServiceV2ConnectResponse) error { - return x.ServerStream.SendMsg(m) -} - -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 { - return nil, err - } - if interceptor == nil { - return srv.(DependenciesServiceV2Server).Sync(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: DependenciesServiceV2_Sync_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(DependenciesServiceV2Server).Sync(ctx, req.(*DependenciesServiceV2SyncRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _DependenciesServiceV2_UpdateTaskLog_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(DependenciesServiceV2Server).UpdateTaskLog(&dependenciesServiceV2UpdateTaskLogServer{ServerStream: stream}) -} - -type DependenciesServiceV2_UpdateTaskLogServer interface { - SendAndClose(*Response) error - Recv() (*DependenciesServiceV2UpdateTaskLogRequest, error) - grpc.ServerStream -} - -type dependenciesServiceV2UpdateTaskLogServer struct { - grpc.ServerStream -} - -func (x *dependenciesServiceV2UpdateTaskLogServer) SendAndClose(m *Response) error { - return x.ServerStream.SendMsg(m) -} - -func (x *dependenciesServiceV2UpdateTaskLogServer) Recv() (*DependenciesServiceV2UpdateTaskLogRequest, error) { - m := new(DependenciesServiceV2UpdateTaskLogRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// DependenciesServiceV2_ServiceDesc is the grpc.ServiceDesc for DependenciesServiceV2 service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var DependenciesServiceV2_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.DependenciesServiceV2", - HandlerType: (*DependenciesServiceV2Server)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Sync", - Handler: _DependenciesServiceV2_Sync_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Connect", - Handler: _DependenciesServiceV2_Connect_Handler, - ServerStreams: true, - }, - { - StreamName: "UpdateTaskLog", - Handler: _DependenciesServiceV2_UpdateTaskLog_Handler, - ClientStreams: true, - }, - }, - Metadata: "services/dependencies_service_v2.proto", -} diff --git a/grpc/dependency_service_v2.pb.go b/grpc/dependency_service_v2.pb.go new file mode 100644 index 00000000..092c0762 --- /dev/null +++ b/grpc/dependency_service_v2.pb.go @@ -0,0 +1,565 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.2 +// source: services/dependency_service_v2.proto + +package grpc + +import ( + 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) +) + +type DependencyServiceV2Code int32 + +const ( + DependencyServiceV2Code_SYNC DependencyServiceV2Code = 0 + DependencyServiceV2Code_INSTALL DependencyServiceV2Code = 1 + DependencyServiceV2Code_UNINSTALL DependencyServiceV2Code = 2 +) + +// Enum value maps for DependencyServiceV2Code. +var ( + DependencyServiceV2Code_name = map[int32]string{ + 0: "SYNC", + 1: "INSTALL", + 2: "UNINSTALL", + } + DependencyServiceV2Code_value = map[string]int32{ + "SYNC": 0, + "INSTALL": 1, + "UNINSTALL": 2, + } +) + +func (x DependencyServiceV2Code) Enum() *DependencyServiceV2Code { + p := new(DependencyServiceV2Code) + *p = x + return p +} + +func (x DependencyServiceV2Code) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (DependencyServiceV2Code) Descriptor() protoreflect.EnumDescriptor { + return file_services_dependency_service_v2_proto_enumTypes[0].Descriptor() +} + +func (DependencyServiceV2Code) Type() protoreflect.EnumType { + return &file_services_dependency_service_v2_proto_enumTypes[0] +} + +func (x DependencyServiceV2Code) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use DependencyServiceV2Code.Descriptor instead. +func (DependencyServiceV2Code) EnumDescriptor() ([]byte, []int) { + return file_services_dependency_service_v2_proto_rawDescGZIP(), []int{0} +} + +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_services_dependency_service_v2_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_services_dependency_service_v2_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_services_dependency_service_v2_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 DependencyServiceV2ConnectRequest 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 *DependencyServiceV2ConnectRequest) Reset() { + *x = DependencyServiceV2ConnectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_dependency_service_v2_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DependencyServiceV2ConnectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DependencyServiceV2ConnectRequest) ProtoMessage() {} + +func (x *DependencyServiceV2ConnectRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_dependency_service_v2_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 DependencyServiceV2ConnectRequest.ProtoReflect.Descriptor instead. +func (*DependencyServiceV2ConnectRequest) Descriptor() ([]byte, []int) { + return file_services_dependency_service_v2_proto_rawDescGZIP(), []int{1} +} + +func (x *DependencyServiceV2ConnectRequest) GetNodeKey() string { + if x != nil { + return x.NodeKey + } + return "" +} + +type DependencyServiceV2ConnectResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code DependencyServiceV2Code `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.DependencyServiceV2Code" json:"code,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Lang string `protobuf:"bytes,3,opt,name=lang,proto3" json:"lang,omitempty"` + Proxy string `protobuf:"bytes,4,opt,name=proxy,proto3" json:"proxy,omitempty"` + Dependencies []*Dependency `protobuf:"bytes,5,rep,name=dependencies,proto3" json:"dependencies,omitempty"` +} + +func (x *DependencyServiceV2ConnectResponse) Reset() { + *x = DependencyServiceV2ConnectResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_services_dependency_service_v2_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DependencyServiceV2ConnectResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DependencyServiceV2ConnectResponse) ProtoMessage() {} + +func (x *DependencyServiceV2ConnectResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_dependency_service_v2_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 DependencyServiceV2ConnectResponse.ProtoReflect.Descriptor instead. +func (*DependencyServiceV2ConnectResponse) Descriptor() ([]byte, []int) { + return file_services_dependency_service_v2_proto_rawDescGZIP(), []int{2} +} + +func (x *DependencyServiceV2ConnectResponse) GetCode() DependencyServiceV2Code { + if x != nil { + return x.Code + } + return DependencyServiceV2Code_SYNC +} + +func (x *DependencyServiceV2ConnectResponse) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *DependencyServiceV2ConnectResponse) GetLang() string { + if x != nil { + return x.Lang + } + return "" +} + +func (x *DependencyServiceV2ConnectResponse) GetProxy() string { + if x != nil { + return x.Proxy + } + return "" +} + +func (x *DependencyServiceV2ConnectResponse) GetDependencies() []*Dependency { + if x != nil { + return x.Dependencies + } + return nil +} + +type DependencyServiceV2SyncRequest 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 *DependencyServiceV2SyncRequest) Reset() { + *x = DependencyServiceV2SyncRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_dependency_service_v2_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DependencyServiceV2SyncRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DependencyServiceV2SyncRequest) ProtoMessage() {} + +func (x *DependencyServiceV2SyncRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_dependency_service_v2_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 DependencyServiceV2SyncRequest.ProtoReflect.Descriptor instead. +func (*DependencyServiceV2SyncRequest) Descriptor() ([]byte, []int) { + return file_services_dependency_service_v2_proto_rawDescGZIP(), []int{3} +} + +func (x *DependencyServiceV2SyncRequest) GetNodeKey() string { + if x != nil { + return x.NodeKey + } + return "" +} + +func (x *DependencyServiceV2SyncRequest) GetLang() string { + if x != nil { + return x.Lang + } + return "" +} + +func (x *DependencyServiceV2SyncRequest) GetDependencies() []*Dependency { + if x != nil { + return x.Dependencies + } + return nil +} + +type DependencyServiceV2UpdateTaskLogRequest 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"` +} + +func (x *DependencyServiceV2UpdateTaskLogRequest) Reset() { + *x = DependencyServiceV2UpdateTaskLogRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_dependency_service_v2_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DependencyServiceV2UpdateTaskLogRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DependencyServiceV2UpdateTaskLogRequest) ProtoMessage() {} + +func (x *DependencyServiceV2UpdateTaskLogRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_dependency_service_v2_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 DependencyServiceV2UpdateTaskLogRequest.ProtoReflect.Descriptor instead. +func (*DependencyServiceV2UpdateTaskLogRequest) Descriptor() ([]byte, []int) { + return file_services_dependency_service_v2_proto_rawDescGZIP(), []int{4} +} + +func (x *DependencyServiceV2UpdateTaskLogRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *DependencyServiceV2UpdateTaskLogRequest) GetLogLines() []string { + if x != nil { + return x.LogLines + } + return nil +} + +var File_services_dependency_service_v2_proto protoreflect.FileDescriptor + +var file_services_dependency_service_v2_proto_rawDesc = []byte{ + 0x0a, 0x24, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x64, 0x65, 0x70, 0x65, 0x6e, + 0x64, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x32, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x15, 0x65, 0x6e, + 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 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, + 0x3e, 0x0a, 0x21, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 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, + 0xd0, 0x01, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x31, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, + 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, + 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, + 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, + 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x70, 0x72, 0x6f, 0x78, 0x79, 0x12, 0x34, 0x0a, 0x0c, + 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x69, 0x65, 0x73, 0x18, 0x05, 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, 0x85, 0x01, 0x0a, 0x1e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, + 0x79, 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, 0x5f, 0x0a, 0x27, 0x44, 0x65, + 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 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, 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, 0x3f, 0x0a, 0x17, 0x44, + 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 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, 0x8b, 0x02, 0x0a, + 0x13, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x56, 0x32, 0x12, 0x60, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, + 0x27, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, + 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 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, 0x3e, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x24, + 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, + 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, 0x52, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x54, 0x61, 0x73, 0x6b, 0x4c, 0x6f, 0x67, 0x12, 0x2d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, + 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 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 ( + file_services_dependency_service_v2_proto_rawDescOnce sync.Once + file_services_dependency_service_v2_proto_rawDescData = file_services_dependency_service_v2_proto_rawDesc +) + +func file_services_dependency_service_v2_proto_rawDescGZIP() []byte { + file_services_dependency_service_v2_proto_rawDescOnce.Do(func() { + file_services_dependency_service_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_dependency_service_v2_proto_rawDescData) + }) + return file_services_dependency_service_v2_proto_rawDescData +} + +var file_services_dependency_service_v2_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_services_dependency_service_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_services_dependency_service_v2_proto_goTypes = []any{ + (DependencyServiceV2Code)(0), // 0: grpc.DependencyServiceV2Code + (*Dependency)(nil), // 1: grpc.Dependency + (*DependencyServiceV2ConnectRequest)(nil), // 2: grpc.DependencyServiceV2ConnectRequest + (*DependencyServiceV2ConnectResponse)(nil), // 3: grpc.DependencyServiceV2ConnectResponse + (*DependencyServiceV2SyncRequest)(nil), // 4: grpc.DependencyServiceV2SyncRequest + (*DependencyServiceV2UpdateTaskLogRequest)(nil), // 5: grpc.DependencyServiceV2UpdateTaskLogRequest + (*Response)(nil), // 6: grpc.Response +} +var file_services_dependency_service_v2_proto_depIdxs = []int32{ + 0, // 0: grpc.DependencyServiceV2ConnectResponse.code:type_name -> grpc.DependencyServiceV2Code + 1, // 1: grpc.DependencyServiceV2ConnectResponse.dependencies:type_name -> grpc.Dependency + 1, // 2: grpc.DependencyServiceV2SyncRequest.dependencies:type_name -> grpc.Dependency + 2, // 3: grpc.DependencyServiceV2.Connect:input_type -> grpc.DependencyServiceV2ConnectRequest + 4, // 4: grpc.DependencyServiceV2.Sync:input_type -> grpc.DependencyServiceV2SyncRequest + 5, // 5: grpc.DependencyServiceV2.UpdateTaskLog:input_type -> grpc.DependencyServiceV2UpdateTaskLogRequest + 3, // 6: grpc.DependencyServiceV2.Connect:output_type -> grpc.DependencyServiceV2ConnectResponse + 6, // 7: grpc.DependencyServiceV2.Sync:output_type -> grpc.Response + 6, // 8: grpc.DependencyServiceV2.UpdateTaskLog: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 + 3, // [3:3] is the sub-list for extension extendee + 0, // [0:3] is the sub-list for field type_name +} + +func init() { file_services_dependency_service_v2_proto_init() } +func file_services_dependency_service_v2_proto_init() { + if File_services_dependency_service_v2_proto != nil { + return + } + file_entity_response_proto_init() + if !protoimpl.UnsafeEnabled { + file_services_dependency_service_v2_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*Dependency); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_dependency_service_v2_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*DependencyServiceV2ConnectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_dependency_service_v2_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*DependencyServiceV2ConnectResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_dependency_service_v2_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*DependencyServiceV2SyncRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_dependency_service_v2_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*DependencyServiceV2UpdateTaskLogRequest); 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_services_dependency_service_v2_proto_rawDesc, + NumEnums: 1, + NumMessages: 5, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_dependency_service_v2_proto_goTypes, + DependencyIndexes: file_services_dependency_service_v2_proto_depIdxs, + EnumInfos: file_services_dependency_service_v2_proto_enumTypes, + MessageInfos: file_services_dependency_service_v2_proto_msgTypes, + }.Build() + File_services_dependency_service_v2_proto = out.File + file_services_dependency_service_v2_proto_rawDesc = nil + file_services_dependency_service_v2_proto_goTypes = nil + file_services_dependency_service_v2_proto_depIdxs = nil +} diff --git a/grpc/dependency_service_v2_grpc.pb.go b/grpc/dependency_service_v2_grpc.pb.go new file mode 100644 index 00000000..b9ce366c --- /dev/null +++ b/grpc/dependency_service_v2_grpc.pb.go @@ -0,0 +1,248 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.4.0 +// - protoc v5.27.2 +// source: services/dependency_service_v2.proto + +package grpc + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 + +const ( + DependencyServiceV2_Connect_FullMethodName = "/grpc.DependencyServiceV2/Connect" + DependencyServiceV2_Sync_FullMethodName = "/grpc.DependencyServiceV2/Sync" + DependencyServiceV2_UpdateTaskLog_FullMethodName = "/grpc.DependencyServiceV2/UpdateTaskLog" +) + +// DependencyServiceV2Client is the client API for DependencyServiceV2 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 DependencyServiceV2Client interface { + Connect(ctx context.Context, in *DependencyServiceV2ConnectRequest, opts ...grpc.CallOption) (DependencyServiceV2_ConnectClient, error) + Sync(ctx context.Context, in *DependencyServiceV2SyncRequest, opts ...grpc.CallOption) (*Response, error) + UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependencyServiceV2_UpdateTaskLogClient, error) +} + +type dependencyServiceV2Client struct { + cc grpc.ClientConnInterface +} + +func NewDependencyServiceV2Client(cc grpc.ClientConnInterface) DependencyServiceV2Client { + return &dependencyServiceV2Client{cc} +} + +func (c *dependencyServiceV2Client) Connect(ctx context.Context, in *DependencyServiceV2ConnectRequest, opts ...grpc.CallOption) (DependencyServiceV2_ConnectClient, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &DependencyServiceV2_ServiceDesc.Streams[0], DependencyServiceV2_Connect_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &dependencyServiceV2ConnectClient{ClientStream: 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 DependencyServiceV2_ConnectClient interface { + Recv() (*DependencyServiceV2ConnectResponse, error) + grpc.ClientStream +} + +type dependencyServiceV2ConnectClient struct { + grpc.ClientStream +} + +func (x *dependencyServiceV2ConnectClient) Recv() (*DependencyServiceV2ConnectResponse, error) { + m := new(DependencyServiceV2ConnectResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *dependencyServiceV2Client) Sync(ctx context.Context, in *DependencyServiceV2SyncRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, DependencyServiceV2_Sync_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *dependencyServiceV2Client) UpdateTaskLog(ctx context.Context, opts ...grpc.CallOption) (DependencyServiceV2_UpdateTaskLogClient, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &DependencyServiceV2_ServiceDesc.Streams[1], DependencyServiceV2_UpdateTaskLog_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &dependencyServiceV2UpdateTaskLogClient{ClientStream: stream} + return x, nil +} + +type DependencyServiceV2_UpdateTaskLogClient interface { + Send(*DependencyServiceV2UpdateTaskLogRequest) error + CloseAndRecv() (*Response, error) + grpc.ClientStream +} + +type dependencyServiceV2UpdateTaskLogClient struct { + grpc.ClientStream +} + +func (x *dependencyServiceV2UpdateTaskLogClient) Send(m *DependencyServiceV2UpdateTaskLogRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *dependencyServiceV2UpdateTaskLogClient) CloseAndRecv() (*Response, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(Response) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// DependencyServiceV2Server is the server API for DependencyServiceV2 service. +// All implementations must embed UnimplementedDependencyServiceV2Server +// for forward compatibility +type DependencyServiceV2Server interface { + Connect(*DependencyServiceV2ConnectRequest, DependencyServiceV2_ConnectServer) error + Sync(context.Context, *DependencyServiceV2SyncRequest) (*Response, error) + UpdateTaskLog(DependencyServiceV2_UpdateTaskLogServer) error + mustEmbedUnimplementedDependencyServiceV2Server() +} + +// UnimplementedDependencyServiceV2Server must be embedded to have forward compatible implementations. +type UnimplementedDependencyServiceV2Server struct { +} + +func (UnimplementedDependencyServiceV2Server) Connect(*DependencyServiceV2ConnectRequest, DependencyServiceV2_ConnectServer) error { + return status.Errorf(codes.Unimplemented, "method Connect not implemented") +} +func (UnimplementedDependencyServiceV2Server) Sync(context.Context, *DependencyServiceV2SyncRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Sync not implemented") +} +func (UnimplementedDependencyServiceV2Server) UpdateTaskLog(DependencyServiceV2_UpdateTaskLogServer) error { + return status.Errorf(codes.Unimplemented, "method UpdateTaskLog not implemented") +} +func (UnimplementedDependencyServiceV2Server) mustEmbedUnimplementedDependencyServiceV2Server() {} + +// UnsafeDependencyServiceV2Server may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to DependencyServiceV2Server will +// result in compilation errors. +type UnsafeDependencyServiceV2Server interface { + mustEmbedUnimplementedDependencyServiceV2Server() +} + +func RegisterDependencyServiceV2Server(s grpc.ServiceRegistrar, srv DependencyServiceV2Server) { + s.RegisterService(&DependencyServiceV2_ServiceDesc, srv) +} + +func _DependencyServiceV2_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(DependencyServiceV2ConnectRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(DependencyServiceV2Server).Connect(m, &dependencyServiceV2ConnectServer{ServerStream: stream}) +} + +type DependencyServiceV2_ConnectServer interface { + Send(*DependencyServiceV2ConnectResponse) error + grpc.ServerStream +} + +type dependencyServiceV2ConnectServer struct { + grpc.ServerStream +} + +func (x *dependencyServiceV2ConnectServer) Send(m *DependencyServiceV2ConnectResponse) error { + return x.ServerStream.SendMsg(m) +} + +func _DependencyServiceV2_Sync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DependencyServiceV2SyncRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(DependencyServiceV2Server).Sync(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: DependencyServiceV2_Sync_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(DependencyServiceV2Server).Sync(ctx, req.(*DependencyServiceV2SyncRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _DependencyServiceV2_UpdateTaskLog_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(DependencyServiceV2Server).UpdateTaskLog(&dependencyServiceV2UpdateTaskLogServer{ServerStream: stream}) +} + +type DependencyServiceV2_UpdateTaskLogServer interface { + SendAndClose(*Response) error + Recv() (*DependencyServiceV2UpdateTaskLogRequest, error) + grpc.ServerStream +} + +type dependencyServiceV2UpdateTaskLogServer struct { + grpc.ServerStream +} + +func (x *dependencyServiceV2UpdateTaskLogServer) SendAndClose(m *Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *dependencyServiceV2UpdateTaskLogServer) Recv() (*DependencyServiceV2UpdateTaskLogRequest, error) { + m := new(DependencyServiceV2UpdateTaskLogRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// DependencyServiceV2_ServiceDesc is the grpc.ServiceDesc for DependencyServiceV2 service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var DependencyServiceV2_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.DependencyServiceV2", + HandlerType: (*DependencyServiceV2Server)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Sync", + Handler: _DependencyServiceV2_Sync_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "Connect", + Handler: _DependencyServiceV2_Connect_Handler, + ServerStreams: true, + }, + { + StreamName: "UpdateTaskLog", + Handler: _DependencyServiceV2_UpdateTaskLog_Handler, + ClientStreams: true, + }, + }, + Metadata: "services/dependency_service_v2.proto", +} diff --git a/grpc/message_service.pb.go b/grpc/message_service.pb.go deleted file mode 100644 index ef667f2e..00000000 --- a/grpc/message_service.pb.go +++ /dev/null @@ -1,74 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/message_service.proto - -package grpc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_services_message_service_proto protoreflect.FileDescriptor - -var file_services_message_service_proto_rawDesc = []byte{ - 0x0a, 0x1e, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, - 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x32, 0x4b, 0x0a, 0x0e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x53, 0x65, - 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x39, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, - 0x12, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, - 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, - 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x33, -} - -var file_services_message_service_proto_goTypes = []any{ - (*StreamMessage)(nil), // 0: grpc.StreamMessage -} -var file_services_message_service_proto_depIdxs = []int32{ - 0, // 0: grpc.MessageService.Connect:input_type -> grpc.StreamMessage - 0, // 1: grpc.MessageService.Connect:output_type -> grpc.StreamMessage - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_services_message_service_proto_init() } -func file_services_message_service_proto_init() { - if File_services_message_service_proto != nil { - return - } - file_entity_stream_message_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_services_message_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_message_service_proto_goTypes, - DependencyIndexes: file_services_message_service_proto_depIdxs, - }.Build() - File_services_message_service_proto = out.File - file_services_message_service_proto_rawDesc = nil - file_services_message_service_proto_goTypes = nil - file_services_message_service_proto_depIdxs = nil -} diff --git a/grpc/message_service_grpc.pb.go b/grpc/message_service_grpc.pb.go deleted file mode 100644 index 077a582b..00000000 --- a/grpc/message_service_grpc.pb.go +++ /dev/null @@ -1,142 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/message_service.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - MessageService_Connect_FullMethodName = "/grpc.MessageService/Connect" -) - -// MessageServiceClient is the client API for MessageService 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 MessageServiceClient interface { - Connect(ctx context.Context, opts ...grpc.CallOption) (MessageService_ConnectClient, error) -} - -type messageServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewMessageServiceClient(cc grpc.ClientConnInterface) MessageServiceClient { - return &messageServiceClient{cc} -} - -func (c *messageServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (MessageService_ConnectClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &MessageService_ServiceDesc.Streams[0], MessageService_Connect_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &messageServiceConnectClient{ClientStream: stream} - return x, nil -} - -type MessageService_ConnectClient interface { - Send(*StreamMessage) error - Recv() (*StreamMessage, error) - grpc.ClientStream -} - -type messageServiceConnectClient struct { - grpc.ClientStream -} - -func (x *messageServiceConnectClient) Send(m *StreamMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *messageServiceConnectClient) Recv() (*StreamMessage, error) { - m := new(StreamMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// MessageServiceServer is the server API for MessageService service. -// All implementations must embed UnimplementedMessageServiceServer -// for forward compatibility -type MessageServiceServer interface { - Connect(MessageService_ConnectServer) error - mustEmbedUnimplementedMessageServiceServer() -} - -// UnimplementedMessageServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMessageServiceServer struct { -} - -func (UnimplementedMessageServiceServer) Connect(MessageService_ConnectServer) error { - return status.Errorf(codes.Unimplemented, "method Connect not implemented") -} -func (UnimplementedMessageServiceServer) mustEmbedUnimplementedMessageServiceServer() {} - -// UnsafeMessageServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MessageServiceServer will -// result in compilation errors. -type UnsafeMessageServiceServer interface { - mustEmbedUnimplementedMessageServiceServer() -} - -func RegisterMessageServiceServer(s grpc.ServiceRegistrar, srv MessageServiceServer) { - s.RegisterService(&MessageService_ServiceDesc, srv) -} - -func _MessageService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(MessageServiceServer).Connect(&messageServiceConnectServer{ServerStream: stream}) -} - -type MessageService_ConnectServer interface { - Send(*StreamMessage) error - Recv() (*StreamMessage, error) - grpc.ServerStream -} - -type messageServiceConnectServer struct { - grpc.ServerStream -} - -func (x *messageServiceConnectServer) Send(m *StreamMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *messageServiceConnectServer) Recv() (*StreamMessage, error) { - m := new(StreamMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// MessageService_ServiceDesc is the grpc.ServiceDesc for MessageService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var MessageService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.MessageService", - HandlerType: (*MessageServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "Connect", - Handler: _MessageService_Connect_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "services/message_service.proto", -} diff --git a/grpc/metric_service_v2.pb.go b/grpc/metric_service_v2.pb.go new file mode 100644 index 00000000..72025065 --- /dev/null +++ b/grpc/metric_service_v2.pb.go @@ -0,0 +1,312 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.34.2 +// protoc v5.27.2 +// source: services/metric_service_v2.proto + +package grpc + +import ( + 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) +) + +type MetricServiceV2SendRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + NodeKey string `protobuf:"bytes,2,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` + Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + CpuUsagePercent float32 `protobuf:"fixed32,4,opt,name=cpu_usage_percent,json=cpuUsagePercent,proto3" json:"cpu_usage_percent,omitempty"` + TotalMemory uint64 `protobuf:"varint,5,opt,name=total_memory,json=totalMemory,proto3" json:"total_memory,omitempty"` + AvailableMemory uint64 `protobuf:"varint,6,opt,name=available_memory,json=availableMemory,proto3" json:"available_memory,omitempty"` + UsedMemory uint64 `protobuf:"varint,7,opt,name=used_memory,json=usedMemory,proto3" json:"used_memory,omitempty"` + UsedMemoryPercent float32 `protobuf:"fixed32,8,opt,name=used_memory_percent,json=usedMemoryPercent,proto3" json:"used_memory_percent,omitempty"` + TotalDisk uint64 `protobuf:"varint,9,opt,name=total_disk,json=totalDisk,proto3" json:"total_disk,omitempty"` + AvailableDisk uint64 `protobuf:"varint,10,opt,name=available_disk,json=availableDisk,proto3" json:"available_disk,omitempty"` + UsedDisk uint64 `protobuf:"varint,11,opt,name=used_disk,json=usedDisk,proto3" json:"used_disk,omitempty"` + UsedDiskPercent float32 `protobuf:"fixed32,12,opt,name=used_disk_percent,json=usedDiskPercent,proto3" json:"used_disk_percent,omitempty"` + DiskReadBytesRate float32 `protobuf:"fixed32,15,opt,name=disk_read_bytes_rate,json=diskReadBytesRate,proto3" json:"disk_read_bytes_rate,omitempty"` + DiskWriteBytesRate float32 `protobuf:"fixed32,16,opt,name=disk_write_bytes_rate,json=diskWriteBytesRate,proto3" json:"disk_write_bytes_rate,omitempty"` + NetworkBytesSentRate float32 `protobuf:"fixed32,17,opt,name=network_bytes_sent_rate,json=networkBytesSentRate,proto3" json:"network_bytes_sent_rate,omitempty"` + NetworkBytesRecvRate float32 `protobuf:"fixed32,18,opt,name=network_bytes_recv_rate,json=networkBytesRecvRate,proto3" json:"network_bytes_recv_rate,omitempty"` +} + +func (x *MetricServiceV2SendRequest) Reset() { + *x = MetricServiceV2SendRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_metric_service_v2_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MetricServiceV2SendRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MetricServiceV2SendRequest) ProtoMessage() {} + +func (x *MetricServiceV2SendRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_metric_service_v2_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 MetricServiceV2SendRequest.ProtoReflect.Descriptor instead. +func (*MetricServiceV2SendRequest) Descriptor() ([]byte, []int) { + return file_services_metric_service_v2_proto_rawDescGZIP(), []int{0} +} + +func (x *MetricServiceV2SendRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *MetricServiceV2SendRequest) GetNodeKey() string { + if x != nil { + return x.NodeKey + } + return "" +} + +func (x *MetricServiceV2SendRequest) GetTimestamp() int64 { + if x != nil { + return x.Timestamp + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetCpuUsagePercent() float32 { + if x != nil { + return x.CpuUsagePercent + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetTotalMemory() uint64 { + if x != nil { + return x.TotalMemory + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetAvailableMemory() uint64 { + if x != nil { + return x.AvailableMemory + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetUsedMemory() uint64 { + if x != nil { + return x.UsedMemory + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetUsedMemoryPercent() float32 { + if x != nil { + return x.UsedMemoryPercent + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetTotalDisk() uint64 { + if x != nil { + return x.TotalDisk + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetAvailableDisk() uint64 { + if x != nil { + return x.AvailableDisk + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetUsedDisk() uint64 { + if x != nil { + return x.UsedDisk + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetUsedDiskPercent() float32 { + if x != nil { + return x.UsedDiskPercent + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetDiskReadBytesRate() float32 { + if x != nil { + return x.DiskReadBytesRate + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetDiskWriteBytesRate() float32 { + if x != nil { + return x.DiskWriteBytesRate + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetNetworkBytesSentRate() float32 { + if x != nil { + return x.NetworkBytesSentRate + } + return 0 +} + +func (x *MetricServiceV2SendRequest) GetNetworkBytesRecvRate() float32 { + if x != nil { + return x.NetworkBytesRecvRate + } + return 0 +} + +var File_services_metric_service_v2_proto protoreflect.FileDescriptor + +var file_services_metric_service_v2_proto_rawDesc = []byte{ + 0x0a, 0x20, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x32, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, + 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, + 0x95, 0x05, 0x0a, 0x1a, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x56, 0x32, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, + 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, 0x11, 0x63, + 0x70, 0x75, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x63, 0x70, 0x75, 0x55, 0x73, 0x61, 0x67, 0x65, + 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, + 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x74, + 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x10, 0x61, 0x76, + 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x6d, 0x65, + 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x75, 0x73, 0x65, 0x64, + 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2e, 0x0a, 0x13, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x6d, + 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x11, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x50, + 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x64, 0x69, 0x73, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, + 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x61, + 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x1b, 0x0a, 0x09, + 0x75, 0x73, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x08, 0x75, 0x73, 0x65, 0x64, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x2a, 0x0a, 0x11, 0x75, 0x73, 0x65, + 0x64, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, 0x0c, + 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x64, 0x44, 0x69, 0x73, 0x6b, 0x50, 0x65, + 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x72, 0x65, + 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x0f, 0x20, + 0x01, 0x28, 0x02, 0x52, 0x11, 0x64, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x61, 0x64, 0x42, 0x79, 0x74, + 0x65, 0x73, 0x52, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x15, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x77, + 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, + 0x10, 0x20, 0x01, 0x28, 0x02, 0x52, 0x12, 0x64, 0x69, 0x73, 0x6b, 0x57, 0x72, 0x69, 0x74, 0x65, + 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x6e, 0x74, 0x5f, + 0x72, 0x61, 0x74, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x02, 0x52, 0x14, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x74, 0x52, 0x61, 0x74, 0x65, + 0x12, 0x35, 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x62, 0x79, 0x74, 0x65, + 0x73, 0x5f, 0x72, 0x65, 0x63, 0x76, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x12, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x14, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, + 0x65, 0x63, 0x76, 0x52, 0x61, 0x74, 0x65, 0x32, 0x4d, 0x0a, 0x0f, 0x4d, 0x65, 0x74, 0x72, 0x69, + 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x12, 0x3a, 0x0a, 0x04, 0x53, 0x65, + 0x6e, 0x64, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, + 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x53, 0x65, 0x6e, 0x64, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_services_metric_service_v2_proto_rawDescOnce sync.Once + file_services_metric_service_v2_proto_rawDescData = file_services_metric_service_v2_proto_rawDesc +) + +func file_services_metric_service_v2_proto_rawDescGZIP() []byte { + file_services_metric_service_v2_proto_rawDescOnce.Do(func() { + file_services_metric_service_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_metric_service_v2_proto_rawDescData) + }) + return file_services_metric_service_v2_proto_rawDescData +} + +var file_services_metric_service_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_services_metric_service_v2_proto_goTypes = []any{ + (*MetricServiceV2SendRequest)(nil), // 0: grpc.MetricServiceV2SendRequest + (*Response)(nil), // 1: grpc.Response +} +var file_services_metric_service_v2_proto_depIdxs = []int32{ + 0, // 0: grpc.MetricServiceV2.Send:input_type -> grpc.MetricServiceV2SendRequest + 1, // 1: grpc.MetricServiceV2.Send:output_type -> grpc.Response + 1, // [1:2] is the sub-list for method output_type + 0, // [0:1] is the sub-list for method input_type + 0, // [0:0] is the sub-list for extension type_name + 0, // [0:0] is the sub-list for extension extendee + 0, // [0:0] is the sub-list for field type_name +} + +func init() { file_services_metric_service_v2_proto_init() } +func file_services_metric_service_v2_proto_init() { + if File_services_metric_service_v2_proto != nil { + return + } + file_entity_response_proto_init() + if !protoimpl.UnsafeEnabled { + file_services_metric_service_v2_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*MetricServiceV2SendRequest); 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_services_metric_service_v2_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_services_metric_service_v2_proto_goTypes, + DependencyIndexes: file_services_metric_service_v2_proto_depIdxs, + MessageInfos: file_services_metric_service_v2_proto_msgTypes, + }.Build() + File_services_metric_service_v2_proto = out.File + file_services_metric_service_v2_proto_rawDesc = nil + file_services_metric_service_v2_proto_goTypes = nil + file_services_metric_service_v2_proto_depIdxs = nil +} diff --git a/grpc/metric_service_v2_grpc.pb.go b/grpc/metric_service_v2_grpc.pb.go new file mode 100644 index 00000000..af8e8773 --- /dev/null +++ b/grpc/metric_service_v2_grpc.pb.go @@ -0,0 +1,110 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.4.0 +// - protoc v5.27.2 +// source: services/metric_service_v2.proto + +package grpc + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.62.0 or later. +const _ = grpc.SupportPackageIsVersion8 + +const ( + MetricServiceV2_Send_FullMethodName = "/grpc.MetricServiceV2/Send" +) + +// MetricServiceV2Client is the client API for MetricServiceV2 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 MetricServiceV2Client interface { + Send(ctx context.Context, in *MetricServiceV2SendRequest, opts ...grpc.CallOption) (*Response, error) +} + +type metricServiceV2Client struct { + cc grpc.ClientConnInterface +} + +func NewMetricServiceV2Client(cc grpc.ClientConnInterface) MetricServiceV2Client { + return &metricServiceV2Client{cc} +} + +func (c *metricServiceV2Client) Send(ctx context.Context, in *MetricServiceV2SendRequest, opts ...grpc.CallOption) (*Response, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Response) + err := c.cc.Invoke(ctx, MetricServiceV2_Send_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MetricServiceV2Server is the server API for MetricServiceV2 service. +// All implementations must embed UnimplementedMetricServiceV2Server +// for forward compatibility +type MetricServiceV2Server interface { + Send(context.Context, *MetricServiceV2SendRequest) (*Response, error) + mustEmbedUnimplementedMetricServiceV2Server() +} + +// UnimplementedMetricServiceV2Server must be embedded to have forward compatible implementations. +type UnimplementedMetricServiceV2Server struct { +} + +func (UnimplementedMetricServiceV2Server) Send(context.Context, *MetricServiceV2SendRequest) (*Response, error) { + return nil, status.Errorf(codes.Unimplemented, "method Send not implemented") +} +func (UnimplementedMetricServiceV2Server) mustEmbedUnimplementedMetricServiceV2Server() {} + +// UnsafeMetricServiceV2Server may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MetricServiceV2Server will +// result in compilation errors. +type UnsafeMetricServiceV2Server interface { + mustEmbedUnimplementedMetricServiceV2Server() +} + +func RegisterMetricServiceV2Server(s grpc.ServiceRegistrar, srv MetricServiceV2Server) { + s.RegisterService(&MetricServiceV2_ServiceDesc, srv) +} + +func _MetricServiceV2_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MetricServiceV2SendRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MetricServiceV2Server).Send(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MetricServiceV2_Send_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MetricServiceV2Server).Send(ctx, req.(*MetricServiceV2SendRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// MetricServiceV2_ServiceDesc is the grpc.ServiceDesc for MetricServiceV2 service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MetricServiceV2_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "grpc.MetricServiceV2", + HandlerType: (*MetricServiceV2Server)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Send", + Handler: _MetricServiceV2_Send_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "services/metric_service_v2.proto", +} diff --git a/grpc/metrics_service_v2.pb.go b/grpc/metrics_service_v2.pb.go deleted file mode 100644 index 20705ba6..00000000 --- a/grpc/metrics_service_v2.pb.go +++ /dev/null @@ -1,312 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/metrics_service_v2.proto - -package grpc - -import ( - 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) -) - -type MetricsServiceV2SendRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - NodeKey string `protobuf:"bytes,2,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` - Timestamp int64 `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - CpuUsagePercent float32 `protobuf:"fixed32,4,opt,name=cpu_usage_percent,json=cpuUsagePercent,proto3" json:"cpu_usage_percent,omitempty"` - TotalMemory uint64 `protobuf:"varint,5,opt,name=total_memory,json=totalMemory,proto3" json:"total_memory,omitempty"` - AvailableMemory uint64 `protobuf:"varint,6,opt,name=available_memory,json=availableMemory,proto3" json:"available_memory,omitempty"` - UsedMemory uint64 `protobuf:"varint,7,opt,name=used_memory,json=usedMemory,proto3" json:"used_memory,omitempty"` - UsedMemoryPercent float32 `protobuf:"fixed32,8,opt,name=used_memory_percent,json=usedMemoryPercent,proto3" json:"used_memory_percent,omitempty"` - TotalDisk uint64 `protobuf:"varint,9,opt,name=total_disk,json=totalDisk,proto3" json:"total_disk,omitempty"` - AvailableDisk uint64 `protobuf:"varint,10,opt,name=available_disk,json=availableDisk,proto3" json:"available_disk,omitempty"` - UsedDisk uint64 `protobuf:"varint,11,opt,name=used_disk,json=usedDisk,proto3" json:"used_disk,omitempty"` - UsedDiskPercent float32 `protobuf:"fixed32,12,opt,name=used_disk_percent,json=usedDiskPercent,proto3" json:"used_disk_percent,omitempty"` - DiskReadBytesRate float32 `protobuf:"fixed32,15,opt,name=disk_read_bytes_rate,json=diskReadBytesRate,proto3" json:"disk_read_bytes_rate,omitempty"` - DiskWriteBytesRate float32 `protobuf:"fixed32,16,opt,name=disk_write_bytes_rate,json=diskWriteBytesRate,proto3" json:"disk_write_bytes_rate,omitempty"` - NetworkBytesSentRate float32 `protobuf:"fixed32,17,opt,name=network_bytes_sent_rate,json=networkBytesSentRate,proto3" json:"network_bytes_sent_rate,omitempty"` - NetworkBytesRecvRate float32 `protobuf:"fixed32,18,opt,name=network_bytes_recv_rate,json=networkBytesRecvRate,proto3" json:"network_bytes_recv_rate,omitempty"` -} - -func (x *MetricsServiceV2SendRequest) Reset() { - *x = MetricsServiceV2SendRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_services_metrics_service_v2_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MetricsServiceV2SendRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MetricsServiceV2SendRequest) ProtoMessage() {} - -func (x *MetricsServiceV2SendRequest) ProtoReflect() protoreflect.Message { - mi := &file_services_metrics_service_v2_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 MetricsServiceV2SendRequest.ProtoReflect.Descriptor instead. -func (*MetricsServiceV2SendRequest) Descriptor() ([]byte, []int) { - return file_services_metrics_service_v2_proto_rawDescGZIP(), []int{0} -} - -func (x *MetricsServiceV2SendRequest) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -func (x *MetricsServiceV2SendRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *MetricsServiceV2SendRequest) GetTimestamp() int64 { - if x != nil { - return x.Timestamp - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetCpuUsagePercent() float32 { - if x != nil { - return x.CpuUsagePercent - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetTotalMemory() uint64 { - if x != nil { - return x.TotalMemory - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetAvailableMemory() uint64 { - if x != nil { - return x.AvailableMemory - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetUsedMemory() uint64 { - if x != nil { - return x.UsedMemory - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetUsedMemoryPercent() float32 { - if x != nil { - return x.UsedMemoryPercent - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetTotalDisk() uint64 { - if x != nil { - return x.TotalDisk - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetAvailableDisk() uint64 { - if x != nil { - return x.AvailableDisk - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetUsedDisk() uint64 { - if x != nil { - return x.UsedDisk - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetUsedDiskPercent() float32 { - if x != nil { - return x.UsedDiskPercent - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetDiskReadBytesRate() float32 { - if x != nil { - return x.DiskReadBytesRate - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetDiskWriteBytesRate() float32 { - if x != nil { - return x.DiskWriteBytesRate - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetNetworkBytesSentRate() float32 { - if x != nil { - return x.NetworkBytesSentRate - } - return 0 -} - -func (x *MetricsServiceV2SendRequest) GetNetworkBytesRecvRate() float32 { - if x != nil { - return x.NetworkBytesRecvRate - } - return 0 -} - -var File_services_metrics_service_v2_proto protoreflect.FileDescriptor - -var file_services_metrics_service_v2_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x65, 0x74, 0x72, 0x69, - 0x63, 0x73, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x76, 0x32, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x22, 0x96, 0x05, 0x0a, 0x1b, 0x4d, 0x65, 0x74, 0x72, 0x69, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, - 0x69, 0x63, 0x65, 0x56, 0x32, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x12, 0x12, 0x0a, 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x4b, 0x65, 0x79, 0x12, - 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x2a, 0x0a, - 0x11, 0x63, 0x70, 0x75, 0x5f, 0x75, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, - 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x63, 0x70, 0x75, 0x55, 0x73, 0x61, - 0x67, 0x65, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x21, 0x0a, 0x0c, 0x74, 0x6f, 0x74, - 0x61, 0x6c, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x29, 0x0a, 0x10, - 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, - 0x18, 0x06, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0f, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, - 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x75, 0x73, 0x65, 0x64, 0x5f, - 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0a, 0x75, 0x73, - 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x12, 0x2e, 0x0a, 0x13, 0x75, 0x73, 0x65, 0x64, - 0x5f, 0x6d, 0x65, 0x6d, 0x6f, 0x72, 0x79, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x18, - 0x08, 0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x75, 0x73, 0x65, 0x64, 0x4d, 0x65, 0x6d, 0x6f, 0x72, - 0x79, 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x1d, 0x0a, 0x0a, 0x74, 0x6f, 0x74, 0x61, - 0x6c, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x09, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x25, 0x0a, 0x0e, 0x61, 0x76, 0x61, 0x69, 0x6c, - 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0d, 0x61, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x1b, - 0x0a, 0x09, 0x75, 0x73, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x08, 0x75, 0x73, 0x65, 0x64, 0x44, 0x69, 0x73, 0x6b, 0x12, 0x2a, 0x0a, 0x11, 0x75, - 0x73, 0x65, 0x64, 0x5f, 0x64, 0x69, 0x73, 0x6b, 0x5f, 0x70, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, - 0x18, 0x0c, 0x20, 0x01, 0x28, 0x02, 0x52, 0x0f, 0x75, 0x73, 0x65, 0x64, 0x44, 0x69, 0x73, 0x6b, - 0x50, 0x65, 0x72, 0x63, 0x65, 0x6e, 0x74, 0x12, 0x2f, 0x0a, 0x14, 0x64, 0x69, 0x73, 0x6b, 0x5f, - 0x72, 0x65, 0x61, 0x64, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, - 0x0f, 0x20, 0x01, 0x28, 0x02, 0x52, 0x11, 0x64, 0x69, 0x73, 0x6b, 0x52, 0x65, 0x61, 0x64, 0x42, - 0x79, 0x74, 0x65, 0x73, 0x52, 0x61, 0x74, 0x65, 0x12, 0x31, 0x0a, 0x15, 0x64, 0x69, 0x73, 0x6b, - 0x5f, 0x77, 0x72, 0x69, 0x74, 0x65, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x72, 0x61, 0x74, - 0x65, 0x18, 0x10, 0x20, 0x01, 0x28, 0x02, 0x52, 0x12, 0x64, 0x69, 0x73, 0x6b, 0x57, 0x72, 0x69, - 0x74, 0x65, 0x42, 0x79, 0x74, 0x65, 0x73, 0x52, 0x61, 0x74, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x6e, - 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x62, 0x79, 0x74, 0x65, 0x73, 0x5f, 0x73, 0x65, 0x6e, - 0x74, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x11, 0x20, 0x01, 0x28, 0x02, 0x52, 0x14, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x42, 0x79, 0x74, 0x65, 0x73, 0x53, 0x65, 0x6e, 0x74, 0x52, 0x61, - 0x74, 0x65, 0x12, 0x35, 0x0a, 0x17, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x5f, 0x62, 0x79, - 0x74, 0x65, 0x73, 0x5f, 0x72, 0x65, 0x63, 0x76, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x18, 0x12, 0x20, - 0x01, 0x28, 0x02, 0x52, 0x14, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x42, 0x79, 0x74, 0x65, - 0x73, 0x52, 0x65, 0x63, 0x76, 0x52, 0x61, 0x74, 0x65, 0x32, 0x4f, 0x0a, 0x10, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x12, 0x3b, 0x0a, - 0x04, 0x53, 0x65, 0x6e, 0x64, 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x65, 0x74, - 0x72, 0x69, 0x63, 0x73, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x56, 0x32, 0x53, 0x65, 0x6e, - 0x64, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, - 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_services_metrics_service_v2_proto_rawDescOnce sync.Once - file_services_metrics_service_v2_proto_rawDescData = file_services_metrics_service_v2_proto_rawDesc -) - -func file_services_metrics_service_v2_proto_rawDescGZIP() []byte { - file_services_metrics_service_v2_proto_rawDescOnce.Do(func() { - file_services_metrics_service_v2_proto_rawDescData = protoimpl.X.CompressGZIP(file_services_metrics_service_v2_proto_rawDescData) - }) - return file_services_metrics_service_v2_proto_rawDescData -} - -var file_services_metrics_service_v2_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_services_metrics_service_v2_proto_goTypes = []any{ - (*MetricsServiceV2SendRequest)(nil), // 0: grpc.MetricsServiceV2SendRequest - (*Response)(nil), // 1: grpc.Response -} -var file_services_metrics_service_v2_proto_depIdxs = []int32{ - 0, // 0: grpc.MetricsServiceV2.Send:input_type -> grpc.MetricsServiceV2SendRequest - 1, // 1: grpc.MetricsServiceV2.Send:output_type -> grpc.Response - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_services_metrics_service_v2_proto_init() } -func file_services_metrics_service_v2_proto_init() { - if File_services_metrics_service_v2_proto != nil { - return - } - file_entity_response_proto_init() - if !protoimpl.UnsafeEnabled { - file_services_metrics_service_v2_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*MetricsServiceV2SendRequest); 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_services_metrics_service_v2_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_metrics_service_v2_proto_goTypes, - DependencyIndexes: file_services_metrics_service_v2_proto_depIdxs, - MessageInfos: file_services_metrics_service_v2_proto_msgTypes, - }.Build() - File_services_metrics_service_v2_proto = out.File - file_services_metrics_service_v2_proto_rawDesc = nil - file_services_metrics_service_v2_proto_goTypes = nil - file_services_metrics_service_v2_proto_depIdxs = nil -} diff --git a/grpc/metrics_service_v2_grpc.pb.go b/grpc/metrics_service_v2_grpc.pb.go deleted file mode 100644 index 0b2bbf98..00000000 --- a/grpc/metrics_service_v2_grpc.pb.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/metrics_service_v2.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - MetricsServiceV2_Send_FullMethodName = "/grpc.MetricsServiceV2/Send" -) - -// MetricsServiceV2Client is the client API for MetricsServiceV2 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 MetricsServiceV2Client interface { - Send(ctx context.Context, in *MetricsServiceV2SendRequest, opts ...grpc.CallOption) (*Response, error) -} - -type metricsServiceV2Client struct { - cc grpc.ClientConnInterface -} - -func NewMetricsServiceV2Client(cc grpc.ClientConnInterface) MetricsServiceV2Client { - return &metricsServiceV2Client{cc} -} - -func (c *metricsServiceV2Client) Send(ctx context.Context, in *MetricsServiceV2SendRequest, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, MetricsServiceV2_Send_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MetricsServiceV2Server is the server API for MetricsServiceV2 service. -// All implementations must embed UnimplementedMetricsServiceV2Server -// for forward compatibility -type MetricsServiceV2Server interface { - Send(context.Context, *MetricsServiceV2SendRequest) (*Response, error) - mustEmbedUnimplementedMetricsServiceV2Server() -} - -// UnimplementedMetricsServiceV2Server must be embedded to have forward compatible implementations. -type UnimplementedMetricsServiceV2Server struct { -} - -func (UnimplementedMetricsServiceV2Server) Send(context.Context, *MetricsServiceV2SendRequest) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Send not implemented") -} -func (UnimplementedMetricsServiceV2Server) mustEmbedUnimplementedMetricsServiceV2Server() {} - -// UnsafeMetricsServiceV2Server may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MetricsServiceV2Server will -// result in compilation errors. -type UnsafeMetricsServiceV2Server interface { - mustEmbedUnimplementedMetricsServiceV2Server() -} - -func RegisterMetricsServiceV2Server(s grpc.ServiceRegistrar, srv MetricsServiceV2Server) { - s.RegisterService(&MetricsServiceV2_ServiceDesc, srv) -} - -func _MetricsServiceV2_Send_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MetricsServiceV2SendRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MetricsServiceV2Server).Send(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: MetricsServiceV2_Send_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MetricsServiceV2Server).Send(ctx, req.(*MetricsServiceV2SendRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// MetricsServiceV2_ServiceDesc is the grpc.ServiceDesc for MetricsServiceV2 service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var MetricsServiceV2_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.MetricsServiceV2", - HandlerType: (*MetricsServiceV2Server)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Send", - Handler: _MetricsServiceV2_Send_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "services/metrics_service_v2.proto", -} diff --git a/grpc/model_base_service.pb.go b/grpc/model_base_service.pb.go deleted file mode 100644 index 6d6bde70..00000000 --- a/grpc/model_base_service.pb.go +++ /dev/null @@ -1,129 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/model_base_service.proto - -package grpc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_services_model_base_service_proto protoreflect.FileDescriptor - -var file_services_model_base_service_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x14, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xac, 0x04, 0x0a, 0x10, 0x4d, 0x6f, 0x64, 0x65, 0x6c, - 0x42, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x47, - 0x65, 0x74, 0x42, 0x79, 0x49, 0x64, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x26, 0x0a, 0x03, 0x47, 0x65, 0x74, 0x12, 0x0d, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, - 0x2a, 0x0a, 0x07, 0x47, 0x65, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 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, 0x2d, 0x0a, 0x0a, 0x44, - 0x65, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x79, 0x49, 0x64, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 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, 0x29, 0x0a, 0x06, 0x44, 0x65, - 0x6c, 0x65, 0x74, 0x65, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x2d, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4c, - 0x69, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x32, 0x0a, 0x0f, 0x46, 0x6f, 0x72, 0x63, 0x65, 0x44, 0x65, 0x6c, - 0x65, 0x74, 0x65, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x2d, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x42, 0x79, 0x49, 0x64, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x29, 0x0a, 0x06, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x2c, 0x0a, 0x09, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x44, 0x6f, 0x63, 0x12, - 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x29, 0x0a, 0x06, 0x49, 0x6e, 0x73, 0x65, 0x72, 0x74, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, - 0x63, 0x2e, 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, 0x28, 0x0a, 0x05, 0x43, - 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_services_model_base_service_proto_goTypes = []any{ - (*Request)(nil), // 0: grpc.Request - (*Response)(nil), // 1: grpc.Response -} -var file_services_model_base_service_proto_depIdxs = []int32{ - 0, // 0: grpc.ModelBaseService.GetById:input_type -> grpc.Request - 0, // 1: grpc.ModelBaseService.Get:input_type -> grpc.Request - 0, // 2: grpc.ModelBaseService.GetList:input_type -> grpc.Request - 0, // 3: grpc.ModelBaseService.DeleteById:input_type -> grpc.Request - 0, // 4: grpc.ModelBaseService.Delete:input_type -> grpc.Request - 0, // 5: grpc.ModelBaseService.DeleteList:input_type -> grpc.Request - 0, // 6: grpc.ModelBaseService.ForceDeleteList:input_type -> grpc.Request - 0, // 7: grpc.ModelBaseService.UpdateById:input_type -> grpc.Request - 0, // 8: grpc.ModelBaseService.Update:input_type -> grpc.Request - 0, // 9: grpc.ModelBaseService.UpdateDoc:input_type -> grpc.Request - 0, // 10: grpc.ModelBaseService.Insert:input_type -> grpc.Request - 0, // 11: grpc.ModelBaseService.Count:input_type -> grpc.Request - 1, // 12: grpc.ModelBaseService.GetById:output_type -> grpc.Response - 1, // 13: grpc.ModelBaseService.Get:output_type -> grpc.Response - 1, // 14: grpc.ModelBaseService.GetList:output_type -> grpc.Response - 1, // 15: grpc.ModelBaseService.DeleteById:output_type -> grpc.Response - 1, // 16: grpc.ModelBaseService.Delete:output_type -> grpc.Response - 1, // 17: grpc.ModelBaseService.DeleteList:output_type -> grpc.Response - 1, // 18: grpc.ModelBaseService.ForceDeleteList:output_type -> grpc.Response - 1, // 19: grpc.ModelBaseService.UpdateById:output_type -> grpc.Response - 1, // 20: grpc.ModelBaseService.Update:output_type -> grpc.Response - 1, // 21: grpc.ModelBaseService.UpdateDoc:output_type -> grpc.Response - 1, // 22: grpc.ModelBaseService.Insert:output_type -> grpc.Response - 1, // 23: grpc.ModelBaseService.Count:output_type -> grpc.Response - 12, // [12:24] is the sub-list for method output_type - 0, // [0:12] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_services_model_base_service_proto_init() } -func file_services_model_base_service_proto_init() { - if File_services_model_base_service_proto != nil { - return - } - file_entity_request_proto_init() - file_entity_response_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_services_model_base_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_model_base_service_proto_goTypes, - DependencyIndexes: file_services_model_base_service_proto_depIdxs, - }.Build() - File_services_model_base_service_proto = out.File - file_services_model_base_service_proto_rawDesc = nil - file_services_model_base_service_proto_goTypes = nil - file_services_model_base_service_proto_depIdxs = nil -} diff --git a/grpc/model_base_service_grpc.pb.go b/grpc/model_base_service_grpc.pb.go deleted file mode 100644 index b5c75d4c..00000000 --- a/grpc/model_base_service_grpc.pb.go +++ /dev/null @@ -1,528 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/model_base_service.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - ModelBaseService_GetById_FullMethodName = "/grpc.ModelBaseService/GetById" - ModelBaseService_Get_FullMethodName = "/grpc.ModelBaseService/Get" - ModelBaseService_GetList_FullMethodName = "/grpc.ModelBaseService/GetList" - ModelBaseService_DeleteById_FullMethodName = "/grpc.ModelBaseService/DeleteById" - ModelBaseService_Delete_FullMethodName = "/grpc.ModelBaseService/Delete" - ModelBaseService_DeleteList_FullMethodName = "/grpc.ModelBaseService/DeleteList" - ModelBaseService_ForceDeleteList_FullMethodName = "/grpc.ModelBaseService/ForceDeleteList" - ModelBaseService_UpdateById_FullMethodName = "/grpc.ModelBaseService/UpdateById" - ModelBaseService_Update_FullMethodName = "/grpc.ModelBaseService/Update" - ModelBaseService_UpdateDoc_FullMethodName = "/grpc.ModelBaseService/UpdateDoc" - ModelBaseService_Insert_FullMethodName = "/grpc.ModelBaseService/Insert" - ModelBaseService_Count_FullMethodName = "/grpc.ModelBaseService/Count" -) - -// ModelBaseServiceClient is the client API for ModelBaseService 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 ModelBaseServiceClient interface { - GetById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - Get(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - GetList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - DeleteById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - Delete(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - DeleteList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - ForceDeleteList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - UpdateById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - Update(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - UpdateDoc(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - Insert(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) - Count(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) -} - -type modelBaseServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewModelBaseServiceClient(cc grpc.ClientConnInterface) ModelBaseServiceClient { - return &modelBaseServiceClient{cc} -} - -func (c *modelBaseServiceClient) GetById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_GetById_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) Get(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_Get_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) GetList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_GetList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) DeleteById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_DeleteById_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) Delete(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_Delete_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) DeleteList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_DeleteList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) ForceDeleteList(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_ForceDeleteList_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) UpdateById(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_UpdateById_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) Update(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_Update_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) UpdateDoc(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_UpdateDoc_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) Insert(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_Insert_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *modelBaseServiceClient) Count(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelBaseService_Count_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ModelBaseServiceServer is the server API for ModelBaseService service. -// All implementations must embed UnimplementedModelBaseServiceServer -// for forward compatibility -type ModelBaseServiceServer interface { - GetById(context.Context, *Request) (*Response, error) - Get(context.Context, *Request) (*Response, error) - GetList(context.Context, *Request) (*Response, error) - DeleteById(context.Context, *Request) (*Response, error) - Delete(context.Context, *Request) (*Response, error) - DeleteList(context.Context, *Request) (*Response, error) - ForceDeleteList(context.Context, *Request) (*Response, error) - UpdateById(context.Context, *Request) (*Response, error) - Update(context.Context, *Request) (*Response, error) - UpdateDoc(context.Context, *Request) (*Response, error) - Insert(context.Context, *Request) (*Response, error) - Count(context.Context, *Request) (*Response, error) - mustEmbedUnimplementedModelBaseServiceServer() -} - -// UnimplementedModelBaseServiceServer must be embedded to have forward compatible implementations. -type UnimplementedModelBaseServiceServer struct { -} - -func (UnimplementedModelBaseServiceServer) GetById(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetById not implemented") -} -func (UnimplementedModelBaseServiceServer) Get(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Get not implemented") -} -func (UnimplementedModelBaseServiceServer) GetList(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method GetList not implemented") -} -func (UnimplementedModelBaseServiceServer) DeleteById(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteById not implemented") -} -func (UnimplementedModelBaseServiceServer) Delete(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Delete not implemented") -} -func (UnimplementedModelBaseServiceServer) DeleteList(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method DeleteList not implemented") -} -func (UnimplementedModelBaseServiceServer) ForceDeleteList(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method ForceDeleteList not implemented") -} -func (UnimplementedModelBaseServiceServer) UpdateById(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateById not implemented") -} -func (UnimplementedModelBaseServiceServer) Update(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Update not implemented") -} -func (UnimplementedModelBaseServiceServer) UpdateDoc(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateDoc not implemented") -} -func (UnimplementedModelBaseServiceServer) Insert(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Insert not implemented") -} -func (UnimplementedModelBaseServiceServer) Count(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Count not implemented") -} -func (UnimplementedModelBaseServiceServer) mustEmbedUnimplementedModelBaseServiceServer() {} - -// UnsafeModelBaseServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ModelBaseServiceServer will -// result in compilation errors. -type UnsafeModelBaseServiceServer interface { - mustEmbedUnimplementedModelBaseServiceServer() -} - -func RegisterModelBaseServiceServer(s grpc.ServiceRegistrar, srv ModelBaseServiceServer) { - s.RegisterService(&ModelBaseService_ServiceDesc, srv) -} - -func _ModelBaseService_GetById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).GetById(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_GetById_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).GetById(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).Get(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_Get_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).Get(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_GetList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).GetList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_GetList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).GetList(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_DeleteById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).DeleteById(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_DeleteById_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).DeleteById(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_Delete_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).Delete(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_Delete_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).Delete(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_DeleteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).DeleteList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_DeleteList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).DeleteList(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_ForceDeleteList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).ForceDeleteList(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_ForceDeleteList_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).ForceDeleteList(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_UpdateById_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).UpdateById(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_UpdateById_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).UpdateById(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_Update_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).Update(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_Update_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).Update(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_UpdateDoc_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).UpdateDoc(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_UpdateDoc_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).UpdateDoc(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_Insert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).Insert(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_Insert_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).Insert(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -func _ModelBaseService_Count_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelBaseServiceServer).Count(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelBaseService_Count_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelBaseServiceServer).Count(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -// ModelBaseService_ServiceDesc is the grpc.ServiceDesc for ModelBaseService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ModelBaseService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.ModelBaseService", - HandlerType: (*ModelBaseServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "GetById", - Handler: _ModelBaseService_GetById_Handler, - }, - { - MethodName: "Get", - Handler: _ModelBaseService_Get_Handler, - }, - { - MethodName: "GetList", - Handler: _ModelBaseService_GetList_Handler, - }, - { - MethodName: "DeleteById", - Handler: _ModelBaseService_DeleteById_Handler, - }, - { - MethodName: "Delete", - Handler: _ModelBaseService_Delete_Handler, - }, - { - MethodName: "DeleteList", - Handler: _ModelBaseService_DeleteList_Handler, - }, - { - MethodName: "ForceDeleteList", - Handler: _ModelBaseService_ForceDeleteList_Handler, - }, - { - MethodName: "UpdateById", - Handler: _ModelBaseService_UpdateById_Handler, - }, - { - MethodName: "Update", - Handler: _ModelBaseService_Update_Handler, - }, - { - MethodName: "UpdateDoc", - Handler: _ModelBaseService_UpdateDoc_Handler, - }, - { - MethodName: "Insert", - Handler: _ModelBaseService_Insert_Handler, - }, - { - MethodName: "Count", - Handler: _ModelBaseService_Count_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "services/model_base_service.proto", -} diff --git a/grpc/model_delegate.pb.go b/grpc/model_delegate.pb.go deleted file mode 100644 index c0c4c9f4..00000000 --- a/grpc/model_delegate.pb.go +++ /dev/null @@ -1,75 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/model_delegate.proto - -package grpc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_services_model_delegate_proto protoreflect.FileDescriptor - -var file_services_model_delegate_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, - 0x5f, 0x64, 0x65, 0x6c, 0x65, 0x67, 0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x14, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x65, 0x6e, 0x74, - 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x32, 0x36, 0x0a, 0x0d, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x44, 0x65, 0x6c, 0x65, 0x67, - 0x61, 0x74, 0x65, 0x12, 0x25, 0x0a, 0x02, 0x44, 0x6f, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, - 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_services_model_delegate_proto_goTypes = []any{ - (*Request)(nil), // 0: grpc.Request - (*Response)(nil), // 1: grpc.Response -} -var file_services_model_delegate_proto_depIdxs = []int32{ - 0, // 0: grpc.ModelDelegate.Do:input_type -> grpc.Request - 1, // 1: grpc.ModelDelegate.Do:output_type -> grpc.Response - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_services_model_delegate_proto_init() } -func file_services_model_delegate_proto_init() { - if File_services_model_delegate_proto != nil { - return - } - file_entity_request_proto_init() - file_entity_response_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_services_model_delegate_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_model_delegate_proto_goTypes, - DependencyIndexes: file_services_model_delegate_proto_depIdxs, - }.Build() - File_services_model_delegate_proto = out.File - file_services_model_delegate_proto_rawDesc = nil - file_services_model_delegate_proto_goTypes = nil - file_services_model_delegate_proto_depIdxs = nil -} diff --git a/grpc/model_delegate_grpc.pb.go b/grpc/model_delegate_grpc.pb.go deleted file mode 100644 index 60acc5df..00000000 --- a/grpc/model_delegate_grpc.pb.go +++ /dev/null @@ -1,110 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/model_delegate.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - ModelDelegate_Do_FullMethodName = "/grpc.ModelDelegate/Do" -) - -// ModelDelegateClient is the client API for ModelDelegate 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 ModelDelegateClient interface { - Do(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) -} - -type modelDelegateClient struct { - cc grpc.ClientConnInterface -} - -func NewModelDelegateClient(cc grpc.ClientConnInterface) ModelDelegateClient { - return &modelDelegateClient{cc} -} - -func (c *modelDelegateClient) Do(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, ModelDelegate_Do_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -// ModelDelegateServer is the server API for ModelDelegate service. -// All implementations must embed UnimplementedModelDelegateServer -// for forward compatibility -type ModelDelegateServer interface { - Do(context.Context, *Request) (*Response, error) - mustEmbedUnimplementedModelDelegateServer() -} - -// UnimplementedModelDelegateServer must be embedded to have forward compatible implementations. -type UnimplementedModelDelegateServer struct { -} - -func (UnimplementedModelDelegateServer) Do(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Do not implemented") -} -func (UnimplementedModelDelegateServer) mustEmbedUnimplementedModelDelegateServer() {} - -// UnsafeModelDelegateServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ModelDelegateServer will -// result in compilation errors. -type UnsafeModelDelegateServer interface { - mustEmbedUnimplementedModelDelegateServer() -} - -func RegisterModelDelegateServer(s grpc.ServiceRegistrar, srv ModelDelegateServer) { - s.RegisterService(&ModelDelegate_ServiceDesc, srv) -} - -func _ModelDelegate_Do_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(ModelDelegateServer).Do(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: ModelDelegate_Do_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ModelDelegateServer).Do(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - -// ModelDelegate_ServiceDesc is the grpc.ServiceDesc for ModelDelegate service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var ModelDelegate_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.ModelDelegate", - HandlerType: (*ModelDelegateServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Do", - Handler: _ModelDelegate_Do_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "services/model_delegate.proto", -} diff --git a/grpc/node.pb.go b/grpc/node.pb.go deleted file mode 100644 index 6db136bc..00000000 --- a/grpc/node.pb.go +++ /dev/null @@ -1,246 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: models/node.proto - -package grpc - -import ( - 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) -) - -type Node struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XId string `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Ip string `protobuf:"bytes,3,opt,name=ip,proto3" json:"ip,omitempty"` - Port string `protobuf:"bytes,5,opt,name=port,proto3" json:"port,omitempty"` - Mac string `protobuf:"bytes,6,opt,name=mac,proto3" json:"mac,omitempty"` - Hostname string `protobuf:"bytes,7,opt,name=hostname,proto3" json:"hostname,omitempty"` - Description string `protobuf:"bytes,8,opt,name=description,proto3" json:"description,omitempty"` - Key string `protobuf:"bytes,9,opt,name=key,proto3" json:"key,omitempty"` - IsMaster bool `protobuf:"varint,11,opt,name=is_master,json=isMaster,proto3" json:"is_master,omitempty"` - UpdateTs string `protobuf:"bytes,12,opt,name=update_ts,json=updateTs,proto3" json:"update_ts,omitempty"` - CreateTs string `protobuf:"bytes,13,opt,name=create_ts,json=createTs,proto3" json:"create_ts,omitempty"` - UpdateTsUnix int64 `protobuf:"varint,14,opt,name=update_ts_unix,json=updateTsUnix,proto3" json:"update_ts_unix,omitempty"` -} - -func (x *Node) Reset() { - *x = Node{} - if protoimpl.UnsafeEnabled { - mi := &file_models_node_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Node) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Node) ProtoMessage() {} - -func (x *Node) ProtoReflect() protoreflect.Message { - mi := &file_models_node_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 Node.ProtoReflect.Descriptor instead. -func (*Node) Descriptor() ([]byte, []int) { - return file_models_node_proto_rawDescGZIP(), []int{0} -} - -func (x *Node) GetXId() string { - if x != nil { - return x.XId - } - return "" -} - -func (x *Node) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *Node) GetIp() string { - if x != nil { - return x.Ip - } - return "" -} - -func (x *Node) GetPort() string { - if x != nil { - return x.Port - } - return "" -} - -func (x *Node) GetMac() string { - if x != nil { - return x.Mac - } - return "" -} - -func (x *Node) GetHostname() string { - if x != nil { - return x.Hostname - } - return "" -} - -func (x *Node) GetDescription() string { - if x != nil { - return x.Description - } - return "" -} - -func (x *Node) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *Node) GetIsMaster() bool { - if x != nil { - return x.IsMaster - } - return false -} - -func (x *Node) GetUpdateTs() string { - if x != nil { - return x.UpdateTs - } - return "" -} - -func (x *Node) GetCreateTs() string { - if x != nil { - return x.CreateTs - } - return "" -} - -func (x *Node) GetUpdateTsUnix() int64 { - if x != nil { - return x.UpdateTsUnix - } - return 0 -} - -var File_models_node_proto protoreflect.FileDescriptor - -var file_models_node_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0xae, 0x02, 0x0a, 0x04, 0x4e, 0x6f, - 0x64, 0x65, 0x12, 0x0f, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x70, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x70, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x6f, 0x72, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6d, - 0x61, 0x63, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x61, 0x63, 0x12, 0x1a, 0x0a, - 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x68, 0x6f, 0x73, 0x74, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, - 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, - 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, - 0x09, 0x69, 0x73, 0x5f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x08, 0x69, 0x73, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x12, 0x1b, 0x0a, 0x09, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, 0x73, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x75, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x73, 0x12, 0x1b, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, - 0x65, 0x5f, 0x74, 0x73, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x63, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x54, 0x73, 0x12, 0x24, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x74, - 0x73, 0x5f, 0x75, 0x6e, 0x69, 0x78, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x75, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x54, 0x73, 0x55, 0x6e, 0x69, 0x78, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, - 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_models_node_proto_rawDescOnce sync.Once - file_models_node_proto_rawDescData = file_models_node_proto_rawDesc -) - -func file_models_node_proto_rawDescGZIP() []byte { - file_models_node_proto_rawDescOnce.Do(func() { - file_models_node_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_node_proto_rawDescData) - }) - return file_models_node_proto_rawDescData -} - -var file_models_node_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_models_node_proto_goTypes = []any{ - (*Node)(nil), // 0: grpc.Node -} -var file_models_node_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_models_node_proto_init() } -func file_models_node_proto_init() { - if File_models_node_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_models_node_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Node); 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_models_node_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_models_node_proto_goTypes, - DependencyIndexes: file_models_node_proto_depIdxs, - MessageInfos: file_models_node_proto_msgTypes, - }.Build() - File_models_node_proto = out.File - file_models_node_proto_rawDesc = nil - file_models_node_proto_goTypes = nil - file_models_node_proto_depIdxs = nil -} diff --git a/grpc/node_info.pb.go b/grpc/node_info.pb.go deleted file mode 100644 index 00ccac73..00000000 --- a/grpc/node_info.pb.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/node_info.proto - -package grpc - -import ( - 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) -) - -type NodeInfo struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - IsMaster bool `protobuf:"varint,2,opt,name=is_master,json=isMaster,proto3" json:"is_master,omitempty"` -} - -func (x *NodeInfo) Reset() { - *x = NodeInfo{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_node_info_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *NodeInfo) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*NodeInfo) ProtoMessage() {} - -func (x *NodeInfo) ProtoReflect() protoreflect.Message { - mi := &file_entity_node_info_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 NodeInfo.ProtoReflect.Descriptor instead. -func (*NodeInfo) Descriptor() ([]byte, []int) { - return file_entity_node_info_proto_rawDescGZIP(), []int{0} -} - -func (x *NodeInfo) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *NodeInfo) GetIsMaster() bool { - if x != nil { - return x.IsMaster - } - return false -} - -var File_entity_node_info_proto protoreflect.FileDescriptor - -var file_entity_node_info_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x39, - 0x0a, 0x08, 0x4e, 0x6f, 0x64, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, - 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1b, 0x0a, 0x09, - 0x69, 0x73, 0x5f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, - 0x08, 0x69, 0x73, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, - 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_node_info_proto_rawDescOnce sync.Once - file_entity_node_info_proto_rawDescData = file_entity_node_info_proto_rawDesc -) - -func file_entity_node_info_proto_rawDescGZIP() []byte { - file_entity_node_info_proto_rawDescOnce.Do(func() { - file_entity_node_info_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_node_info_proto_rawDescData) - }) - return file_entity_node_info_proto_rawDescData -} - -var file_entity_node_info_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_entity_node_info_proto_goTypes = []any{ - (*NodeInfo)(nil), // 0: grpc.NodeInfo -} -var file_entity_node_info_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_node_info_proto_init() } -func file_entity_node_info_proto_init() { - if File_entity_node_info_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_entity_node_info_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*NodeInfo); 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_node_info_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_node_info_proto_goTypes, - DependencyIndexes: file_entity_node_info_proto_depIdxs, - MessageInfos: file_entity_node_info_proto_msgTypes, - }.Build() - File_entity_node_info_proto = out.File - file_entity_node_info_proto_rawDesc = nil - file_entity_node_info_proto_goTypes = nil - file_entity_node_info_proto_depIdxs = nil -} diff --git a/grpc/node_service.pb.go b/grpc/node_service.pb.go index 2cd3949a..1919ef9c 100644 --- a/grpc/node_service.pb.go +++ b/grpc/node_service.pb.go @@ -20,16 +20,57 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type NodeServiceSubscribeCode int32 + +const ( + NodeServiceSubscribeCode_PING NodeServiceSubscribeCode = 0 +) + +// Enum value maps for NodeServiceSubscribeCode. +var ( + NodeServiceSubscribeCode_name = map[int32]string{ + 0: "PING", + } + NodeServiceSubscribeCode_value = map[string]int32{ + "PING": 0, + } +) + +func (x NodeServiceSubscribeCode) Enum() *NodeServiceSubscribeCode { + p := new(NodeServiceSubscribeCode) + *p = x + return p +} + +func (x NodeServiceSubscribeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (NodeServiceSubscribeCode) Descriptor() protoreflect.EnumDescriptor { + return file_services_node_service_proto_enumTypes[0].Descriptor() +} + +func (NodeServiceSubscribeCode) Type() protoreflect.EnumType { + return &file_services_node_service_proto_enumTypes[0] +} + +func (x NodeServiceSubscribeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use NodeServiceSubscribeCode.Descriptor instead. +func (NodeServiceSubscribeCode) EnumDescriptor() ([]byte, []int) { + return file_services_node_service_proto_rawDescGZIP(), []int{0} +} + type NodeServiceRegisterRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - IsMaster bool `protobuf:"varint,3,opt,name=isMaster,proto3" json:"isMaster,omitempty"` - AuthKey string `protobuf:"bytes,4,opt,name=authKey,proto3" json:"authKey,omitempty"` - MaxRunners int32 `protobuf:"varint,5,opt,name=maxRunners,proto3" json:"maxRunners,omitempty"` + NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` + NodeName string `protobuf:"bytes,2,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` + MaxRunners int32 `protobuf:"varint,3,opt,name=max_runners,json=maxRunners,proto3" json:"max_runners,omitempty"` } func (x *NodeServiceRegisterRequest) Reset() { @@ -64,30 +105,16 @@ func (*NodeServiceRegisterRequest) Descriptor() ([]byte, []int) { return file_services_node_service_proto_rawDescGZIP(), []int{0} } -func (x *NodeServiceRegisterRequest) GetKey() string { +func (x *NodeServiceRegisterRequest) GetNodeKey() string { if x != nil { - return x.Key + return x.NodeKey } return "" } -func (x *NodeServiceRegisterRequest) GetName() string { +func (x *NodeServiceRegisterRequest) GetNodeName() string { if x != nil { - return x.Name - } - return "" -} - -func (x *NodeServiceRegisterRequest) GetIsMaster() bool { - if x != nil { - return x.IsMaster - } - return false -} - -func (x *NodeServiceRegisterRequest) GetAuthKey() string { - if x != nil { - return x.AuthKey + return x.NodeName } return "" } @@ -104,7 +131,7 @@ type NodeServiceSendHeartbeatRequest struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` } func (x *NodeServiceSendHeartbeatRequest) Reset() { @@ -139,53 +166,153 @@ func (*NodeServiceSendHeartbeatRequest) Descriptor() ([]byte, []int) { return file_services_node_service_proto_rawDescGZIP(), []int{1} } -func (x *NodeServiceSendHeartbeatRequest) GetKey() string { +func (x *NodeServiceSendHeartbeatRequest) GetNodeKey() string { if x != nil { - return x.Key + return x.NodeKey } return "" } +type NodeServiceSubscribeRequest 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 *NodeServiceSubscribeRequest) Reset() { + *x = NodeServiceSubscribeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_node_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeServiceSubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeServiceSubscribeRequest) ProtoMessage() {} + +func (x *NodeServiceSubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_node_service_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 NodeServiceSubscribeRequest.ProtoReflect.Descriptor instead. +func (*NodeServiceSubscribeRequest) Descriptor() ([]byte, []int) { + return file_services_node_service_proto_rawDescGZIP(), []int{2} +} + +func (x *NodeServiceSubscribeRequest) GetNodeKey() string { + if x != nil { + return x.NodeKey + } + return "" +} + +type NodeServiceSubscribeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code NodeServiceSubscribeCode `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.NodeServiceSubscribeCode" json:"code,omitempty"` +} + +func (x *NodeServiceSubscribeResponse) Reset() { + *x = NodeServiceSubscribeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_services_node_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *NodeServiceSubscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*NodeServiceSubscribeResponse) ProtoMessage() {} + +func (x *NodeServiceSubscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_node_service_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 NodeServiceSubscribeResponse.ProtoReflect.Descriptor instead. +func (*NodeServiceSubscribeResponse) Descriptor() ([]byte, []int) { + return file_services_node_service_proto_rawDescGZIP(), []int{3} +} + +func (x *NodeServiceSubscribeResponse) GetCode() NodeServiceSubscribeCode { + if x != nil { + return x.Code + } + return NodeServiceSubscribeCode_PING +} + var File_services_node_service_proto protoreflect.FileDescriptor var file_services_node_service_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, - 0x72, 0x70, 0x63, 0x1a, 0x14, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x98, 0x01, - 0x0a, 0x1a, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x67, - 0x69, 0x73, 0x74, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, - 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, - 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, - 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x73, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x69, 0x73, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x12, 0x18, - 0x0a, 0x07, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x61, 0x75, 0x74, 0x68, 0x4b, 0x65, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x52, - 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, - 0x78, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x73, 0x22, 0x33, 0x0a, 0x1f, 0x4e, 0x6f, 0x64, 0x65, + 0x72, 0x70, 0x63, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x75, 0x0a, 0x1a, 0x4e, 0x6f, + 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, + 0x72, 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, 0x1b, 0x0a, 0x09, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x4e, 0x61, 0x6d, 0x65, + 0x12, 0x1f, 0x0a, 0x0b, 0x6d, 0x61, 0x78, 0x5f, 0x72, 0x75, 0x6e, 0x6e, 0x65, 0x72, 0x73, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x6d, 0x61, 0x78, 0x52, 0x75, 0x6e, 0x6e, 0x65, 0x72, + 0x73, 0x22, 0x3c, 0x0a, 0x1f, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x53, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 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, + 0x38, 0x0a, 0x1b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 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, 0x52, 0x0a, 0x1c, 0x4e, 0x6f, 0x64, + 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4e, + 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, + 0x69, 0x62, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x24, 0x0a, + 0x18, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, + 0x63, 0x72, 0x69, 0x62, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x50, 0x49, 0x4e, + 0x47, 0x10, 0x00, 0x32, 0xef, 0x01, 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, + 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 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, 0x48, 0x0a, 0x0d, 0x53, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x61, 0x72, 0x74, + 0x62, 0x65, 0x61, 0x74, 0x12, 0x25, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x61, 0x72, 0x74, - 0x62, 0x65, 0x61, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x10, 0x0a, 0x03, 0x6b, - 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x32, 0xfc, 0x01, - 0x0a, 0x0b, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, - 0x08, 0x52, 0x65, 0x67, 0x69, 0x73, 0x74, 0x65, 0x72, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 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, 0x48, 0x0a, - 0x0d, 0x53, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 0x12, 0x25, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, - 0x65, 0x53, 0x65, 0x6e, 0x64, 0x48, 0x65, 0x61, 0x72, 0x74, 0x62, 0x65, 0x61, 0x74, 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, 0x33, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x2e, 0x0a, 0x0b, - 0x55, 0x6e, 0x73, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x0d, 0x2e, 0x67, 0x72, - 0x70, 0x63, 0x2e, 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, 0x42, 0x08, 0x5a, 0x06, - 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x62, 0x65, 0x61, 0x74, 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, 0x56, 0x0a, + 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70, + 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, + 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, + 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4e, 0x6f, 0x64, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, + 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x30, 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -200,28 +327,29 @@ func file_services_node_service_proto_rawDescGZIP() []byte { return file_services_node_service_proto_rawDescData } -var file_services_node_service_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_services_node_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_services_node_service_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_services_node_service_proto_goTypes = []any{ - (*NodeServiceRegisterRequest)(nil), // 0: grpc.NodeServiceRegisterRequest - (*NodeServiceSendHeartbeatRequest)(nil), // 1: grpc.NodeServiceSendHeartbeatRequest - (*Request)(nil), // 2: grpc.Request - (*Response)(nil), // 3: grpc.Response - (*StreamMessage)(nil), // 4: grpc.StreamMessage + (NodeServiceSubscribeCode)(0), // 0: grpc.NodeServiceSubscribeCode + (*NodeServiceRegisterRequest)(nil), // 1: grpc.NodeServiceRegisterRequest + (*NodeServiceSendHeartbeatRequest)(nil), // 2: grpc.NodeServiceSendHeartbeatRequest + (*NodeServiceSubscribeRequest)(nil), // 3: grpc.NodeServiceSubscribeRequest + (*NodeServiceSubscribeResponse)(nil), // 4: grpc.NodeServiceSubscribeResponse + (*Response)(nil), // 5: grpc.Response } var file_services_node_service_proto_depIdxs = []int32{ - 0, // 0: grpc.NodeService.Register:input_type -> grpc.NodeServiceRegisterRequest - 1, // 1: grpc.NodeService.SendHeartbeat:input_type -> grpc.NodeServiceSendHeartbeatRequest - 2, // 2: grpc.NodeService.Subscribe:input_type -> grpc.Request - 2, // 3: grpc.NodeService.Unsubscribe:input_type -> grpc.Request - 3, // 4: grpc.NodeService.Register:output_type -> grpc.Response - 3, // 5: grpc.NodeService.SendHeartbeat:output_type -> grpc.Response - 4, // 6: grpc.NodeService.Subscribe:output_type -> grpc.StreamMessage - 3, // 7: grpc.NodeService.Unsubscribe:output_type -> grpc.Response - 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 - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: grpc.NodeServiceSubscribeResponse.code:type_name -> grpc.NodeServiceSubscribeCode + 1, // 1: grpc.NodeService.Register:input_type -> grpc.NodeServiceRegisterRequest + 2, // 2: grpc.NodeService.SendHeartbeat:input_type -> grpc.NodeServiceSendHeartbeatRequest + 3, // 3: grpc.NodeService.Subscribe:input_type -> grpc.NodeServiceSubscribeRequest + 5, // 4: grpc.NodeService.Register:output_type -> grpc.Response + 5, // 5: grpc.NodeService.SendHeartbeat:output_type -> grpc.Response + 4, // 6: grpc.NodeService.Subscribe:output_type -> grpc.NodeServiceSubscribeResponse + 4, // [4:7] is the sub-list for method output_type + 1, // [1:4] is the sub-list for method input_type + 1, // [1:1] is the sub-list for extension type_name + 1, // [1:1] is the sub-list for extension extendee + 0, // [0:1] is the sub-list for field type_name } func init() { file_services_node_service_proto_init() } @@ -229,9 +357,7 @@ func file_services_node_service_proto_init() { if File_services_node_service_proto != nil { return } - file_entity_request_proto_init() file_entity_response_proto_init() - file_entity_stream_message_proto_init() if !protoimpl.UnsafeEnabled { file_services_node_service_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*NodeServiceRegisterRequest); i { @@ -257,19 +383,44 @@ func file_services_node_service_proto_init() { return nil } } + file_services_node_service_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*NodeServiceSubscribeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_node_service_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*NodeServiceSubscribeResponse); 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_services_node_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 2, + NumEnums: 1, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, GoTypes: file_services_node_service_proto_goTypes, DependencyIndexes: file_services_node_service_proto_depIdxs, + EnumInfos: file_services_node_service_proto_enumTypes, MessageInfos: file_services_node_service_proto_msgTypes, }.Build() File_services_node_service_proto = out.File diff --git a/grpc/node_service_grpc.pb.go b/grpc/node_service_grpc.pb.go index db21128b..0b484cb6 100644 --- a/grpc/node_service_grpc.pb.go +++ b/grpc/node_service_grpc.pb.go @@ -22,7 +22,6 @@ const ( NodeService_Register_FullMethodName = "/grpc.NodeService/Register" NodeService_SendHeartbeat_FullMethodName = "/grpc.NodeService/SendHeartbeat" NodeService_Subscribe_FullMethodName = "/grpc.NodeService/Subscribe" - NodeService_Unsubscribe_FullMethodName = "/grpc.NodeService/Unsubscribe" ) // NodeServiceClient is the client API for NodeService service. @@ -31,8 +30,7 @@ const ( type NodeServiceClient interface { Register(ctx context.Context, in *NodeServiceRegisterRequest, opts ...grpc.CallOption) (*Response, error) SendHeartbeat(ctx context.Context, in *NodeServiceSendHeartbeatRequest, opts ...grpc.CallOption) (*Response, error) - Subscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (NodeService_SubscribeClient, error) - Unsubscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + Subscribe(ctx context.Context, in *NodeServiceSubscribeRequest, opts ...grpc.CallOption) (NodeService_SubscribeClient, error) } type nodeServiceClient struct { @@ -63,7 +61,7 @@ func (c *nodeServiceClient) SendHeartbeat(ctx context.Context, in *NodeServiceSe return out, nil } -func (c *nodeServiceClient) Subscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (NodeService_SubscribeClient, error) { +func (c *nodeServiceClient) Subscribe(ctx context.Context, in *NodeServiceSubscribeRequest, opts ...grpc.CallOption) (NodeService_SubscribeClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &NodeService_ServiceDesc.Streams[0], NodeService_Subscribe_FullMethodName, cOpts...) if err != nil { @@ -80,7 +78,7 @@ func (c *nodeServiceClient) Subscribe(ctx context.Context, in *Request, opts ... } type NodeService_SubscribeClient interface { - Recv() (*StreamMessage, error) + Recv() (*NodeServiceSubscribeResponse, error) grpc.ClientStream } @@ -88,32 +86,21 @@ type nodeServiceSubscribeClient struct { grpc.ClientStream } -func (x *nodeServiceSubscribeClient) Recv() (*StreamMessage, error) { - m := new(StreamMessage) +func (x *nodeServiceSubscribeClient) Recv() (*NodeServiceSubscribeResponse, error) { + m := new(NodeServiceSubscribeResponse) if err := x.ClientStream.RecvMsg(m); err != nil { return nil, err } return m, nil } -func (c *nodeServiceClient) Unsubscribe(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, NodeService_Unsubscribe_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - // NodeServiceServer is the server API for NodeService service. // All implementations must embed UnimplementedNodeServiceServer // for forward compatibility type NodeServiceServer interface { Register(context.Context, *NodeServiceRegisterRequest) (*Response, error) SendHeartbeat(context.Context, *NodeServiceSendHeartbeatRequest) (*Response, error) - Subscribe(*Request, NodeService_SubscribeServer) error - Unsubscribe(context.Context, *Request) (*Response, error) + Subscribe(*NodeServiceSubscribeRequest, NodeService_SubscribeServer) error mustEmbedUnimplementedNodeServiceServer() } @@ -127,12 +114,9 @@ func (UnimplementedNodeServiceServer) Register(context.Context, *NodeServiceRegi func (UnimplementedNodeServiceServer) SendHeartbeat(context.Context, *NodeServiceSendHeartbeatRequest) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method SendHeartbeat not implemented") } -func (UnimplementedNodeServiceServer) Subscribe(*Request, NodeService_SubscribeServer) error { +func (UnimplementedNodeServiceServer) Subscribe(*NodeServiceSubscribeRequest, NodeService_SubscribeServer) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } -func (UnimplementedNodeServiceServer) Unsubscribe(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Unsubscribe not implemented") -} func (UnimplementedNodeServiceServer) mustEmbedUnimplementedNodeServiceServer() {} // UnsafeNodeServiceServer may be embedded to opt out of forward compatibility for this service. @@ -183,7 +167,7 @@ func _NodeService_SendHeartbeat_Handler(srv interface{}, ctx context.Context, de } func _NodeService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(Request) + m := new(NodeServiceSubscribeRequest) if err := stream.RecvMsg(m); err != nil { return err } @@ -191,7 +175,7 @@ func _NodeService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) e } type NodeService_SubscribeServer interface { - Send(*StreamMessage) error + Send(*NodeServiceSubscribeResponse) error grpc.ServerStream } @@ -199,28 +183,10 @@ type nodeServiceSubscribeServer struct { grpc.ServerStream } -func (x *nodeServiceSubscribeServer) Send(m *StreamMessage) error { +func (x *nodeServiceSubscribeServer) Send(m *NodeServiceSubscribeResponse) error { return x.ServerStream.SendMsg(m) } -func _NodeService_Unsubscribe_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(NodeServiceServer).Unsubscribe(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: NodeService_Unsubscribe_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(NodeServiceServer).Unsubscribe(ctx, req.(*Request)) - } - return interceptor(ctx, in, info, handler) -} - // NodeService_ServiceDesc is the grpc.ServiceDesc for NodeService service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) @@ -236,10 +202,6 @@ var NodeService_ServiceDesc = grpc.ServiceDesc{ MethodName: "SendHeartbeat", Handler: _NodeService_SendHeartbeat_Handler, }, - { - MethodName: "Unsubscribe", - Handler: _NodeService_Unsubscribe_Handler, - }, }, Streams: []grpc.StreamDesc{ { diff --git a/grpc/plugin_request.pb.go b/grpc/plugin_request.pb.go deleted file mode 100644 index d002b825..00000000 --- a/grpc/plugin_request.pb.go +++ /dev/null @@ -1,161 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/plugin_request.proto - -package grpc - -import ( - 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) -) - -type PluginRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - NodeKey string `protobuf:"bytes,2,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` - Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *PluginRequest) Reset() { - *x = PluginRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_plugin_request_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *PluginRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*PluginRequest) ProtoMessage() {} - -func (x *PluginRequest) ProtoReflect() protoreflect.Message { - mi := &file_entity_plugin_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 PluginRequest.ProtoReflect.Descriptor instead. -func (*PluginRequest) Descriptor() ([]byte, []int) { - return file_entity_plugin_request_proto_rawDescGZIP(), []int{0} -} - -func (x *PluginRequest) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *PluginRequest) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *PluginRequest) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -var File_entity_plugin_request_proto protoreflect.FileDescriptor - -var file_entity_plugin_request_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x5f, - 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, - 0x72, 0x70, 0x63, 0x22, 0x52, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65, - 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, - 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_plugin_request_proto_rawDescOnce sync.Once - file_entity_plugin_request_proto_rawDescData = file_entity_plugin_request_proto_rawDesc -) - -func file_entity_plugin_request_proto_rawDescGZIP() []byte { - file_entity_plugin_request_proto_rawDescOnce.Do(func() { - file_entity_plugin_request_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_plugin_request_proto_rawDescData) - }) - return file_entity_plugin_request_proto_rawDescData -} - -var file_entity_plugin_request_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_entity_plugin_request_proto_goTypes = []any{ - (*PluginRequest)(nil), // 0: grpc.PluginRequest -} -var file_entity_plugin_request_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_plugin_request_proto_init() } -func file_entity_plugin_request_proto_init() { - if File_entity_plugin_request_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_entity_plugin_request_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*PluginRequest); 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_plugin_request_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_plugin_request_proto_goTypes, - DependencyIndexes: file_entity_plugin_request_proto_depIdxs, - MessageInfos: file_entity_plugin_request_proto_msgTypes, - }.Build() - File_entity_plugin_request_proto = out.File - file_entity_plugin_request_proto_rawDesc = nil - file_entity_plugin_request_proto_goTypes = nil - file_entity_plugin_request_proto_depIdxs = nil -} diff --git a/grpc/plugin_service.pb.go b/grpc/plugin_service.pb.go deleted file mode 100644 index dbae4923..00000000 --- a/grpc/plugin_service.pb.go +++ /dev/null @@ -1,91 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: services/plugin_service.proto - -package grpc - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - reflect "reflect" -) - -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) -) - -var File_services_plugin_service_proto protoreflect.FileDescriptor - -var file_services_plugin_service_proto_rawDesc = []byte{ - 0x0a, 0x1d, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x70, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, - 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x70, 0x6c, - 0x75, 0x67, 0x69, 0x6e, 0x5f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x32, 0xb5, 0x01, 0x0a, 0x0d, 0x50, 0x6c, 0x75, 0x67, 0x69, - 0x6e, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x31, 0x0a, 0x08, 0x52, 0x65, 0x67, 0x69, - 0x73, 0x74, 0x65, 0x72, 0x12, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x50, 0x6c, 0x75, 0x67, - 0x69, 0x6e, 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, 0x39, 0x0a, 0x09, 0x53, - 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x12, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, - 0x50, 0x6c, 0x75, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, - 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, - 0x67, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x36, 0x0a, 0x04, 0x50, 0x6f, 0x6c, 0x6c, 0x12, 0x13, - 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x1a, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x42, 0x08, - 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var file_services_plugin_service_proto_goTypes = []any{ - (*PluginRequest)(nil), // 0: grpc.PluginRequest - (*StreamMessage)(nil), // 1: grpc.StreamMessage - (*Response)(nil), // 2: grpc.Response -} -var file_services_plugin_service_proto_depIdxs = []int32{ - 0, // 0: grpc.PluginService.Register:input_type -> grpc.PluginRequest - 0, // 1: grpc.PluginService.Subscribe:input_type -> grpc.PluginRequest - 1, // 2: grpc.PluginService.Poll:input_type -> grpc.StreamMessage - 2, // 3: grpc.PluginService.Register:output_type -> grpc.Response - 1, // 4: grpc.PluginService.Subscribe:output_type -> grpc.StreamMessage - 1, // 5: grpc.PluginService.Poll:output_type -> grpc.StreamMessage - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_services_plugin_service_proto_init() } -func file_services_plugin_service_proto_init() { - if File_services_plugin_service_proto != nil { - return - } - file_entity_plugin_request_proto_init() - file_entity_response_proto_init() - file_entity_stream_message_proto_init() - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_services_plugin_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 0, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_services_plugin_service_proto_goTypes, - DependencyIndexes: file_services_plugin_service_proto_depIdxs, - }.Build() - File_services_plugin_service_proto = out.File - file_services_plugin_service_proto_rawDesc = nil - file_services_plugin_service_proto_goTypes = nil - file_services_plugin_service_proto_depIdxs = nil -} diff --git a/grpc/plugin_service_grpc.pb.go b/grpc/plugin_service_grpc.pb.go deleted file mode 100644 index 45f021f3..00000000 --- a/grpc/plugin_service_grpc.pb.go +++ /dev/null @@ -1,246 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.4.0 -// - protoc v5.27.2 -// source: services/plugin_service.proto - -package grpc - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 - -const ( - PluginService_Register_FullMethodName = "/grpc.PluginService/Register" - PluginService_Subscribe_FullMethodName = "/grpc.PluginService/Subscribe" - PluginService_Poll_FullMethodName = "/grpc.PluginService/Poll" -) - -// PluginServiceClient is the client API for PluginService 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 PluginServiceClient interface { - Register(ctx context.Context, in *PluginRequest, opts ...grpc.CallOption) (*Response, error) - Subscribe(ctx context.Context, in *PluginRequest, opts ...grpc.CallOption) (PluginService_SubscribeClient, error) - Poll(ctx context.Context, opts ...grpc.CallOption) (PluginService_PollClient, error) -} - -type pluginServiceClient struct { - cc grpc.ClientConnInterface -} - -func NewPluginServiceClient(cc grpc.ClientConnInterface) PluginServiceClient { - return &pluginServiceClient{cc} -} - -func (c *pluginServiceClient) Register(ctx context.Context, in *PluginRequest, opts ...grpc.CallOption) (*Response, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, PluginService_Register_FullMethodName, in, out, cOpts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *pluginServiceClient) Subscribe(ctx context.Context, in *PluginRequest, opts ...grpc.CallOption) (PluginService_SubscribeClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &PluginService_ServiceDesc.Streams[0], PluginService_Subscribe_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &pluginServiceSubscribeClient{ClientStream: 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 PluginService_SubscribeClient interface { - Recv() (*StreamMessage, error) - grpc.ClientStream -} - -type pluginServiceSubscribeClient struct { - grpc.ClientStream -} - -func (x *pluginServiceSubscribeClient) Recv() (*StreamMessage, error) { - m := new(StreamMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -func (c *pluginServiceClient) Poll(ctx context.Context, opts ...grpc.CallOption) (PluginService_PollClient, error) { - cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - stream, err := c.cc.NewStream(ctx, &PluginService_ServiceDesc.Streams[1], PluginService_Poll_FullMethodName, cOpts...) - if err != nil { - return nil, err - } - x := &pluginServicePollClient{ClientStream: stream} - return x, nil -} - -type PluginService_PollClient interface { - Send(*StreamMessage) error - Recv() (*StreamMessage, error) - grpc.ClientStream -} - -type pluginServicePollClient struct { - grpc.ClientStream -} - -func (x *pluginServicePollClient) Send(m *StreamMessage) error { - return x.ClientStream.SendMsg(m) -} - -func (x *pluginServicePollClient) Recv() (*StreamMessage, error) { - m := new(StreamMessage) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// PluginServiceServer is the server API for PluginService service. -// All implementations must embed UnimplementedPluginServiceServer -// for forward compatibility -type PluginServiceServer interface { - Register(context.Context, *PluginRequest) (*Response, error) - Subscribe(*PluginRequest, PluginService_SubscribeServer) error - Poll(PluginService_PollServer) error - mustEmbedUnimplementedPluginServiceServer() -} - -// UnimplementedPluginServiceServer must be embedded to have forward compatible implementations. -type UnimplementedPluginServiceServer struct { -} - -func (UnimplementedPluginServiceServer) Register(context.Context, *PluginRequest) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Register not implemented") -} -func (UnimplementedPluginServiceServer) Subscribe(*PluginRequest, PluginService_SubscribeServer) error { - return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") -} -func (UnimplementedPluginServiceServer) Poll(PluginService_PollServer) error { - return status.Errorf(codes.Unimplemented, "method Poll not implemented") -} -func (UnimplementedPluginServiceServer) mustEmbedUnimplementedPluginServiceServer() {} - -// UnsafePluginServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to PluginServiceServer will -// result in compilation errors. -type UnsafePluginServiceServer interface { - mustEmbedUnimplementedPluginServiceServer() -} - -func RegisterPluginServiceServer(s grpc.ServiceRegistrar, srv PluginServiceServer) { - s.RegisterService(&PluginService_ServiceDesc, srv) -} - -func _PluginService_Register_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(PluginRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(PluginServiceServer).Register(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: PluginService_Register_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(PluginServiceServer).Register(ctx, req.(*PluginRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _PluginService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { - m := new(PluginRequest) - if err := stream.RecvMsg(m); err != nil { - return err - } - return srv.(PluginServiceServer).Subscribe(m, &pluginServiceSubscribeServer{ServerStream: stream}) -} - -type PluginService_SubscribeServer interface { - Send(*StreamMessage) error - grpc.ServerStream -} - -type pluginServiceSubscribeServer struct { - grpc.ServerStream -} - -func (x *pluginServiceSubscribeServer) Send(m *StreamMessage) error { - return x.ServerStream.SendMsg(m) -} - -func _PluginService_Poll_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(PluginServiceServer).Poll(&pluginServicePollServer{ServerStream: stream}) -} - -type PluginService_PollServer interface { - Send(*StreamMessage) error - Recv() (*StreamMessage, error) - grpc.ServerStream -} - -type pluginServicePollServer struct { - grpc.ServerStream -} - -func (x *pluginServicePollServer) Send(m *StreamMessage) error { - return x.ServerStream.SendMsg(m) -} - -func (x *pluginServicePollServer) Recv() (*StreamMessage, error) { - m := new(StreamMessage) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// PluginService_ServiceDesc is the grpc.ServiceDesc for PluginService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var PluginService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.PluginService", - HandlerType: (*PluginServiceServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Register", - Handler: _PluginService_Register_Handler, - }, - }, - Streams: []grpc.StreamDesc{ - { - StreamName: "Subscribe", - Handler: _PluginService_Subscribe_Handler, - ServerStreams: true, - }, - { - StreamName: "Poll", - Handler: _PluginService_Poll_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "services/plugin_service.proto", -} diff --git a/grpc/proto/entity/node_info.proto b/grpc/proto/entity/node_info.proto deleted file mode 100644 index e289d29d..00000000 --- a/grpc/proto/entity/node_info.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message NodeInfo { - string key = 1; - bool is_master = 2; -} diff --git a/grpc/proto/entity/plugin_request.proto b/grpc/proto/entity/plugin_request.proto deleted file mode 100644 index 9359028e..00000000 --- a/grpc/proto/entity/plugin_request.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message PluginRequest { - string name = 1; - string node_key = 2; - bytes data = 3; -} diff --git a/grpc/proto/entity/request.proto b/grpc/proto/entity/request.proto deleted file mode 100644 index 78b88e7d..00000000 --- a/grpc/proto/entity/request.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message Request { - string node_key = 1; - bytes data = 2; -} diff --git a/grpc/proto/entity/response.proto b/grpc/proto/entity/response.proto index 9145a1b0..8a766460 100644 --- a/grpc/proto/entity/response.proto +++ b/grpc/proto/entity/response.proto @@ -1,10 +1,13 @@ syntax = "proto3"; -import "entity/response_code.proto"; - package grpc; option go_package = ".;grpc"; +enum ResponseCode { + OK = 0; + ERROR = 1; +} + message Response { ResponseCode code = 1; string message = 2; diff --git a/grpc/proto/entity/response_code.proto b/grpc/proto/entity/response_code.proto deleted file mode 100644 index cb7398fc..00000000 --- a/grpc/proto/entity/response_code.proto +++ /dev/null @@ -1,8 +0,0 @@ -syntax = "proto3"; - -option go_package = ".;grpc"; - -enum ResponseCode { - OK = 0; - ERROR = 1; -} \ No newline at end of file diff --git a/grpc/proto/entity/stream_message.proto b/grpc/proto/entity/stream_message.proto deleted file mode 100644 index 44cd7af4..00000000 --- a/grpc/proto/entity/stream_message.proto +++ /dev/null @@ -1,16 +0,0 @@ -syntax = "proto3"; - -import "entity/stream_message_code.proto"; - -package grpc; -option go_package = ".;grpc"; - -message StreamMessage { - StreamMessageCode code = 1; - string node_key = 2; - string key = 3; - string from = 4; - string to = 5; - bytes data = 6; - string error = 7; -} diff --git a/grpc/proto/entity/stream_message_code.proto b/grpc/proto/entity/stream_message_code.proto deleted file mode 100644 index f2c41882..00000000 --- a/grpc/proto/entity/stream_message_code.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -enum StreamMessageCode { - // ping worker nodes to check their health - PING = 0; - // ask worker node(s) to run task with given id - RUN_TASK = 1; - // ask worker node(s) to cancel task with given id - CANCEL_TASK = 2; - // insert data - INSERT_DATA = 3; - // insert logs - INSERT_LOGS = 4; - // send event - SEND_EVENT = 5; - // install plugin - INSTALL_PLUGIN = 6; - // uninstall plugin - UNINSTALL_PLUGIN = 7; - // start plugin - START_PLUGIN = 8; - // stop plugin - STOP_PLUGIN = 9; - // connect - CONNECT = 10; - // disconnect - DISCONNECT = 11; - // send - SEND = 12; -} diff --git a/grpc/proto/entity/stream_message_data_task.proto b/grpc/proto/entity/stream_message_data_task.proto deleted file mode 100644 index b6c082d9..00000000 --- a/grpc/proto/entity/stream_message_data_task.proto +++ /dev/null @@ -1,9 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message StreamMessageDataTask { - string task_id = 1; - string data = 2; -} diff --git a/grpc/proto/models/node.proto b/grpc/proto/models/node.proto deleted file mode 100644 index aa5312cc..00000000 --- a/grpc/proto/models/node.proto +++ /dev/null @@ -1,19 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message Node { - string _id = 1; - string name = 2; - string ip = 3; - string port = 5; - string mac = 6; - string hostname = 7; - string description = 8; - string key = 9; - bool is_master = 11; - string update_ts = 12; - string create_ts = 13; - int64 update_ts_unix = 14; -} diff --git a/grpc/proto/models/task.proto b/grpc/proto/models/task.proto deleted file mode 100644 index 52ea7056..00000000 --- a/grpc/proto/models/task.proto +++ /dev/null @@ -1,18 +0,0 @@ -syntax = "proto3"; - -package grpc; -option go_package = ".;grpc"; - -message Task { - string _id = 1; - string spider_id = 2; - string status = 5; - string node_id = 6; - string cmd = 8; - string param = 9; - string error = 10; - int32 pid = 16; - string run_type = 17; - string schedule_id = 18; - string type = 19; -} \ No newline at end of file diff --git a/grpc/proto/services/dependencies_service_v2.proto b/grpc/proto/services/dependencies_service_v2.proto deleted file mode 100644 index 6f4e0578..00000000 --- a/grpc/proto/services/dependencies_service_v2.proto +++ /dev/null @@ -1,46 +0,0 @@ -syntax = "proto3"; - -import "entity/response.proto"; - -package grpc; -option go_package = ".;grpc"; - -message Dependency { - string name = 1; - string version = 2; -} - -message DependenciesServiceV2ConnectRequest { - string node_key = 1; -} - -enum DependenciesServiceV2Code { - SYNC = 0; - INSTALL = 1; - UNINSTALL = 2; -} - -message DependenciesServiceV2ConnectResponse { - DependenciesServiceV2Code code = 1; - string task_id = 2; - string lang = 3; - string proxy = 4; - repeated Dependency dependencies = 5; -} - -message DependenciesServiceV2SyncRequest { - string node_key = 1; - string lang = 2; - repeated Dependency dependencies = 3; -} - -message DependenciesServiceV2UpdateTaskLogRequest { - string task_id = 1; - repeated string log_lines = 2; -} - -service DependenciesServiceV2 { - rpc Connect(DependenciesServiceV2ConnectRequest) returns (stream DependenciesServiceV2ConnectResponse){}; - rpc Sync(DependenciesServiceV2SyncRequest) returns (Response){}; - rpc UpdateTaskLog(stream DependenciesServiceV2UpdateTaskLogRequest) returns (Response){}; -} diff --git a/grpc/proto/services/dependency_service_v2.proto b/grpc/proto/services/dependency_service_v2.proto new file mode 100644 index 00000000..6978beb9 --- /dev/null +++ b/grpc/proto/services/dependency_service_v2.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; + +import "entity/response.proto"; + +package grpc; +option go_package = ".;grpc"; + +message Dependency { + string name = 1; + string version = 2; +} + +message DependencyServiceV2ConnectRequest { + string node_key = 1; +} + +enum DependencyServiceV2Code { + SYNC = 0; + INSTALL = 1; + UNINSTALL = 2; +} + +message DependencyServiceV2ConnectResponse { + DependencyServiceV2Code code = 1; + string task_id = 2; + string lang = 3; + string proxy = 4; + repeated Dependency dependencies = 5; +} + +message DependencyServiceV2SyncRequest { + string node_key = 1; + string lang = 2; + repeated Dependency dependencies = 3; +} + +message DependencyServiceV2UpdateTaskLogRequest { + string task_id = 1; + repeated string log_lines = 2; +} + +service DependencyServiceV2 { + rpc Connect(DependencyServiceV2ConnectRequest) returns (stream DependencyServiceV2ConnectResponse){}; + rpc Sync(DependencyServiceV2SyncRequest) returns (Response){}; + rpc UpdateTaskLog(stream DependencyServiceV2UpdateTaskLogRequest) returns (Response){}; +} diff --git a/grpc/proto/services/message_service.proto b/grpc/proto/services/message_service.proto deleted file mode 100644 index 41207403..00000000 --- a/grpc/proto/services/message_service.proto +++ /dev/null @@ -1,10 +0,0 @@ -syntax = "proto3"; - -import "entity/stream_message.proto"; - -package grpc; -option go_package = ".;grpc"; - -service MessageService { - rpc Connect(stream StreamMessage) returns (stream StreamMessage){}; -} diff --git a/grpc/proto/services/metrics_service_v2.proto b/grpc/proto/services/metric_service_v2.proto similarity index 81% rename from grpc/proto/services/metrics_service_v2.proto rename to grpc/proto/services/metric_service_v2.proto index 6ed7ac25..2e47a2d6 100644 --- a/grpc/proto/services/metrics_service_v2.proto +++ b/grpc/proto/services/metric_service_v2.proto @@ -5,7 +5,7 @@ import "entity/response.proto"; package grpc; option go_package = ".;grpc"; -message MetricsServiceV2SendRequest { +message MetricServiceV2SendRequest { string type = 1; string node_key = 2; int64 timestamp = 3; @@ -24,6 +24,6 @@ message MetricsServiceV2SendRequest { float network_bytes_recv_rate = 18; } -service MetricsServiceV2 { - rpc Send(MetricsServiceV2SendRequest) returns (Response){}; +service MetricServiceV2 { + rpc Send(MetricServiceV2SendRequest) returns (Response){}; } diff --git a/grpc/proto/services/model_delegate.proto b/grpc/proto/services/model_delegate.proto deleted file mode 100644 index 1b60477c..00000000 --- a/grpc/proto/services/model_delegate.proto +++ /dev/null @@ -1,11 +0,0 @@ -syntax = "proto3"; - -import "entity/request.proto"; -import "entity/response.proto"; - -package grpc; -option go_package = ".;grpc"; - -service ModelDelegate { - rpc Do(Request) returns (Response){}; -} diff --git a/grpc/proto/services/node_service.proto b/grpc/proto/services/node_service.proto index 6b1f23f9..1e1fd3e7 100644 --- a/grpc/proto/services/node_service.proto +++ b/grpc/proto/services/node_service.proto @@ -1,26 +1,34 @@ syntax = "proto3"; -import "entity/request.proto"; import "entity/response.proto"; -import "entity/stream_message.proto"; package grpc; option go_package = ".;grpc"; message NodeServiceRegisterRequest { - string key = 1; - string name = 2; - bool isMaster = 3; - string authKey = 4; - int32 maxRunners = 5; + string node_key = 1; + string node_name = 2; + int32 max_runners = 3; } + message NodeServiceSendHeartbeatRequest { - string key = 1; + string node_key = 1; +} + +message NodeServiceSubscribeRequest { + string node_key = 1; +} + +enum NodeServiceSubscribeCode { + PING = 0; +} + +message NodeServiceSubscribeResponse { + NodeServiceSubscribeCode code = 1; } service NodeService { rpc Register(NodeServiceRegisterRequest) returns (Response){}; rpc SendHeartbeat(NodeServiceSendHeartbeatRequest) returns (Response){}; - rpc Subscribe(Request) returns (stream StreamMessage){}; - rpc Unsubscribe(Request) returns (Response){}; + rpc Subscribe(NodeServiceSubscribeRequest) returns (stream NodeServiceSubscribeResponse){}; } diff --git a/grpc/proto/services/task_scheduler_service.proto b/grpc/proto/services/task_scheduler_service.proto deleted file mode 100644 index 3f12edbf..00000000 --- a/grpc/proto/services/task_scheduler_service.proto +++ /dev/null @@ -1,41 +0,0 @@ -syntax = "proto3"; - -import "entity/request.proto"; -import "entity/response.proto"; -import "entity/stream_message.proto"; - -package grpc; -option go_package = ".;grpc"; - -message TaskSchedulerServiceConnectRequest { - string node_key = 1; -} - -enum TaskSchedulerServiceCode { - CANCEL = 0; -} - -message TaskSchedulerServiceConnectResponse { - TaskSchedulerServiceCode code = 1; - string task_id = 2; - bool force = 3; -} - -message TaskSchedulerServiceFetchTaskRequest { - string node_key = 1; -} - -message TaskSchedulerServiceFetchTaskResponse { - string task_id = 2; -} - -message TaskServiceSendNotificationRequest { - string node_key = 1; - string task_id = 2; -} - -service TaskSchedulerService { - rpc Connect(stream TaskSchedulerServiceConnectRequest) returns (TaskSchedulerServiceConnectResponse){}; - rpc FetchTask(TaskSchedulerServiceFetchTaskRequest) returns (TaskSchedulerServiceFetchTaskResponse){}; - rpc SendNotification(TaskServiceSendNotificationRequest) returns (Response){}; -} diff --git a/grpc/proto/services/task_service.proto b/grpc/proto/services/task_service.proto new file mode 100644 index 00000000..ed7efde1 --- /dev/null +++ b/grpc/proto/services/task_service.proto @@ -0,0 +1,51 @@ +syntax = "proto3"; + +import "entity/response.proto"; + +package grpc; +option go_package = ".;grpc"; + +message TaskServiceSubscribeRequest { + string task_id = 1; +} + +enum TaskServiceSubscribeCode { + CANCEL = 0; +} + +message TaskServiceSubscribeResponse { + TaskServiceSubscribeCode code = 1; + string task_id = 2; + bool force = 3; +} + +enum TaskServiceConnectCode { + INSERT_DATA = 0; + INSERT_LOGS = 1; +} + +message TaskServiceConnectRequest { + TaskServiceConnectCode code = 1; + string task_id = 2; + bytes data = 3; +} + +message TaskServiceFetchTaskRequest { + string node_key = 1; +} + +message TaskServiceFetchTaskResponse { + string task_id = 2; +} + +message TaskServiceSendNotificationRequest { + string node_key = 1; + string task_id = 2; +} + +service TaskService { + rpc Subscribe(TaskServiceSubscribeRequest) returns (stream TaskServiceSubscribeResponse){}; + rpc Connect(stream TaskServiceConnectRequest) returns (Response){}; + rpc FetchTask(TaskServiceFetchTaskRequest) returns (TaskServiceFetchTaskResponse){}; + rpc SendNotification(TaskServiceSendNotificationRequest) returns (Response){}; +} diff --git a/grpc/request.pb.go b/grpc/request.pb.go deleted file mode 100644 index 1dc5d262..00000000 --- a/grpc/request.pb.go +++ /dev/null @@ -1,151 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/request.proto - -package grpc - -import ( - 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) -) - -type Request 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"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *Request) Reset() { - *x = Request{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_request_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Request) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Request) ProtoMessage() {} - -func (x *Request) ProtoReflect() protoreflect.Message { - mi := &file_entity_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 Request.ProtoReflect.Descriptor instead. -func (*Request) Descriptor() ([]byte, []int) { - return file_entity_request_proto_rawDescGZIP(), []int{0} -} - -func (x *Request) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *Request) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -var File_entity_request_proto protoreflect.FileDescriptor - -var file_entity_request_proto_rawDesc = []byte{ - 0x0a, 0x14, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x38, 0x0a, 0x07, - 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, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, - 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_request_proto_rawDescOnce sync.Once - file_entity_request_proto_rawDescData = file_entity_request_proto_rawDesc -) - -func file_entity_request_proto_rawDescGZIP() []byte { - file_entity_request_proto_rawDescOnce.Do(func() { - file_entity_request_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_request_proto_rawDescData) - }) - return file_entity_request_proto_rawDescData -} - -var file_entity_request_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_entity_request_proto_goTypes = []any{ - (*Request)(nil), // 0: grpc.Request -} -var file_entity_request_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_request_proto_init() } -func file_entity_request_proto_init() { - if File_entity_request_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_entity_request_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Request); 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_request_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_request_proto_goTypes, - DependencyIndexes: file_entity_request_proto_depIdxs, - MessageInfos: file_entity_request_proto_msgTypes, - }.Build() - File_entity_request_proto = out.File - file_entity_request_proto_rawDesc = nil - file_entity_request_proto_goTypes = nil - file_entity_request_proto_depIdxs = nil -} diff --git a/grpc/response.pb.go b/grpc/response.pb.go index 88908a72..435e17c7 100644 --- a/grpc/response.pb.go +++ b/grpc/response.pb.go @@ -20,12 +20,58 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type ResponseCode int32 + +const ( + ResponseCode_OK ResponseCode = 0 + ResponseCode_ERROR ResponseCode = 1 +) + +// Enum value maps for ResponseCode. +var ( + ResponseCode_name = map[int32]string{ + 0: "OK", + 1: "ERROR", + } + ResponseCode_value = map[string]int32{ + "OK": 0, + "ERROR": 1, + } +) + +func (x ResponseCode) Enum() *ResponseCode { + p := new(ResponseCode) + *p = x + return p +} + +func (x ResponseCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (ResponseCode) Descriptor() protoreflect.EnumDescriptor { + return file_entity_response_proto_enumTypes[0].Descriptor() +} + +func (ResponseCode) Type() protoreflect.EnumType { + return &file_entity_response_proto_enumTypes[0] +} + +func (x ResponseCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use ResponseCode.Descriptor instead. +func (ResponseCode) EnumDescriptor() ([]byte, []int) { + return file_entity_response_proto_rawDescGZIP(), []int{0} +} + type Response struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Code ResponseCode `protobuf:"varint,1,opt,name=code,proto3,enum=ResponseCode" json:"code,omitempty"` + Code ResponseCode `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.ResponseCode" json:"code,omitempty"` Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` Error string `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"` @@ -103,19 +149,20 @@ var File_entity_response_proto protoreflect.FileDescriptor var file_entity_response_proto_rawDesc = []byte{ 0x0a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x1a, 0x1a, 0x65, - 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x5f, 0x63, - 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x01, 0x0a, 0x08, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0d, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, - 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, - 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, - 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, - 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x8c, 0x01, + 0x0a, 0x08, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x12, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, 0x63, 0x6f, + 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, + 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x2a, 0x21, 0x0a, 0x0c, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, + 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x42, + 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x33, } var ( @@ -130,13 +177,14 @@ func file_entity_response_proto_rawDescGZIP() []byte { return file_entity_response_proto_rawDescData } +var file_entity_response_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_entity_response_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_entity_response_proto_goTypes = []any{ - (*Response)(nil), // 0: grpc.Response - (ResponseCode)(0), // 1: ResponseCode + (ResponseCode)(0), // 0: grpc.ResponseCode + (*Response)(nil), // 1: grpc.Response } var file_entity_response_proto_depIdxs = []int32{ - 1, // 0: grpc.Response.code:type_name -> ResponseCode + 0, // 0: grpc.Response.code:type_name -> grpc.ResponseCode 1, // [1:1] is the sub-list for method output_type 1, // [1:1] is the sub-list for method input_type 1, // [1:1] is the sub-list for extension type_name @@ -149,7 +197,6 @@ func file_entity_response_proto_init() { if File_entity_response_proto != nil { return } - file_entity_response_code_proto_init() if !protoimpl.UnsafeEnabled { file_entity_response_proto_msgTypes[0].Exporter = func(v any, i int) any { switch v := v.(*Response); i { @@ -169,13 +216,14 @@ func file_entity_response_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_entity_response_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 1, NumExtensions: 0, NumServices: 0, }, GoTypes: file_entity_response_proto_goTypes, DependencyIndexes: file_entity_response_proto_depIdxs, + EnumInfos: file_entity_response_proto_enumTypes, MessageInfos: file_entity_response_proto_msgTypes, }.Build() File_entity_response_proto = out.File diff --git a/grpc/response_code.pb.go b/grpc/response_code.pb.go deleted file mode 100644 index 60b05167..00000000 --- a/grpc/response_code.pb.go +++ /dev/null @@ -1,127 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/response_code.proto - -package grpc - -import ( - 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) -) - -type ResponseCode int32 - -const ( - ResponseCode_OK ResponseCode = 0 - ResponseCode_ERROR ResponseCode = 1 -) - -// Enum value maps for ResponseCode. -var ( - ResponseCode_name = map[int32]string{ - 0: "OK", - 1: "ERROR", - } - ResponseCode_value = map[string]int32{ - "OK": 0, - "ERROR": 1, - } -) - -func (x ResponseCode) Enum() *ResponseCode { - p := new(ResponseCode) - *p = x - return p -} - -func (x ResponseCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (ResponseCode) Descriptor() protoreflect.EnumDescriptor { - return file_entity_response_code_proto_enumTypes[0].Descriptor() -} - -func (ResponseCode) Type() protoreflect.EnumType { - return &file_entity_response_code_proto_enumTypes[0] -} - -func (x ResponseCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use ResponseCode.Descriptor instead. -func (ResponseCode) EnumDescriptor() ([]byte, []int) { - return file_entity_response_code_proto_rawDescGZIP(), []int{0} -} - -var File_entity_response_code_proto protoreflect.FileDescriptor - -var file_entity_response_code_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2a, 0x21, 0x0a, 0x0c, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x06, 0x0a, 0x02, - 0x4f, 0x4b, 0x10, 0x00, 0x12, 0x09, 0x0a, 0x05, 0x45, 0x52, 0x52, 0x4f, 0x52, 0x10, 0x01, 0x42, - 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_entity_response_code_proto_rawDescOnce sync.Once - file_entity_response_code_proto_rawDescData = file_entity_response_code_proto_rawDesc -) - -func file_entity_response_code_proto_rawDescGZIP() []byte { - file_entity_response_code_proto_rawDescOnce.Do(func() { - file_entity_response_code_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_response_code_proto_rawDescData) - }) - return file_entity_response_code_proto_rawDescData -} - -var file_entity_response_code_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_entity_response_code_proto_goTypes = []any{ - (ResponseCode)(0), // 0: ResponseCode -} -var file_entity_response_code_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_response_code_proto_init() } -func file_entity_response_code_proto_init() { - if File_entity_response_code_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_entity_response_code_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_response_code_proto_goTypes, - DependencyIndexes: file_entity_response_code_proto_depIdxs, - EnumInfos: file_entity_response_code_proto_enumTypes, - }.Build() - File_entity_response_code_proto = out.File - file_entity_response_code_proto_rawDesc = nil - file_entity_response_code_proto_goTypes = nil - file_entity_response_code_proto_depIdxs = nil -} diff --git a/grpc/stream_message.pb.go b/grpc/stream_message.pb.go deleted file mode 100644 index a1158803..00000000 --- a/grpc/stream_message.pb.go +++ /dev/null @@ -1,205 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/stream_message.proto - -package grpc - -import ( - 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) -) - -type StreamMessage struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Code StreamMessageCode `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.StreamMessageCode" json:"code,omitempty"` - NodeKey string `protobuf:"bytes,2,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"` - Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` - From string `protobuf:"bytes,4,opt,name=from,proto3" json:"from,omitempty"` - To string `protobuf:"bytes,5,opt,name=to,proto3" json:"to,omitempty"` - Data []byte `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"` - Error string `protobuf:"bytes,7,opt,name=error,proto3" json:"error,omitempty"` -} - -func (x *StreamMessage) Reset() { - *x = StreamMessage{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_stream_message_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamMessage) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamMessage) ProtoMessage() {} - -func (x *StreamMessage) ProtoReflect() protoreflect.Message { - mi := &file_entity_stream_message_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 StreamMessage.ProtoReflect.Descriptor instead. -func (*StreamMessage) Descriptor() ([]byte, []int) { - return file_entity_stream_message_proto_rawDescGZIP(), []int{0} -} - -func (x *StreamMessage) GetCode() StreamMessageCode { - if x != nil { - return x.Code - } - return StreamMessageCode_PING -} - -func (x *StreamMessage) GetNodeKey() string { - if x != nil { - return x.NodeKey - } - return "" -} - -func (x *StreamMessage) GetKey() string { - if x != nil { - return x.Key - } - return "" -} - -func (x *StreamMessage) GetFrom() string { - if x != nil { - return x.From - } - return "" -} - -func (x *StreamMessage) GetTo() string { - if x != nil { - return x.To - } - return "" -} - -func (x *StreamMessage) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *StreamMessage) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -var File_entity_stream_message_proto protoreflect.FileDescriptor - -var file_entity_stream_message_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, - 0x72, 0x70, 0x63, 0x1a, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x2e, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xb7, 0x01, 0x0a, 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, - 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x12, 0x2b, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x52, 0x04, - 0x63, 0x6f, 0x64, 0x65, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65, 0x5f, 0x6b, 0x65, 0x79, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65, 0x4b, 0x65, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x12, 0x0a, 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x66, 0x72, 0x6f, 0x6d, 0x12, 0x0e, 0x0a, 0x02, 0x74, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x02, 0x74, 0x6f, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x42, - 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_entity_stream_message_proto_rawDescOnce sync.Once - file_entity_stream_message_proto_rawDescData = file_entity_stream_message_proto_rawDesc -) - -func file_entity_stream_message_proto_rawDescGZIP() []byte { - file_entity_stream_message_proto_rawDescOnce.Do(func() { - file_entity_stream_message_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_stream_message_proto_rawDescData) - }) - return file_entity_stream_message_proto_rawDescData -} - -var file_entity_stream_message_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_entity_stream_message_proto_goTypes = []any{ - (*StreamMessage)(nil), // 0: grpc.StreamMessage - (StreamMessageCode)(0), // 1: grpc.StreamMessageCode -} -var file_entity_stream_message_proto_depIdxs = []int32{ - 1, // 0: grpc.StreamMessage.code:type_name -> grpc.StreamMessageCode - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name -} - -func init() { file_entity_stream_message_proto_init() } -func file_entity_stream_message_proto_init() { - if File_entity_stream_message_proto != nil { - return - } - file_entity_stream_message_code_proto_init() - if !protoimpl.UnsafeEnabled { - file_entity_stream_message_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*StreamMessage); 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_stream_message_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_stream_message_proto_goTypes, - DependencyIndexes: file_entity_stream_message_proto_depIdxs, - MessageInfos: file_entity_stream_message_proto_msgTypes, - }.Build() - File_entity_stream_message_proto = out.File - file_entity_stream_message_proto_rawDesc = nil - file_entity_stream_message_proto_goTypes = nil - file_entity_stream_message_proto_depIdxs = nil -} diff --git a/grpc/stream_message_code.pb.go b/grpc/stream_message_code.pb.go deleted file mode 100644 index a961e58c..00000000 --- a/grpc/stream_message_code.pb.go +++ /dev/null @@ -1,185 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/stream_message_code.proto - -package grpc - -import ( - 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) -) - -type StreamMessageCode int32 - -const ( - // ping worker nodes to check their health - StreamMessageCode_PING StreamMessageCode = 0 - // ask worker node(s) to run task with given id - StreamMessageCode_RUN_TASK StreamMessageCode = 1 - // ask worker node(s) to cancel task with given id - StreamMessageCode_CANCEL_TASK StreamMessageCode = 2 - // insert data - StreamMessageCode_INSERT_DATA StreamMessageCode = 3 - // insert logs - StreamMessageCode_INSERT_LOGS StreamMessageCode = 4 - // send event - StreamMessageCode_SEND_EVENT StreamMessageCode = 5 - // install plugin - StreamMessageCode_INSTALL_PLUGIN StreamMessageCode = 6 - // uninstall plugin - StreamMessageCode_UNINSTALL_PLUGIN StreamMessageCode = 7 - // start plugin - StreamMessageCode_START_PLUGIN StreamMessageCode = 8 - // stop plugin - StreamMessageCode_STOP_PLUGIN StreamMessageCode = 9 - // connect - StreamMessageCode_CONNECT StreamMessageCode = 10 - // disconnect - StreamMessageCode_DISCONNECT StreamMessageCode = 11 - // send - StreamMessageCode_SEND StreamMessageCode = 12 -) - -// Enum value maps for StreamMessageCode. -var ( - StreamMessageCode_name = map[int32]string{ - 0: "PING", - 1: "RUN_TASK", - 2: "CANCEL_TASK", - 3: "INSERT_DATA", - 4: "INSERT_LOGS", - 5: "SEND_EVENT", - 6: "INSTALL_PLUGIN", - 7: "UNINSTALL_PLUGIN", - 8: "START_PLUGIN", - 9: "STOP_PLUGIN", - 10: "CONNECT", - 11: "DISCONNECT", - 12: "SEND", - } - StreamMessageCode_value = map[string]int32{ - "PING": 0, - "RUN_TASK": 1, - "CANCEL_TASK": 2, - "INSERT_DATA": 3, - "INSERT_LOGS": 4, - "SEND_EVENT": 5, - "INSTALL_PLUGIN": 6, - "UNINSTALL_PLUGIN": 7, - "START_PLUGIN": 8, - "STOP_PLUGIN": 9, - "CONNECT": 10, - "DISCONNECT": 11, - "SEND": 12, - } -) - -func (x StreamMessageCode) Enum() *StreamMessageCode { - p := new(StreamMessageCode) - *p = x - return p -} - -func (x StreamMessageCode) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (StreamMessageCode) Descriptor() protoreflect.EnumDescriptor { - return file_entity_stream_message_code_proto_enumTypes[0].Descriptor() -} - -func (StreamMessageCode) Type() protoreflect.EnumType { - return &file_entity_stream_message_code_proto_enumTypes[0] -} - -func (x StreamMessageCode) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use StreamMessageCode.Descriptor instead. -func (StreamMessageCode) EnumDescriptor() ([]byte, []int) { - return file_entity_stream_message_code_proto_rawDescGZIP(), []int{0} -} - -var File_entity_stream_message_code_proto protoreflect.FileDescriptor - -var file_entity_stream_message_code_proto_rawDesc = []byte{ - 0x0a, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x2a, 0xe2, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x72, - 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, - 0x0a, 0x04, 0x50, 0x49, 0x4e, 0x47, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x52, 0x55, 0x4e, 0x5f, - 0x54, 0x41, 0x53, 0x4b, 0x10, 0x01, 0x12, 0x0f, 0x0a, 0x0b, 0x43, 0x41, 0x4e, 0x43, 0x45, 0x4c, - 0x5f, 0x54, 0x41, 0x53, 0x4b, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x53, 0x45, 0x52, - 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, 0x10, 0x03, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x53, 0x45, - 0x52, 0x54, 0x5f, 0x4c, 0x4f, 0x47, 0x53, 0x10, 0x04, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x45, 0x4e, - 0x44, 0x5f, 0x45, 0x56, 0x45, 0x4e, 0x54, 0x10, 0x05, 0x12, 0x12, 0x0a, 0x0e, 0x49, 0x4e, 0x53, - 0x54, 0x41, 0x4c, 0x4c, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, 0x4e, 0x10, 0x06, 0x12, 0x14, 0x0a, - 0x10, 0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x5f, 0x50, 0x4c, 0x55, 0x47, 0x49, - 0x4e, 0x10, 0x07, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x41, 0x52, 0x54, 0x5f, 0x50, 0x4c, 0x55, - 0x47, 0x49, 0x4e, 0x10, 0x08, 0x12, 0x0f, 0x0a, 0x0b, 0x53, 0x54, 0x4f, 0x50, 0x5f, 0x50, 0x4c, - 0x55, 0x47, 0x49, 0x4e, 0x10, 0x09, 0x12, 0x0b, 0x0a, 0x07, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, - 0x54, 0x10, 0x0a, 0x12, 0x0e, 0x0a, 0x0a, 0x44, 0x49, 0x53, 0x43, 0x4f, 0x4e, 0x4e, 0x45, 0x43, - 0x54, 0x10, 0x0b, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x45, 0x4e, 0x44, 0x10, 0x0c, 0x42, 0x08, 0x5a, - 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_stream_message_code_proto_rawDescOnce sync.Once - file_entity_stream_message_code_proto_rawDescData = file_entity_stream_message_code_proto_rawDesc -) - -func file_entity_stream_message_code_proto_rawDescGZIP() []byte { - file_entity_stream_message_code_proto_rawDescOnce.Do(func() { - file_entity_stream_message_code_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_stream_message_code_proto_rawDescData) - }) - return file_entity_stream_message_code_proto_rawDescData -} - -var file_entity_stream_message_code_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_entity_stream_message_code_proto_goTypes = []any{ - (StreamMessageCode)(0), // 0: grpc.StreamMessageCode -} -var file_entity_stream_message_code_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_stream_message_code_proto_init() } -func file_entity_stream_message_code_proto_init() { - if File_entity_stream_message_code_proto != nil { - return - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_entity_stream_message_code_proto_rawDesc, - NumEnums: 1, - NumMessages: 0, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_stream_message_code_proto_goTypes, - DependencyIndexes: file_entity_stream_message_code_proto_depIdxs, - EnumInfos: file_entity_stream_message_code_proto_enumTypes, - }.Build() - File_entity_stream_message_code_proto = out.File - file_entity_stream_message_code_proto_rawDesc = nil - file_entity_stream_message_code_proto_goTypes = nil - file_entity_stream_message_code_proto_depIdxs = nil -} diff --git a/grpc/stream_message_data_task.pb.go b/grpc/stream_message_data_task.pb.go deleted file mode 100644 index 5533cb28..00000000 --- a/grpc/stream_message_data_task.pb.go +++ /dev/null @@ -1,153 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: entity/stream_message_data_task.proto - -package grpc - -import ( - 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) -) - -type StreamMessageDataTask 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"` - Data string `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` -} - -func (x *StreamMessageDataTask) Reset() { - *x = StreamMessageDataTask{} - if protoimpl.UnsafeEnabled { - mi := &file_entity_stream_message_data_task_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamMessageDataTask) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamMessageDataTask) ProtoMessage() {} - -func (x *StreamMessageDataTask) ProtoReflect() protoreflect.Message { - mi := &file_entity_stream_message_data_task_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 StreamMessageDataTask.ProtoReflect.Descriptor instead. -func (*StreamMessageDataTask) Descriptor() ([]byte, []int) { - return file_entity_stream_message_data_task_proto_rawDescGZIP(), []int{0} -} - -func (x *StreamMessageDataTask) GetTaskId() string { - if x != nil { - return x.TaskId - } - return "" -} - -func (x *StreamMessageDataTask) GetData() string { - if x != nil { - return x.Data - } - return "" -} - -var File_entity_stream_message_data_task_proto protoreflect.FileDescriptor - -var file_entity_stream_message_data_task_proto_rawDesc = []byte{ - 0x0a, 0x25, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x5f, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x74, 0x61, 0x73, - 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x44, 0x0a, - 0x15, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x44, 0x61, - 0x74, 0x61, 0x54, 0x61, 0x73, 0x6b, 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, - 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, - 0x61, 0x74, 0x61, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_entity_stream_message_data_task_proto_rawDescOnce sync.Once - file_entity_stream_message_data_task_proto_rawDescData = file_entity_stream_message_data_task_proto_rawDesc -) - -func file_entity_stream_message_data_task_proto_rawDescGZIP() []byte { - file_entity_stream_message_data_task_proto_rawDescOnce.Do(func() { - file_entity_stream_message_data_task_proto_rawDescData = protoimpl.X.CompressGZIP(file_entity_stream_message_data_task_proto_rawDescData) - }) - return file_entity_stream_message_data_task_proto_rawDescData -} - -var file_entity_stream_message_data_task_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_entity_stream_message_data_task_proto_goTypes = []any{ - (*StreamMessageDataTask)(nil), // 0: grpc.StreamMessageDataTask -} -var file_entity_stream_message_data_task_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_entity_stream_message_data_task_proto_init() } -func file_entity_stream_message_data_task_proto_init() { - if File_entity_stream_message_data_task_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_entity_stream_message_data_task_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*StreamMessageDataTask); 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_stream_message_data_task_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_entity_stream_message_data_task_proto_goTypes, - DependencyIndexes: file_entity_stream_message_data_task_proto_depIdxs, - MessageInfos: file_entity_stream_message_data_task_proto_msgTypes, - }.Build() - File_entity_stream_message_data_task_proto = out.File - file_entity_stream_message_data_task_proto_rawDesc = nil - file_entity_stream_message_data_task_proto_goTypes = nil - file_entity_stream_message_data_task_proto_depIdxs = nil -} diff --git a/grpc/task.pb.go b/grpc/task.pb.go deleted file mode 100644 index d15cfbf6..00000000 --- a/grpc/task.pb.go +++ /dev/null @@ -1,236 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.34.2 -// protoc v5.27.2 -// source: models/task.proto - -package grpc - -import ( - 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) -) - -type Task struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - XId string `protobuf:"bytes,1,opt,name=_id,json=Id,proto3" json:"_id,omitempty"` - SpiderId string `protobuf:"bytes,2,opt,name=spider_id,json=spiderId,proto3" json:"spider_id,omitempty"` - Status string `protobuf:"bytes,5,opt,name=status,proto3" json:"status,omitempty"` - NodeId string `protobuf:"bytes,6,opt,name=node_id,json=nodeId,proto3" json:"node_id,omitempty"` - Cmd string `protobuf:"bytes,8,opt,name=cmd,proto3" json:"cmd,omitempty"` - Param string `protobuf:"bytes,9,opt,name=param,proto3" json:"param,omitempty"` - Error string `protobuf:"bytes,10,opt,name=error,proto3" json:"error,omitempty"` - Pid int32 `protobuf:"varint,16,opt,name=pid,proto3" json:"pid,omitempty"` - RunType string `protobuf:"bytes,17,opt,name=run_type,json=runType,proto3" json:"run_type,omitempty"` - ScheduleId string `protobuf:"bytes,18,opt,name=schedule_id,json=scheduleId,proto3" json:"schedule_id,omitempty"` - Type string `protobuf:"bytes,19,opt,name=type,proto3" json:"type,omitempty"` -} - -func (x *Task) Reset() { - *x = Task{} - if protoimpl.UnsafeEnabled { - mi := &file_models_task_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Task) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Task) ProtoMessage() {} - -func (x *Task) ProtoReflect() protoreflect.Message { - mi := &file_models_task_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 Task.ProtoReflect.Descriptor instead. -func (*Task) Descriptor() ([]byte, []int) { - return file_models_task_proto_rawDescGZIP(), []int{0} -} - -func (x *Task) GetXId() string { - if x != nil { - return x.XId - } - return "" -} - -func (x *Task) GetSpiderId() string { - if x != nil { - return x.SpiderId - } - return "" -} - -func (x *Task) GetStatus() string { - if x != nil { - return x.Status - } - return "" -} - -func (x *Task) GetNodeId() string { - if x != nil { - return x.NodeId - } - return "" -} - -func (x *Task) GetCmd() string { - if x != nil { - return x.Cmd - } - return "" -} - -func (x *Task) GetParam() string { - if x != nil { - return x.Param - } - return "" -} - -func (x *Task) GetError() string { - if x != nil { - return x.Error - } - return "" -} - -func (x *Task) GetPid() int32 { - if x != nil { - return x.Pid - } - return 0 -} - -func (x *Task) GetRunType() string { - if x != nil { - return x.RunType - } - return "" -} - -func (x *Task) GetScheduleId() string { - if x != nil { - return x.ScheduleId - } - return "" -} - -func (x *Task) GetType() string { - if x != nil { - return x.Type - } - return "" -} - -var File_models_task_proto protoreflect.FileDescriptor - -var file_models_task_proto_rawDesc = []byte{ - 0x0a, 0x11, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, 0x72, 0x70, 0x63, 0x22, 0x85, 0x02, 0x0a, 0x04, 0x54, 0x61, - 0x73, 0x6b, 0x12, 0x0f, 0x0a, 0x03, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x02, 0x49, 0x64, 0x12, 0x1b, 0x0a, 0x09, 0x73, 0x70, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x69, 0x64, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x73, 0x70, 0x69, 0x64, 0x65, 0x72, 0x49, 0x64, - 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x17, 0x0a, 0x07, 0x6e, 0x6f, 0x64, 0x65, - 0x5f, 0x69, 0x64, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6e, 0x6f, 0x64, 0x65, 0x49, - 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, 0x6d, 0x64, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x63, 0x6d, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x18, 0x09, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x05, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x12, 0x14, 0x0a, 0x05, 0x65, 0x72, 0x72, - 0x6f, 0x72, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x12, - 0x10, 0x0a, 0x03, 0x70, 0x69, 0x64, 0x18, 0x10, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x70, 0x69, - 0x64, 0x12, 0x19, 0x0a, 0x08, 0x72, 0x75, 0x6e, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x11, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x72, 0x75, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1f, 0x0a, 0x0b, - 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x5f, 0x69, 0x64, 0x18, 0x12, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0a, 0x73, 0x63, 0x68, 0x65, 0x64, 0x75, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, - 0x04, 0x74, 0x79, 0x70, 0x65, 0x18, 0x13, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, - 0x65, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_models_task_proto_rawDescOnce sync.Once - file_models_task_proto_rawDescData = file_models_task_proto_rawDesc -) - -func file_models_task_proto_rawDescGZIP() []byte { - file_models_task_proto_rawDescOnce.Do(func() { - file_models_task_proto_rawDescData = protoimpl.X.CompressGZIP(file_models_task_proto_rawDescData) - }) - return file_models_task_proto_rawDescData -} - -var file_models_task_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_models_task_proto_goTypes = []any{ - (*Task)(nil), // 0: grpc.Task -} -var file_models_task_proto_depIdxs = []int32{ - 0, // [0:0] is the sub-list for method output_type - 0, // [0:0] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name -} - -func init() { file_models_task_proto_init() } -func file_models_task_proto_init() { - if File_models_task_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_models_task_proto_msgTypes[0].Exporter = func(v any, i int) any { - switch v := v.(*Task); 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_models_task_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_models_task_proto_goTypes, - DependencyIndexes: file_models_task_proto_depIdxs, - MessageInfos: file_models_task_proto_msgTypes, - }.Build() - File_models_task_proto = out.File - file_models_task_proto_rawDesc = nil - file_models_task_proto_goTypes = nil - file_models_task_proto_depIdxs = nil -} diff --git a/grpc/task_service.pb.go b/grpc/task_service.pb.go index 5aa365a9..68e9cf04 100644 --- a/grpc/task_service.pb.go +++ b/grpc/task_service.pb.go @@ -20,6 +20,362 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type TaskServiceSubscribeCode int32 + +const ( + TaskServiceSubscribeCode_CANCEL TaskServiceSubscribeCode = 0 +) + +// Enum value maps for TaskServiceSubscribeCode. +var ( + TaskServiceSubscribeCode_name = map[int32]string{ + 0: "CANCEL", + } + TaskServiceSubscribeCode_value = map[string]int32{ + "CANCEL": 0, + } +) + +func (x TaskServiceSubscribeCode) Enum() *TaskServiceSubscribeCode { + p := new(TaskServiceSubscribeCode) + *p = x + return p +} + +func (x TaskServiceSubscribeCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TaskServiceSubscribeCode) Descriptor() protoreflect.EnumDescriptor { + return file_services_task_service_proto_enumTypes[0].Descriptor() +} + +func (TaskServiceSubscribeCode) Type() protoreflect.EnumType { + return &file_services_task_service_proto_enumTypes[0] +} + +func (x TaskServiceSubscribeCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TaskServiceSubscribeCode.Descriptor instead. +func (TaskServiceSubscribeCode) EnumDescriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{0} +} + +type TaskServiceConnectCode int32 + +const ( + TaskServiceConnectCode_INSERT_DATA TaskServiceConnectCode = 0 + TaskServiceConnectCode_INSERT_LOGS TaskServiceConnectCode = 1 +) + +// Enum value maps for TaskServiceConnectCode. +var ( + TaskServiceConnectCode_name = map[int32]string{ + 0: "INSERT_DATA", + 1: "INSERT_LOGS", + } + TaskServiceConnectCode_value = map[string]int32{ + "INSERT_DATA": 0, + "INSERT_LOGS": 1, + } +) + +func (x TaskServiceConnectCode) Enum() *TaskServiceConnectCode { + p := new(TaskServiceConnectCode) + *p = x + return p +} + +func (x TaskServiceConnectCode) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (TaskServiceConnectCode) Descriptor() protoreflect.EnumDescriptor { + return file_services_task_service_proto_enumTypes[1].Descriptor() +} + +func (TaskServiceConnectCode) Type() protoreflect.EnumType { + return &file_services_task_service_proto_enumTypes[1] +} + +func (x TaskServiceConnectCode) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use TaskServiceConnectCode.Descriptor instead. +func (TaskServiceConnectCode) EnumDescriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{1} +} + +type TaskServiceSubscribeRequest 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"` +} + +func (x *TaskServiceSubscribeRequest) Reset() { + *x = TaskServiceSubscribeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_task_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskServiceSubscribeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskServiceSubscribeRequest) ProtoMessage() {} + +func (x *TaskServiceSubscribeRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_task_service_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 TaskServiceSubscribeRequest.ProtoReflect.Descriptor instead. +func (*TaskServiceSubscribeRequest) Descriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{0} +} + +func (x *TaskServiceSubscribeRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +type TaskServiceSubscribeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code TaskServiceSubscribeCode `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.TaskServiceSubscribeCode" json:"code,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Force bool `protobuf:"varint,3,opt,name=force,proto3" json:"force,omitempty"` +} + +func (x *TaskServiceSubscribeResponse) Reset() { + *x = TaskServiceSubscribeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_services_task_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskServiceSubscribeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskServiceSubscribeResponse) ProtoMessage() {} + +func (x *TaskServiceSubscribeResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_task_service_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 TaskServiceSubscribeResponse.ProtoReflect.Descriptor instead. +func (*TaskServiceSubscribeResponse) Descriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{1} +} + +func (x *TaskServiceSubscribeResponse) GetCode() TaskServiceSubscribeCode { + if x != nil { + return x.Code + } + return TaskServiceSubscribeCode_CANCEL +} + +func (x *TaskServiceSubscribeResponse) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *TaskServiceSubscribeResponse) GetForce() bool { + if x != nil { + return x.Force + } + return false +} + +type TaskServiceConnectRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code TaskServiceConnectCode `protobuf:"varint,1,opt,name=code,proto3,enum=grpc.TaskServiceConnectCode" json:"code,omitempty"` + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` + Data []byte `protobuf:"bytes,3,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *TaskServiceConnectRequest) Reset() { + *x = TaskServiceConnectRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_task_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskServiceConnectRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskServiceConnectRequest) ProtoMessage() {} + +func (x *TaskServiceConnectRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_task_service_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 TaskServiceConnectRequest.ProtoReflect.Descriptor instead. +func (*TaskServiceConnectRequest) Descriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{2} +} + +func (x *TaskServiceConnectRequest) GetCode() TaskServiceConnectCode { + if x != nil { + return x.Code + } + return TaskServiceConnectCode_INSERT_DATA +} + +func (x *TaskServiceConnectRequest) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + +func (x *TaskServiceConnectRequest) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type TaskServiceFetchTaskRequest 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 *TaskServiceFetchTaskRequest) Reset() { + *x = TaskServiceFetchTaskRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_services_task_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskServiceFetchTaskRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskServiceFetchTaskRequest) ProtoMessage() {} + +func (x *TaskServiceFetchTaskRequest) ProtoReflect() protoreflect.Message { + mi := &file_services_task_service_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 TaskServiceFetchTaskRequest.ProtoReflect.Descriptor instead. +func (*TaskServiceFetchTaskRequest) Descriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{3} +} + +func (x *TaskServiceFetchTaskRequest) GetNodeKey() string { + if x != nil { + return x.NodeKey + } + return "" +} + +type TaskServiceFetchTaskResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + TaskId string `protobuf:"bytes,2,opt,name=task_id,json=taskId,proto3" json:"task_id,omitempty"` +} + +func (x *TaskServiceFetchTaskResponse) Reset() { + *x = TaskServiceFetchTaskResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_services_task_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *TaskServiceFetchTaskResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*TaskServiceFetchTaskResponse) ProtoMessage() {} + +func (x *TaskServiceFetchTaskResponse) ProtoReflect() protoreflect.Message { + mi := &file_services_task_service_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 TaskServiceFetchTaskResponse.ProtoReflect.Descriptor instead. +func (*TaskServiceFetchTaskResponse) Descriptor() ([]byte, []int) { + return file_services_task_service_proto_rawDescGZIP(), []int{4} +} + +func (x *TaskServiceFetchTaskResponse) GetTaskId() string { + if x != nil { + return x.TaskId + } + return "" +} + type TaskServiceSendNotificationRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -32,7 +388,7 @@ type TaskServiceSendNotificationRequest struct { func (x *TaskServiceSendNotificationRequest) Reset() { *x = TaskServiceSendNotificationRequest{} if protoimpl.UnsafeEnabled { - mi := &file_services_task_service_proto_msgTypes[0] + mi := &file_services_task_service_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -45,7 +401,7 @@ func (x *TaskServiceSendNotificationRequest) String() string { func (*TaskServiceSendNotificationRequest) ProtoMessage() {} func (x *TaskServiceSendNotificationRequest) ProtoReflect() protoreflect.Message { - mi := &file_services_task_service_proto_msgTypes[0] + mi := &file_services_task_service_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -58,7 +414,7 @@ func (x *TaskServiceSendNotificationRequest) ProtoReflect() protoreflect.Message // Deprecated: Use TaskServiceSendNotificationRequest.ProtoReflect.Descriptor instead. func (*TaskServiceSendNotificationRequest) Descriptor() ([]byte, []int) { - return file_services_task_service_proto_rawDescGZIP(), []int{0} + return file_services_task_service_proto_rawDescGZIP(), []int{5} } func (x *TaskServiceSendNotificationRequest) GetNodeKey() string { @@ -80,30 +436,69 @@ var File_services_task_service_proto protoreflect.FileDescriptor var file_services_task_service_proto_rawDesc = []byte{ 0x0a, 0x1b, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x2f, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x04, 0x67, - 0x72, 0x70, 0x63, 0x1a, 0x14, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, - 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1b, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x5f, - 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x58, 0x0a, - 0x22, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x6e, 0x64, - 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x17, - 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x32, 0xbd, 0x01, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, - 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x34, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, - 0x72, 0x69, 0x62, 0x65, 0x12, 0x13, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x1a, 0x0e, 0x2e, 0x67, 0x72, 0x70, 0x63, - 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x12, 0x28, 0x0a, - 0x05, 0x46, 0x65, 0x74, 0x63, 0x68, 0x12, 0x0d, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 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, 0x4e, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x4e, - 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x67, 0x72, - 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, - 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, - 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x70, 0x63, 0x1a, 0x15, 0x65, 0x6e, 0x74, 0x69, 0x74, 0x79, 0x2f, 0x72, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x36, 0x0a, 0x1b, 0x54, 0x61, + 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, + 0x62, 0x65, 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, 0x22, 0x81, 0x01, 0x0a, 0x1c, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x32, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x43, 0x6f, 0x64, + 0x65, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, + 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, + 0x12, 0x14, 0x0a, 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, + 0x05, 0x66, 0x6f, 0x72, 0x63, 0x65, 0x22, 0x7a, 0x0a, 0x19, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x30, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0e, 0x32, 0x1c, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x64, 0x65, 0x52, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x12, 0x12, + 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, + 0x74, 0x61, 0x22, 0x38, 0x0a, 0x1b, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, + 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 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, 0x37, 0x0a, 0x1c, + 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, + 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, + 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x58, 0x0a, 0x22, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 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, 0x17, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, + 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x2a, + 0x26, 0x0a, 0x18, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, + 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0a, 0x0a, 0x06, 0x43, + 0x41, 0x4e, 0x43, 0x45, 0x4c, 0x10, 0x00, 0x2a, 0x3a, 0x0a, 0x16, 0x54, 0x61, 0x73, 0x6b, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x43, 0x6f, 0x64, + 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, 0x44, 0x41, 0x54, 0x41, + 0x10, 0x00, 0x12, 0x0f, 0x0a, 0x0b, 0x49, 0x4e, 0x53, 0x45, 0x52, 0x54, 0x5f, 0x4c, 0x4f, 0x47, + 0x53, 0x10, 0x01, 0x32, 0xcb, 0x02, 0x0a, 0x0b, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x12, 0x56, 0x0a, 0x09, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, + 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, + 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x75, 0x62, 0x73, 0x63, 0x72, 0x69, 0x62, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x3e, 0x0a, 0x07, 0x43, + 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x1f, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, + 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, + 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, 0x12, 0x54, 0x0a, 0x09, 0x46, + 0x65, 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x21, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, + 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, 0x74, 0x63, 0x68, + 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x67, 0x72, + 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x46, 0x65, + 0x74, 0x63, 0x68, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x12, 0x4e, 0x0a, 0x10, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x54, 0x61, 0x73, + 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x53, 0x65, 0x6e, 0x64, 0x4e, 0x6f, 0x74, 0x69, + 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -118,25 +513,35 @@ func file_services_task_service_proto_rawDescGZIP() []byte { return file_services_task_service_proto_rawDescData } -var file_services_task_service_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_services_task_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2) +var file_services_task_service_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_services_task_service_proto_goTypes = []any{ - (*TaskServiceSendNotificationRequest)(nil), // 0: grpc.TaskServiceSendNotificationRequest - (*StreamMessage)(nil), // 1: grpc.StreamMessage - (*Request)(nil), // 2: grpc.Request - (*Response)(nil), // 3: grpc.Response + (TaskServiceSubscribeCode)(0), // 0: grpc.TaskServiceSubscribeCode + (TaskServiceConnectCode)(0), // 1: grpc.TaskServiceConnectCode + (*TaskServiceSubscribeRequest)(nil), // 2: grpc.TaskServiceSubscribeRequest + (*TaskServiceSubscribeResponse)(nil), // 3: grpc.TaskServiceSubscribeResponse + (*TaskServiceConnectRequest)(nil), // 4: grpc.TaskServiceConnectRequest + (*TaskServiceFetchTaskRequest)(nil), // 5: grpc.TaskServiceFetchTaskRequest + (*TaskServiceFetchTaskResponse)(nil), // 6: grpc.TaskServiceFetchTaskResponse + (*TaskServiceSendNotificationRequest)(nil), // 7: grpc.TaskServiceSendNotificationRequest + (*Response)(nil), // 8: grpc.Response } var file_services_task_service_proto_depIdxs = []int32{ - 1, // 0: grpc.TaskService.Subscribe:input_type -> grpc.StreamMessage - 2, // 1: grpc.TaskService.Fetch:input_type -> grpc.Request - 0, // 2: grpc.TaskService.SendNotification:input_type -> grpc.TaskServiceSendNotificationRequest - 3, // 3: grpc.TaskService.Subscribe:output_type -> grpc.Response - 3, // 4: grpc.TaskService.Fetch:output_type -> grpc.Response - 3, // 5: grpc.TaskService.SendNotification:output_type -> grpc.Response - 3, // [3:6] is the sub-list for method output_type - 0, // [0:3] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 0, // 0: grpc.TaskServiceSubscribeResponse.code:type_name -> grpc.TaskServiceSubscribeCode + 1, // 1: grpc.TaskServiceConnectRequest.code:type_name -> grpc.TaskServiceConnectCode + 2, // 2: grpc.TaskService.Subscribe:input_type -> grpc.TaskServiceSubscribeRequest + 4, // 3: grpc.TaskService.Connect:input_type -> grpc.TaskServiceConnectRequest + 5, // 4: grpc.TaskService.FetchTask:input_type -> grpc.TaskServiceFetchTaskRequest + 7, // 5: grpc.TaskService.SendNotification:input_type -> grpc.TaskServiceSendNotificationRequest + 3, // 6: grpc.TaskService.Subscribe:output_type -> grpc.TaskServiceSubscribeResponse + 8, // 7: grpc.TaskService.Connect:output_type -> grpc.Response + 6, // 8: grpc.TaskService.FetchTask:output_type -> grpc.TaskServiceFetchTaskResponse + 8, // 9: grpc.TaskService.SendNotification:output_type -> grpc.Response + 6, // [6:10] is the sub-list for method output_type + 2, // [2:6] is the sub-list for method input_type + 2, // [2:2] is the sub-list for extension type_name + 2, // [2:2] is the sub-list for extension extendee + 0, // [0:2] is the sub-list for field type_name } func init() { file_services_task_service_proto_init() } @@ -144,11 +549,69 @@ func file_services_task_service_proto_init() { if File_services_task_service_proto != nil { return } - file_entity_request_proto_init() file_entity_response_proto_init() - file_entity_stream_message_proto_init() if !protoimpl.UnsafeEnabled { file_services_task_service_proto_msgTypes[0].Exporter = func(v any, i int) any { + switch v := v.(*TaskServiceSubscribeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_task_service_proto_msgTypes[1].Exporter = func(v any, i int) any { + switch v := v.(*TaskServiceSubscribeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_task_service_proto_msgTypes[2].Exporter = func(v any, i int) any { + switch v := v.(*TaskServiceConnectRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_task_service_proto_msgTypes[3].Exporter = func(v any, i int) any { + switch v := v.(*TaskServiceFetchTaskRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_task_service_proto_msgTypes[4].Exporter = func(v any, i int) any { + switch v := v.(*TaskServiceFetchTaskResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_services_task_service_proto_msgTypes[5].Exporter = func(v any, i int) any { switch v := v.(*TaskServiceSendNotificationRequest); i { case 0: return &v.state @@ -166,13 +629,14 @@ func file_services_task_service_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_services_task_service_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, + NumEnums: 2, + NumMessages: 6, NumExtensions: 0, NumServices: 1, }, GoTypes: file_services_task_service_proto_goTypes, DependencyIndexes: file_services_task_service_proto_depIdxs, + EnumInfos: file_services_task_service_proto_enumTypes, MessageInfos: file_services_task_service_proto_msgTypes, }.Build() File_services_task_service_proto = out.File diff --git a/grpc/task_service_grpc.pb.go b/grpc/task_service_grpc.pb.go index 8ae3a469..caeca53b 100644 --- a/grpc/task_service_grpc.pb.go +++ b/grpc/task_service_grpc.pb.go @@ -20,7 +20,8 @@ const _ = grpc.SupportPackageIsVersion8 const ( TaskService_Subscribe_FullMethodName = "/grpc.TaskService/Subscribe" - TaskService_Fetch_FullMethodName = "/grpc.TaskService/Fetch" + TaskService_Connect_FullMethodName = "/grpc.TaskService/Connect" + TaskService_FetchTask_FullMethodName = "/grpc.TaskService/FetchTask" TaskService_SendNotification_FullMethodName = "/grpc.TaskService/SendNotification" ) @@ -28,8 +29,9 @@ const ( // // 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 TaskServiceClient interface { - Subscribe(ctx context.Context, opts ...grpc.CallOption) (TaskService_SubscribeClient, error) - Fetch(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) + Subscribe(ctx context.Context, in *TaskServiceSubscribeRequest, opts ...grpc.CallOption) (TaskService_SubscribeClient, error) + Connect(ctx context.Context, opts ...grpc.CallOption) (TaskService_ConnectClient, error) + FetchTask(ctx context.Context, in *TaskServiceFetchTaskRequest, opts ...grpc.CallOption) (*TaskServiceFetchTaskResponse, error) SendNotification(ctx context.Context, in *TaskServiceSendNotificationRequest, opts ...grpc.CallOption) (*Response, error) } @@ -41,19 +43,24 @@ func NewTaskServiceClient(cc grpc.ClientConnInterface) TaskServiceClient { return &taskServiceClient{cc} } -func (c *taskServiceClient) Subscribe(ctx context.Context, opts ...grpc.CallOption) (TaskService_SubscribeClient, error) { +func (c *taskServiceClient) Subscribe(ctx context.Context, in *TaskServiceSubscribeRequest, opts ...grpc.CallOption) (TaskService_SubscribeClient, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) stream, err := c.cc.NewStream(ctx, &TaskService_ServiceDesc.Streams[0], TaskService_Subscribe_FullMethodName, cOpts...) if err != nil { return nil, err } x := &taskServiceSubscribeClient{ClientStream: 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 TaskService_SubscribeClient interface { - Send(*StreamMessage) error - CloseAndRecv() (*Response, error) + Recv() (*TaskServiceSubscribeResponse, error) grpc.ClientStream } @@ -61,11 +68,39 @@ type taskServiceSubscribeClient struct { grpc.ClientStream } -func (x *taskServiceSubscribeClient) Send(m *StreamMessage) error { +func (x *taskServiceSubscribeClient) Recv() (*TaskServiceSubscribeResponse, error) { + m := new(TaskServiceSubscribeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *taskServiceClient) Connect(ctx context.Context, opts ...grpc.CallOption) (TaskService_ConnectClient, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + stream, err := c.cc.NewStream(ctx, &TaskService_ServiceDesc.Streams[1], TaskService_Connect_FullMethodName, cOpts...) + if err != nil { + return nil, err + } + x := &taskServiceConnectClient{ClientStream: stream} + return x, nil +} + +type TaskService_ConnectClient interface { + Send(*TaskServiceConnectRequest) error + CloseAndRecv() (*Response, error) + grpc.ClientStream +} + +type taskServiceConnectClient struct { + grpc.ClientStream +} + +func (x *taskServiceConnectClient) Send(m *TaskServiceConnectRequest) error { return x.ClientStream.SendMsg(m) } -func (x *taskServiceSubscribeClient) CloseAndRecv() (*Response, error) { +func (x *taskServiceConnectClient) CloseAndRecv() (*Response, error) { if err := x.ClientStream.CloseSend(); err != nil { return nil, err } @@ -76,10 +111,10 @@ func (x *taskServiceSubscribeClient) CloseAndRecv() (*Response, error) { return m, nil } -func (c *taskServiceClient) Fetch(ctx context.Context, in *Request, opts ...grpc.CallOption) (*Response, error) { +func (c *taskServiceClient) FetchTask(ctx context.Context, in *TaskServiceFetchTaskRequest, opts ...grpc.CallOption) (*TaskServiceFetchTaskResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) - out := new(Response) - err := c.cc.Invoke(ctx, TaskService_Fetch_FullMethodName, in, out, cOpts...) + out := new(TaskServiceFetchTaskResponse) + err := c.cc.Invoke(ctx, TaskService_FetchTask_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } @@ -100,8 +135,9 @@ func (c *taskServiceClient) SendNotification(ctx context.Context, in *TaskServic // All implementations must embed UnimplementedTaskServiceServer // for forward compatibility type TaskServiceServer interface { - Subscribe(TaskService_SubscribeServer) error - Fetch(context.Context, *Request) (*Response, error) + Subscribe(*TaskServiceSubscribeRequest, TaskService_SubscribeServer) error + Connect(TaskService_ConnectServer) error + FetchTask(context.Context, *TaskServiceFetchTaskRequest) (*TaskServiceFetchTaskResponse, error) SendNotification(context.Context, *TaskServiceSendNotificationRequest) (*Response, error) mustEmbedUnimplementedTaskServiceServer() } @@ -110,11 +146,14 @@ type TaskServiceServer interface { type UnimplementedTaskServiceServer struct { } -func (UnimplementedTaskServiceServer) Subscribe(TaskService_SubscribeServer) error { +func (UnimplementedTaskServiceServer) Subscribe(*TaskServiceSubscribeRequest, TaskService_SubscribeServer) error { return status.Errorf(codes.Unimplemented, "method Subscribe not implemented") } -func (UnimplementedTaskServiceServer) Fetch(context.Context, *Request) (*Response, error) { - return nil, status.Errorf(codes.Unimplemented, "method Fetch not implemented") +func (UnimplementedTaskServiceServer) Connect(TaskService_ConnectServer) error { + return status.Errorf(codes.Unimplemented, "method Connect not implemented") +} +func (UnimplementedTaskServiceServer) FetchTask(context.Context, *TaskServiceFetchTaskRequest) (*TaskServiceFetchTaskResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FetchTask not implemented") } func (UnimplementedTaskServiceServer) SendNotification(context.Context, *TaskServiceSendNotificationRequest) (*Response, error) { return nil, status.Errorf(codes.Unimplemented, "method SendNotification not implemented") @@ -133,12 +172,15 @@ func RegisterTaskServiceServer(s grpc.ServiceRegistrar, srv TaskServiceServer) { } func _TaskService_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(TaskServiceServer).Subscribe(&taskServiceSubscribeServer{ServerStream: stream}) + m := new(TaskServiceSubscribeRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(TaskServiceServer).Subscribe(m, &taskServiceSubscribeServer{ServerStream: stream}) } type TaskService_SubscribeServer interface { - SendAndClose(*Response) error - Recv() (*StreamMessage, error) + Send(*TaskServiceSubscribeResponse) error grpc.ServerStream } @@ -146,32 +188,50 @@ type taskServiceSubscribeServer struct { grpc.ServerStream } -func (x *taskServiceSubscribeServer) SendAndClose(m *Response) error { +func (x *taskServiceSubscribeServer) Send(m *TaskServiceSubscribeResponse) error { return x.ServerStream.SendMsg(m) } -func (x *taskServiceSubscribeServer) Recv() (*StreamMessage, error) { - m := new(StreamMessage) +func _TaskService_Connect_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TaskServiceServer).Connect(&taskServiceConnectServer{ServerStream: stream}) +} + +type TaskService_ConnectServer interface { + SendAndClose(*Response) error + Recv() (*TaskServiceConnectRequest, error) + grpc.ServerStream +} + +type taskServiceConnectServer struct { + grpc.ServerStream +} + +func (x *taskServiceConnectServer) SendAndClose(m *Response) error { + return x.ServerStream.SendMsg(m) +} + +func (x *taskServiceConnectServer) Recv() (*TaskServiceConnectRequest, error) { + m := new(TaskServiceConnectRequest) if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err } return m, nil } -func _TaskService_Fetch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(Request) +func _TaskService_FetchTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(TaskServiceFetchTaskRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(TaskServiceServer).Fetch(ctx, in) + return srv.(TaskServiceServer).FetchTask(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: TaskService_Fetch_FullMethodName, + FullMethod: TaskService_FetchTask_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(TaskServiceServer).Fetch(ctx, req.(*Request)) + return srv.(TaskServiceServer).FetchTask(ctx, req.(*TaskServiceFetchTaskRequest)) } return interceptor(ctx, in, info, handler) } @@ -202,8 +262,8 @@ var TaskService_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*TaskServiceServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "Fetch", - Handler: _TaskService_Fetch_Handler, + MethodName: "FetchTask", + Handler: _TaskService_FetchTask_Handler, }, { MethodName: "SendNotification", @@ -214,6 +274,11 @@ var TaskService_ServiceDesc = grpc.ServiceDesc{ { StreamName: "Subscribe", Handler: _TaskService_Subscribe_Handler, + ServerStreams: true, + }, + { + StreamName: "Connect", + Handler: _TaskService_Connect_Handler, ClientStreams: true, }, },