🚚 Rename protobuf

This commit is contained in:
2024-10-21 22:07:36 +08:00
parent 80ad9399a3
commit 87a7eb8f45
31 changed files with 502 additions and 414 deletions

View File

@ -22,7 +22,7 @@ func GetCommandKey(id, method string) string {
func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) error {
method = strings.ToLower(method)
dir := proto.NewCommandControllerClient(v.nexusConn)
dir := proto.NewCommandProviderClient(v.nexusConn)
ctx := context.Background()
ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Info.Id)
@ -53,7 +53,7 @@ func (v *Conn) AddCommand(id, method string, tags []string, fn CommandHandler) e
type localCommandRpcServer struct {
conn *Conn
proto.UnimplementedCommandControllerServer
proto.UnimplementedCommandProviderServer
health.UnimplementedHealthServer
}
@ -137,7 +137,7 @@ func (v localCommandRpcServer) Watch(request *health.HealthCheckRequest, server
func (v *Conn) RunCommands(addr string) error {
v.commandServer = grpc.NewServer()
service := &localCommandRpcServer{conn: v}
proto.RegisterCommandControllerServer(v.commandServer, service)
proto.RegisterCommandProviderServer(v.commandServer, service)
health.RegisterHealthServer(v.commandServer, service)
reflection.Register(v.commandServer)

View File

@ -45,7 +45,7 @@ func NewNexusConn(addr string, info *proto.ServiceInfo) (*Conn, error) {
}
func (v *Conn) RegisterService() error {
dir := proto.NewServiceDirectoryClient(v.nexusConn)
dir := proto.NewDirectoryServiceClient(v.nexusConn)
ctx := context.Background()
ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Info.Id)
_, err := dir.AddService(ctx, v.Info)
@ -91,7 +91,7 @@ func (v *Conn) GetClientGrpcConn(t string) (*grpc.ClientConn, error) {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*5)
defer cancel()
out, err := proto.NewServiceDirectoryClient(v.nexusConn).GetService(ctx, &proto.GetServiceRequest{
out, err := proto.NewDirectoryServiceClient(v.nexusConn).GetService(ctx, &proto.GetServiceRequest{
Type: &t,
})
if err != nil {

View File

@ -13,7 +13,7 @@ func (v *CrudConn) AllocDatabase(name string) (string, error) {
conn := v.Conn.GetNexusGrpcConn()
ctx := context.Background()
ctx = metadata.AppendToOutgoingContext(ctx, "client_id", v.Conn.Info.Id)
out, err := proto.NewDatabaseControllerClient(conn).AllocDatabase(ctx, &proto.AllocDatabaseRequest{
out, err := proto.NewDatabaseServiceClient(conn).AllocDatabase(ctx, &proto.AllocDatabaseRequest{
Name: name,
})
if err != nil || !out.GetIsSuccess() {