mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
feat: optimized dependency logic
This commit is contained in:
@@ -1,11 +0,0 @@
|
||||
package entity
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
type DependencyRepo struct {
|
||||
Name string `json:"name,omitempty" bson:"name,omitempty"`
|
||||
NodeIds []primitive.ObjectID `json:"node_ids,omitempty" bson:"node_ids,omitempty"`
|
||||
Versions []string `json:"versions,omitempty" bson:"versions,omitempty"`
|
||||
LatestVersion string `json:"latest_version" bson:"latest_version"`
|
||||
Type string `json:"type" bson:"type"`
|
||||
}
|
||||
@@ -3,18 +3,20 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/crawlab-team/crawlab-pro/core/dependency/constants"
|
||||
|
||||
"github.com/apex/log"
|
||||
"github.com/crawlab-team/crawlab/core/models/models"
|
||||
"github.com/crawlab-team/crawlab/core/models/service"
|
||||
mongo2 "github.com/crawlab-team/crawlab/db/mongo"
|
||||
"github.com/crawlab-team/crawlab/grpc"
|
||||
"github.com/crawlab-team/crawlab/trace"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"go.mongodb.org/mongo-driver/mongo"
|
||||
"io"
|
||||
"sync"
|
||||
"time"
|
||||
)
|
||||
|
||||
type DependencyServiceServer struct {
|
||||
@@ -36,12 +38,15 @@ func (svr DependencyServiceServer) Connect(req *grpc.DependencyServiceConnectReq
|
||||
return nil
|
||||
}
|
||||
|
||||
func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.DependencyServiceSyncRequest) (response *grpc.Response, err error) {
|
||||
// Sync handles synchronization of dependencies between nodes and the database
|
||||
func (svr DependencyServiceServer) Sync(_ context.Context, request *grpc.DependencyServiceSyncRequest) (response *grpc.Response, err error) {
|
||||
// Get node by node key
|
||||
n, err := service.NewModelService[models.Node]().GetOne(bson.M{"key": request.NodeKey}, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Get existing dependencies from database for this node and language
|
||||
depsDb, err := service.NewModelService[models.Dependency]().GetMany(bson.M{
|
||||
"node_id": n.Id,
|
||||
"type": request.Lang,
|
||||
@@ -53,30 +58,45 @@ func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.Depen
|
||||
}
|
||||
}
|
||||
|
||||
// Create map of existing dependencies for faster lookup
|
||||
depsDbMap := make(map[string]*models.Dependency)
|
||||
for _, d := range depsDb {
|
||||
depsDbMap[d.Name] = &d
|
||||
}
|
||||
|
||||
// Process new dependencies from request
|
||||
var depsToInsert []models.Dependency
|
||||
var depsToUpdate []models.Dependency
|
||||
depsMap := make(map[string]*models.Dependency)
|
||||
for _, dep := range request.Dependencies {
|
||||
// Create dependency model
|
||||
d := models.Dependency{
|
||||
Name: dep.Name,
|
||||
NodeId: n.Id,
|
||||
Type: request.Lang,
|
||||
Version: dep.Version,
|
||||
Status: constants.DependencyStatusInstalled,
|
||||
}
|
||||
d.SetCreatedAt(time.Now())
|
||||
d.SetUpdatedAt(time.Now())
|
||||
|
||||
// Add to map
|
||||
depsMap[d.Name] = &d
|
||||
|
||||
_, ok := depsDbMap[d.Name]
|
||||
// Check if dependency exists in DB
|
||||
existingDep, ok := depsDbMap[d.Name]
|
||||
if !ok {
|
||||
// If dependency doesn't exist, add to insert list
|
||||
depsToInsert = append(depsToInsert, d)
|
||||
} else if existingDep.Version != d.Version || existingDep.Status != constants.DependencyStatusInstalled {
|
||||
// If dependency exists but version is different or status is not installed, add to update list
|
||||
d.Id = existingDep.Id
|
||||
d.SetUpdatedAt(time.Now())
|
||||
depsToUpdate = append(depsToUpdate, d)
|
||||
}
|
||||
}
|
||||
|
||||
// Find dependencies to delete (exist in DB but not in request)
|
||||
var depIdsToDelete []primitive.ObjectID
|
||||
for _, d := range depsDb {
|
||||
_, ok := depsMap[d.Name]
|
||||
@@ -85,23 +105,33 @@ func (svr DependencyServiceServer) Sync(ctx context.Context, request *grpc.Depen
|
||||
}
|
||||
}
|
||||
|
||||
// Run database operations in a transaction
|
||||
err = mongo2.RunTransaction(func(ctx mongo.SessionContext) (err error) {
|
||||
// Delete old dependencies if any
|
||||
if len(depIdsToDelete) > 0 {
|
||||
err = service.NewModelService[models.Dependency]().DeleteMany(bson.M{
|
||||
"_id": bson.M{"$in": depIdsToDelete},
|
||||
})
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] delete dependencies in db error: %v", err)
|
||||
trace.PrintError(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Insert new dependencies if any
|
||||
if len(depsToInsert) > 0 {
|
||||
_, err = service.NewModelService[models.Dependency]().InsertMany(depsToInsert)
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] insert dependencies in db error: %v", err)
|
||||
trace.PrintError(err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Update dependencies with different versions
|
||||
for _, d := range depsToUpdate {
|
||||
err = service.NewModelService[models.Dependency]().ReplaceById(d.Id, d)
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] update dependency in db error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -137,32 +167,32 @@ func (svr DependencyServiceServer) UpdateLogs(stream grpc.DependencyService_Upda
|
||||
|
||||
// if dependency is nil, get dependency
|
||||
if dep == nil {
|
||||
dep, err = service.NewModelService[models.Dependency]().GetOne(bson.M{
|
||||
"node_id": n.Id,
|
||||
"name": req.Name,
|
||||
"type": req.Lang,
|
||||
}, nil)
|
||||
id, err := primitive.ObjectIDFromHex(req.DependencyId)
|
||||
if err != nil {
|
||||
if !errors.Is(err, mongo.ErrNoDocuments) {
|
||||
log.Errorf("[DependencyServiceServer] get dependency error: %v", err)
|
||||
return err
|
||||
}
|
||||
// create dependency if not found
|
||||
dep = &models.Dependency{
|
||||
NodeId: n.Id,
|
||||
Name: req.Name,
|
||||
Type: req.Lang,
|
||||
}
|
||||
dep.SetCreatedAt(time.Now())
|
||||
dep.SetUpdatedAt(time.Now())
|
||||
dep.Id, err = service.NewModelService[models.Dependency]().InsertOne(*dep)
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] insert dependency error: %v", err)
|
||||
return err
|
||||
}
|
||||
log.Errorf("[DependencyServiceServer] convert dependency id error: %v", err)
|
||||
return err
|
||||
}
|
||||
dep, err = service.NewModelService[models.Dependency]().GetById(id)
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] get dependency error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// insert dependency logs
|
||||
var depLogs []models.DependencyLog
|
||||
for _, line := range req.Logs {
|
||||
depLog := models.DependencyLog{
|
||||
DependencyId: dep.Id,
|
||||
Content: line,
|
||||
}
|
||||
depLogs = append(depLogs, depLog)
|
||||
}
|
||||
_, err = service.NewModelService[models.DependencyLog]().InsertMany(depLogs)
|
||||
if err != nil {
|
||||
log.Errorf("[DependencyServiceServer] insert dependency logs error: %v", err)
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package server
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
@@ -269,6 +270,30 @@ func (svr ModelBaseServiceServer) InsertMany(_ context.Context, req *grpc.ModelS
|
||||
return HandleSuccessWithData(r.InsertedIDs)
|
||||
}
|
||||
|
||||
func (svr ModelBaseServiceServer) UpsertOne(_ context.Context, req *grpc.ModelServiceUpsertOneRequest) (res *grpc.Response, err error) {
|
||||
model := GetOneInstanceModel(req.ModelType)
|
||||
modelType := reflect.TypeOf(model)
|
||||
modelValuePtr := reflect.New(modelType).Interface()
|
||||
err = json.Unmarshal(req.Model, modelValuePtr)
|
||||
if err != nil {
|
||||
return HandleError(err)
|
||||
}
|
||||
var query bson.M
|
||||
err = json.Unmarshal(req.Query, &query)
|
||||
if err != nil {
|
||||
return HandleError(err)
|
||||
}
|
||||
modelSvc := GetModelService[bson.M](req.ModelType)
|
||||
opts := &options.ReplaceOptions{}
|
||||
opts.SetUpsert(true)
|
||||
id, err := modelSvc.GetCol().GetCollection().ReplaceOne(modelSvc.GetCol().GetContext(), query, modelValuePtr, opts)
|
||||
if err != nil {
|
||||
return HandleError(err)
|
||||
}
|
||||
|
||||
return HandleSuccessWithData(id)
|
||||
}
|
||||
|
||||
func (svr ModelBaseServiceServer) Count(_ context.Context, req *grpc.ModelServiceCountRequest) (res *grpc.Response, err error) {
|
||||
var query bson.M
|
||||
err = json.Unmarshal(req.Query, &query)
|
||||
|
||||
@@ -2,6 +2,9 @@ package client
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/crawlab-team/crawlab/core/grpc/client"
|
||||
"github.com/crawlab-team/crawlab/core/interfaces"
|
||||
nodeconfig "github.com/crawlab-team/crawlab/core/node/config"
|
||||
@@ -9,8 +12,6 @@ import (
|
||||
"github.com/crawlab-team/crawlab/grpc"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
||||
"reflect"
|
||||
"sync"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -255,11 +256,6 @@ func (svc *ModelService[T]) InsertOne(model T) (id primitive.ObjectID, err error
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
return deserialize[primitive.ObjectID](res)
|
||||
//idStr, err := deserialize[string](res)
|
||||
//if err != nil {
|
||||
// return primitive.NilObjectID, err
|
||||
//}
|
||||
//return primitive.ObjectIDFromHex(idStr)
|
||||
}
|
||||
|
||||
func (svc *ModelService[T]) InsertMany(models []T) (ids []primitive.ObjectID, err error) {
|
||||
@@ -280,6 +276,30 @@ func (svc *ModelService[T]) InsertMany(models []T) (ids []primitive.ObjectID, er
|
||||
return deserialize[[]primitive.ObjectID](res)
|
||||
}
|
||||
|
||||
func (svc *ModelService[T]) UpsertOne(query bson.M, model T) (id primitive.ObjectID, err error) {
|
||||
ctx, cancel := svc.c.Context()
|
||||
defer cancel()
|
||||
queryData, err := json.Marshal(query)
|
||||
if err != nil {
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
modelData, err := json.Marshal(model)
|
||||
if err != nil {
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
res, err := svc.c.ModelBaseServiceClient.UpsertOne(ctx, &grpc.ModelServiceUpsertOneRequest{
|
||||
NodeKey: svc.cfg.GetNodeKey(),
|
||||
ModelType: svc.modelType,
|
||||
Query: queryData,
|
||||
Model: modelData,
|
||||
})
|
||||
if err != nil {
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
|
||||
return deserialize[primitive.ObjectID](res)
|
||||
}
|
||||
|
||||
func (svc *ModelService[T]) Count(query bson.M) (total int, err error) {
|
||||
ctx, cancel := svc.c.Context()
|
||||
defer cancel()
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package models
|
||||
|
||||
import "go.mongodb.org/mongo-driver/bson/primitive"
|
||||
|
||||
type DependencyLog struct {
|
||||
any `collection:"dependency_logs"`
|
||||
BaseModel[DependencyLog] `bson:",inline"`
|
||||
Content string `json:"content" bson:"content"`
|
||||
DependencyId primitive.ObjectID `json:"dependency_id" bson:"dependency_id"`
|
||||
Content string `json:"content" bson:"content"`
|
||||
}
|
||||
|
||||
@@ -3,10 +3,11 @@ package service
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
"reflect"
|
||||
"sync"
|
||||
|
||||
"go.mongodb.org/mongo-driver/mongo/options"
|
||||
|
||||
"github.com/crawlab-team/crawlab/core/interfaces"
|
||||
"github.com/crawlab-team/crawlab/db/mongo"
|
||||
"go.mongodb.org/mongo-driver/bson"
|
||||
@@ -249,6 +250,44 @@ func (svc *ModelService[T]) InsertManyContext(ctx context.Context, models []T) (
|
||||
}
|
||||
return ids, nil
|
||||
}
|
||||
func (svc *ModelService[T]) UpsertOne(query bson.M, model T) (id primitive.ObjectID, err error) {
|
||||
opts := options.ReplaceOptions{}
|
||||
opts.SetUpsert(true)
|
||||
result, err := svc.col.GetCollection().ReplaceOne(svc.col.GetContext(), query, model, &opts)
|
||||
if err != nil {
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
|
||||
if result.UpsertedID != nil {
|
||||
// If document was inserted
|
||||
return result.UpsertedID.(primitive.ObjectID), nil
|
||||
}
|
||||
|
||||
// If document was updated, get its ID from the model
|
||||
m := any(&model).(interfaces.Model)
|
||||
return m.GetId(), nil
|
||||
}
|
||||
|
||||
func (svc *ModelService[T]) UpsertOneContext(ctx context.Context, query bson.M, model T) (id primitive.ObjectID, err error) {
|
||||
opts := options.ReplaceOptions{}
|
||||
opts.SetUpsert(true)
|
||||
result, err := svc.col.GetCollection().ReplaceOne(ctx, query, model, &opts)
|
||||
if err != nil {
|
||||
return primitive.NilObjectID, err
|
||||
}
|
||||
|
||||
if result.UpsertedID != nil {
|
||||
// If document was inserted
|
||||
return result.UpsertedID.(primitive.ObjectID), nil
|
||||
}
|
||||
|
||||
// If document was updated, get its ID from the query or model
|
||||
if id, ok := query["_id"].(primitive.ObjectID); ok {
|
||||
return id, nil
|
||||
}
|
||||
m := any(&model).(interfaces.Model)
|
||||
return m.GetId(), nil
|
||||
}
|
||||
|
||||
func (svc *ModelService[T]) Count(query bson.M) (total int, err error) {
|
||||
return svc.col.Count(query)
|
||||
|
||||
@@ -310,10 +310,9 @@ type DependencyServiceUpdateLogsRequest struct {
|
||||
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"`
|
||||
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
|
||||
Logs []string `protobuf:"bytes,4,rep,name=logs,proto3" json:"logs,omitempty"`
|
||||
NodeKey string `protobuf:"bytes,1,opt,name=node_key,json=nodeKey,proto3" json:"node_key,omitempty"`
|
||||
DependencyId string `protobuf:"bytes,2,opt,name=dependency_id,json=dependencyId,proto3" json:"dependency_id,omitempty"`
|
||||
Logs []string `protobuf:"bytes,3,rep,name=logs,proto3" json:"logs,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DependencyServiceUpdateLogsRequest) Reset() {
|
||||
@@ -355,16 +354,9 @@ func (x *DependencyServiceUpdateLogsRequest) GetNodeKey() string {
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DependencyServiceUpdateLogsRequest) GetLang() string {
|
||||
func (x *DependencyServiceUpdateLogsRequest) GetDependencyId() string {
|
||||
if x != nil {
|
||||
return x.Lang
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DependencyServiceUpdateLogsRequest) GetName() string {
|
||||
if x != nil {
|
||||
return x.Name
|
||||
return x.DependencyId
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@@ -410,35 +402,35 @@ var file_services_dependency_service_proto_rawDesc = []byte{
|
||||
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, 0x7b, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79,
|
||||
0x65, 0x73, 0x22, 0x78, 0x0a, 0x22, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x6e, 0x6f, 0x64, 0x65,
|
||||
0x5f, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6e, 0x6f, 0x64, 0x65,
|
||||
0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x04, 0x6c, 0x61, 0x6e, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18,
|
||||
0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6c,
|
||||
0x6f, 0x67, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x2a,
|
||||
0x3d, 0x0a, 0x15, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43,
|
||||
0x10, 0x00, 0x12, 0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12,
|
||||
0x0d, 0x0a, 0x09, 0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0xfb,
|
||||
0x01, 0x0a, 0x11, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x12, 0x5c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12,
|
||||
0x25, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65,
|
||||
0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43,
|
||||
0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x30, 0x01, 0x12, 0x3c, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70,
|
||||
0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e,
|
||||
0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x12, 0x4a, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x28,
|
||||
0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67,
|
||||
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e,
|
||||
0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x42, 0x08, 0x5a, 0x06,
|
||||
0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x64, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63,
|
||||
0x79, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x64, 0x65, 0x70, 0x65,
|
||||
0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x6f, 0x67, 0x73,
|
||||
0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x6f, 0x67, 0x73, 0x2a, 0x3d, 0x0a, 0x15,
|
||||
0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x08, 0x0a, 0x04, 0x53, 0x59, 0x4e, 0x43, 0x10, 0x00, 0x12,
|
||||
0x0b, 0x0a, 0x07, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0d, 0x0a, 0x09,
|
||||
0x55, 0x4e, 0x49, 0x4e, 0x53, 0x54, 0x41, 0x4c, 0x4c, 0x10, 0x02, 0x32, 0xfb, 0x01, 0x0a, 0x11,
|
||||
0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63,
|
||||
0x65, 0x12, 0x5c, 0x0a, 0x07, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x12, 0x25, 0x2e, 0x67,
|
||||
0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e,
|
||||
0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x6e, 0x6e,
|
||||
0x65, 0x63, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12,
|
||||
0x3c, 0x0a, 0x04, 0x53, 0x79, 0x6e, 0x63, 0x12, 0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x44,
|
||||
0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
|
||||
0x53, 0x79, 0x6e, 0x63, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x67, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x4a, 0x0a,
|
||||
0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x28, 0x2e, 0x67, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x44, 0x65, 0x70, 0x65, 0x6e, 0x64, 0x65, 0x6e, 0x63, 0x79, 0x53, 0x65, 0x72,
|
||||
0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0e, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x28, 0x01, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67,
|
||||
0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
@@ -28,7 +28,7 @@ var file_services_model_base_service_proto_rawDesc = []byte{
|
||||
0x79, 0x2f, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 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, 0x32, 0xb6, 0x07, 0x0a, 0x10, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x42, 0x61,
|
||||
0x72, 0x6f, 0x74, 0x6f, 0x32, 0xf9, 0x07, 0x0a, 0x10, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x42, 0x61,
|
||||
0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3d, 0x0a, 0x07, 0x47, 0x65, 0x74,
|
||||
0x42, 0x79, 0x49, 0x64, 0x12, 0x20, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x65,
|
||||
0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x47, 0x65, 0x74, 0x42, 0x79, 0x49, 0x64, 0x52,
|
||||
@@ -84,11 +84,16 @@ var file_services_model_base_service_proto_rawDesc = []byte{
|
||||
0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x49,
|
||||
0x6e, 0x73, 0x65, 0x72, 0x74, 0x4d, 0x61, 0x6e, 0x79, 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, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e, 0x2e, 0x67, 0x72,
|
||||
0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43,
|
||||
0x6f, 0x75, 0x6e, 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, 0x42, 0x08, 0x5a,
|
||||
0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x22, 0x00, 0x12, 0x41, 0x0a, 0x09, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4f, 0x6e, 0x65, 0x12,
|
||||
0x22, 0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4f, 0x6e, 0x65, 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, 0x05, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1e,
|
||||
0x2e, 0x67, 0x72, 0x70, 0x63, 0x2e, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 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,
|
||||
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{
|
||||
@@ -105,8 +110,9 @@ var file_services_model_base_service_proto_goTypes = []any{
|
||||
(*ModelServiceReplaceOneRequest)(nil), // 10: grpc.ModelServiceReplaceOneRequest
|
||||
(*ModelServiceInsertOneRequest)(nil), // 11: grpc.ModelServiceInsertOneRequest
|
||||
(*ModelServiceInsertManyRequest)(nil), // 12: grpc.ModelServiceInsertManyRequest
|
||||
(*ModelServiceCountRequest)(nil), // 13: grpc.ModelServiceCountRequest
|
||||
(*Response)(nil), // 14: grpc.Response
|
||||
(*ModelServiceUpsertOneRequest)(nil), // 13: grpc.ModelServiceUpsertOneRequest
|
||||
(*ModelServiceCountRequest)(nil), // 14: grpc.ModelServiceCountRequest
|
||||
(*Response)(nil), // 15: grpc.Response
|
||||
}
|
||||
var file_services_model_base_service_proto_depIdxs = []int32{
|
||||
0, // 0: grpc.ModelBaseService.GetById:input_type -> grpc.ModelServiceGetByIdRequest
|
||||
@@ -122,23 +128,25 @@ var file_services_model_base_service_proto_depIdxs = []int32{
|
||||
10, // 10: grpc.ModelBaseService.ReplaceOne:input_type -> grpc.ModelServiceReplaceOneRequest
|
||||
11, // 11: grpc.ModelBaseService.InsertOne:input_type -> grpc.ModelServiceInsertOneRequest
|
||||
12, // 12: grpc.ModelBaseService.InsertMany:input_type -> grpc.ModelServiceInsertManyRequest
|
||||
13, // 13: grpc.ModelBaseService.Count:input_type -> grpc.ModelServiceCountRequest
|
||||
14, // 14: grpc.ModelBaseService.GetById:output_type -> grpc.Response
|
||||
14, // 15: grpc.ModelBaseService.GetOne:output_type -> grpc.Response
|
||||
14, // 16: grpc.ModelBaseService.GetMany:output_type -> grpc.Response
|
||||
14, // 17: grpc.ModelBaseService.DeleteById:output_type -> grpc.Response
|
||||
14, // 18: grpc.ModelBaseService.DeleteOne:output_type -> grpc.Response
|
||||
14, // 19: grpc.ModelBaseService.DeleteMany:output_type -> grpc.Response
|
||||
14, // 20: grpc.ModelBaseService.UpdateById:output_type -> grpc.Response
|
||||
14, // 21: grpc.ModelBaseService.UpdateOne:output_type -> grpc.Response
|
||||
14, // 22: grpc.ModelBaseService.UpdateMany:output_type -> grpc.Response
|
||||
14, // 23: grpc.ModelBaseService.ReplaceById:output_type -> grpc.Response
|
||||
14, // 24: grpc.ModelBaseService.ReplaceOne:output_type -> grpc.Response
|
||||
14, // 25: grpc.ModelBaseService.InsertOne:output_type -> grpc.Response
|
||||
14, // 26: grpc.ModelBaseService.InsertMany:output_type -> grpc.Response
|
||||
14, // 27: grpc.ModelBaseService.Count:output_type -> grpc.Response
|
||||
14, // [14:28] is the sub-list for method output_type
|
||||
0, // [0:14] is the sub-list for method input_type
|
||||
13, // 13: grpc.ModelBaseService.UpsertOne:input_type -> grpc.ModelServiceUpsertOneRequest
|
||||
14, // 14: grpc.ModelBaseService.Count:input_type -> grpc.ModelServiceCountRequest
|
||||
15, // 15: grpc.ModelBaseService.GetById:output_type -> grpc.Response
|
||||
15, // 16: grpc.ModelBaseService.GetOne:output_type -> grpc.Response
|
||||
15, // 17: grpc.ModelBaseService.GetMany:output_type -> grpc.Response
|
||||
15, // 18: grpc.ModelBaseService.DeleteById:output_type -> grpc.Response
|
||||
15, // 19: grpc.ModelBaseService.DeleteOne:output_type -> grpc.Response
|
||||
15, // 20: grpc.ModelBaseService.DeleteMany:output_type -> grpc.Response
|
||||
15, // 21: grpc.ModelBaseService.UpdateById:output_type -> grpc.Response
|
||||
15, // 22: grpc.ModelBaseService.UpdateOne:output_type -> grpc.Response
|
||||
15, // 23: grpc.ModelBaseService.UpdateMany:output_type -> grpc.Response
|
||||
15, // 24: grpc.ModelBaseService.ReplaceById:output_type -> grpc.Response
|
||||
15, // 25: grpc.ModelBaseService.ReplaceOne:output_type -> grpc.Response
|
||||
15, // 26: grpc.ModelBaseService.InsertOne:output_type -> grpc.Response
|
||||
15, // 27: grpc.ModelBaseService.InsertMany:output_type -> grpc.Response
|
||||
15, // 28: grpc.ModelBaseService.UpsertOne:output_type -> grpc.Response
|
||||
15, // 29: grpc.ModelBaseService.Count:output_type -> grpc.Response
|
||||
15, // [15:30] is the sub-list for method output_type
|
||||
0, // [0:15] 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
|
||||
|
||||
@@ -32,6 +32,7 @@ const (
|
||||
ModelBaseService_ReplaceOne_FullMethodName = "/grpc.ModelBaseService/ReplaceOne"
|
||||
ModelBaseService_InsertOne_FullMethodName = "/grpc.ModelBaseService/InsertOne"
|
||||
ModelBaseService_InsertMany_FullMethodName = "/grpc.ModelBaseService/InsertMany"
|
||||
ModelBaseService_UpsertOne_FullMethodName = "/grpc.ModelBaseService/UpsertOne"
|
||||
ModelBaseService_Count_FullMethodName = "/grpc.ModelBaseService/Count"
|
||||
)
|
||||
|
||||
@@ -52,6 +53,7 @@ type ModelBaseServiceClient interface {
|
||||
ReplaceOne(ctx context.Context, in *ModelServiceReplaceOneRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
InsertOne(ctx context.Context, in *ModelServiceInsertOneRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
InsertMany(ctx context.Context, in *ModelServiceInsertManyRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
UpsertOne(ctx context.Context, in *ModelServiceUpsertOneRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
Count(ctx context.Context, in *ModelServiceCountRequest, opts ...grpc.CallOption) (*Response, error)
|
||||
}
|
||||
|
||||
@@ -193,6 +195,16 @@ func (c *modelBaseServiceClient) InsertMany(ctx context.Context, in *ModelServic
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *modelBaseServiceClient) UpsertOne(ctx context.Context, in *ModelServiceUpsertOneRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
err := c.cc.Invoke(ctx, ModelBaseService_UpsertOne_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *modelBaseServiceClient) Count(ctx context.Context, in *ModelServiceCountRequest, opts ...grpc.CallOption) (*Response, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(Response)
|
||||
@@ -220,6 +232,7 @@ type ModelBaseServiceServer interface {
|
||||
ReplaceOne(context.Context, *ModelServiceReplaceOneRequest) (*Response, error)
|
||||
InsertOne(context.Context, *ModelServiceInsertOneRequest) (*Response, error)
|
||||
InsertMany(context.Context, *ModelServiceInsertManyRequest) (*Response, error)
|
||||
UpsertOne(context.Context, *ModelServiceUpsertOneRequest) (*Response, error)
|
||||
Count(context.Context, *ModelServiceCountRequest) (*Response, error)
|
||||
mustEmbedUnimplementedModelBaseServiceServer()
|
||||
}
|
||||
@@ -267,6 +280,9 @@ func (UnimplementedModelBaseServiceServer) InsertOne(context.Context, *ModelServ
|
||||
func (UnimplementedModelBaseServiceServer) InsertMany(context.Context, *ModelServiceInsertManyRequest) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method InsertMany not implemented")
|
||||
}
|
||||
func (UnimplementedModelBaseServiceServer) UpsertOne(context.Context, *ModelServiceUpsertOneRequest) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpsertOne not implemented")
|
||||
}
|
||||
func (UnimplementedModelBaseServiceServer) Count(context.Context, *ModelServiceCountRequest) (*Response, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Count not implemented")
|
||||
}
|
||||
@@ -517,6 +533,24 @@ func _ModelBaseService_InsertMany_Handler(srv interface{}, ctx context.Context,
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _ModelBaseService_UpsertOne_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ModelServiceUpsertOneRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(ModelBaseServiceServer).UpsertOne(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: ModelBaseService_UpsertOne_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(ModelBaseServiceServer).UpsertOne(ctx, req.(*ModelServiceUpsertOneRequest))
|
||||
}
|
||||
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(ModelServiceCountRequest)
|
||||
if err := dec(in); err != nil {
|
||||
@@ -594,6 +628,10 @@ var ModelBaseService_ServiceDesc = grpc.ServiceDesc{
|
||||
MethodName: "InsertMany",
|
||||
Handler: _ModelBaseService_InsertMany_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UpsertOne",
|
||||
Handler: _ModelBaseService_UpsertOne_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Count",
|
||||
Handler: _ModelBaseService_Count_Handler,
|
||||
|
||||
@@ -895,6 +895,77 @@ func (x *ModelServiceInsertManyRequest) GetModels() []byte {
|
||||
return nil
|
||||
}
|
||||
|
||||
type ModelServiceUpsertOneRequest 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"`
|
||||
ModelType string `protobuf:"bytes,2,opt,name=model_type,json=modelType,proto3" json:"model_type,omitempty"`
|
||||
Query []byte `protobuf:"bytes,3,opt,name=query,proto3" json:"query,omitempty"`
|
||||
Model []byte `protobuf:"bytes,4,opt,name=model,proto3" json:"model,omitempty"`
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) Reset() {
|
||||
*x = ModelServiceUpsertOneRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[13]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ModelServiceUpsertOneRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[13]
|
||||
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 ModelServiceUpsertOneRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ModelServiceUpsertOneRequest) Descriptor() ([]byte, []int) {
|
||||
return file_entity_model_service_request_proto_rawDescGZIP(), []int{13}
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) GetNodeKey() string {
|
||||
if x != nil {
|
||||
return x.NodeKey
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) GetModelType() string {
|
||||
if x != nil {
|
||||
return x.ModelType
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) GetQuery() []byte {
|
||||
if x != nil {
|
||||
return x.Query
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *ModelServiceUpsertOneRequest) GetModel() []byte {
|
||||
if x != nil {
|
||||
return x.Model
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type ModelServiceCountRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
@@ -908,7 +979,7 @@ type ModelServiceCountRequest struct {
|
||||
func (x *ModelServiceCountRequest) Reset() {
|
||||
*x = ModelServiceCountRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[13]
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[14]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
@@ -921,7 +992,7 @@ func (x *ModelServiceCountRequest) String() string {
|
||||
func (*ModelServiceCountRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ModelServiceCountRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[13]
|
||||
mi := &file_entity_model_service_request_proto_msgTypes[14]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
@@ -934,7 +1005,7 @@ func (x *ModelServiceCountRequest) ProtoReflect() protoreflect.Message {
|
||||
|
||||
// Deprecated: Use ModelServiceCountRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ModelServiceCountRequest) Descriptor() ([]byte, []int) {
|
||||
return file_entity_model_service_request_proto_rawDescGZIP(), []int{13}
|
||||
return file_entity_model_service_request_proto_rawDescGZIP(), []int{14}
|
||||
}
|
||||
|
||||
func (x *ModelServiceCountRequest) GetNodeKey() string {
|
||||
@@ -1065,15 +1136,23 @@ var file_entity_model_service_request_proto_rawDesc = []byte{
|
||||
0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16,
|
||||
0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06,
|
||||
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x6a, 0x0a, 0x18, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x75, 0x6e, 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, 0x12, 0x1d, 0x0a,
|
||||
0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05,
|
||||
0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65,
|
||||
0x72, 0x79, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67, 0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72,
|
||||
0x6f, 0x74, 0x6f, 0x33,
|
||||
0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x22, 0x84, 0x01, 0x0a, 0x1c, 0x4d, 0x6f, 0x64, 0x65, 0x6c,
|
||||
0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x55, 0x70, 0x73, 0x65, 0x72, 0x74, 0x4f, 0x6e, 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, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74, 0x79, 0x70, 0x65,
|
||||
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54, 0x79, 0x70,
|
||||
0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c,
|
||||
0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c,
|
||||
0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x22, 0x6a, 0x0a,
|
||||
0x18, 0x4d, 0x6f, 0x64, 0x65, 0x6c, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x43, 0x6f, 0x75,
|
||||
0x6e, 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, 0x12, 0x1d, 0x0a, 0x0a, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x74, 0x79,
|
||||
0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x54,
|
||||
0x79, 0x70, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x03, 0x20, 0x01,
|
||||
0x28, 0x0c, 0x52, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x42, 0x08, 0x5a, 0x06, 0x2e, 0x3b, 0x67,
|
||||
0x72, 0x70, 0x63, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
@@ -1088,7 +1167,7 @@ func file_entity_model_service_request_proto_rawDescGZIP() []byte {
|
||||
return file_entity_model_service_request_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_entity_model_service_request_proto_msgTypes = make([]protoimpl.MessageInfo, 14)
|
||||
var file_entity_model_service_request_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
|
||||
var file_entity_model_service_request_proto_goTypes = []any{
|
||||
(*ModelServiceGetByIdRequest)(nil), // 0: grpc.ModelServiceGetByIdRequest
|
||||
(*ModelServiceGetOneRequest)(nil), // 1: grpc.ModelServiceGetOneRequest
|
||||
@@ -1103,7 +1182,8 @@ var file_entity_model_service_request_proto_goTypes = []any{
|
||||
(*ModelServiceReplaceOneRequest)(nil), // 10: grpc.ModelServiceReplaceOneRequest
|
||||
(*ModelServiceInsertOneRequest)(nil), // 11: grpc.ModelServiceInsertOneRequest
|
||||
(*ModelServiceInsertManyRequest)(nil), // 12: grpc.ModelServiceInsertManyRequest
|
||||
(*ModelServiceCountRequest)(nil), // 13: grpc.ModelServiceCountRequest
|
||||
(*ModelServiceUpsertOneRequest)(nil), // 13: grpc.ModelServiceUpsertOneRequest
|
||||
(*ModelServiceCountRequest)(nil), // 14: grpc.ModelServiceCountRequest
|
||||
}
|
||||
var file_entity_model_service_request_proto_depIdxs = []int32{
|
||||
0, // [0:0] is the sub-list for method output_type
|
||||
@@ -1276,6 +1356,18 @@ func file_entity_model_service_request_proto_init() {
|
||||
}
|
||||
}
|
||||
file_entity_model_service_request_proto_msgTypes[13].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*ModelServiceUpsertOneRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_entity_model_service_request_proto_msgTypes[14].Exporter = func(v any, i int) any {
|
||||
switch v := v.(*ModelServiceCountRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
@@ -1294,7 +1386,7 @@ func file_entity_model_service_request_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_entity_model_service_request_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 14,
|
||||
NumMessages: 15,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
||||
@@ -88,6 +88,13 @@ message ModelServiceInsertManyRequest {
|
||||
bytes models = 3;
|
||||
}
|
||||
|
||||
message ModelServiceUpsertOneRequest {
|
||||
string node_key = 1;
|
||||
string model_type = 2;
|
||||
bytes query = 3;
|
||||
bytes model = 4;
|
||||
}
|
||||
|
||||
message ModelServiceCountRequest {
|
||||
string node_key = 1;
|
||||
string model_type = 2;
|
||||
|
||||
@@ -34,10 +34,8 @@ message DependencyServiceSyncRequest {
|
||||
}
|
||||
|
||||
message DependencyServiceUpdateLogsRequest {
|
||||
string node_key = 1;
|
||||
string lang = 2;
|
||||
string name = 3;
|
||||
repeated string logs = 4;
|
||||
string dependency_id = 1;
|
||||
repeated string logs = 2;
|
||||
}
|
||||
|
||||
service DependencyService {
|
||||
|
||||
@@ -20,5 +20,6 @@ service ModelBaseService {
|
||||
rpc ReplaceOne(ModelServiceReplaceOneRequest) returns (Response){};
|
||||
rpc InsertOne(ModelServiceInsertOneRequest) returns (Response){};
|
||||
rpc InsertMany(ModelServiceInsertManyRequest) returns (Response){};
|
||||
rpc UpsertOne(ModelServiceUpsertOneRequest) returns (Response){};
|
||||
rpc Count(ModelServiceCountRequest) returns (Response){};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user