added rpc

This commit is contained in:
tzwang 2024-09-20 16:36:57 +08:00
parent 151ed1f965
commit 670a2cef72
6 changed files with 584 additions and 291 deletions

View File

@ -59,7 +59,7 @@ GetQueueNames: "/hpc/openapi/v2/queuenames/users/{username}" #查询用户可
GetFileList : "/openapi/v2/file/list"
GetFile: "/openapi/v2/file/download"
UploadFile : "/openapi/v2/file/upload"
ExistFile : "/efile/openapi/v2/file/exist"
ExistFile : "/openapi/v2/file/exist"
# 容器
GetInstanceAi : "/sothisai/api/instance-service"

File diff suppressed because it is too large Load Diff

View File

@ -53,6 +53,7 @@ const (
HpcAC_GetFileList_FullMethodName = "/hpcAC.hpcAC/GetFileList"
HpcAC_GetFile_FullMethodName = "/hpcAC.hpcAC/GetFile"
HpcAC_UploadFile_FullMethodName = "/hpcAC.hpcAC/UploadFile"
HpcAC_IsExistFile_FullMethodName = "/hpcAC.hpcAC/IsExistFile"
HpcAC_GetUserInfo_FullMethodName = "/hpcAC.hpcAC/GetUserInfo"
HpcAC_GetMemberJobs_FullMethodName = "/hpcAC.hpcAC/GetMemberJobs"
HpcAC_GetNodeResources_FullMethodName = "/hpcAC.hpcAC/GetNodeResources"
@ -121,6 +122,7 @@ type HpcACClient interface {
GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error)
GetFile(ctx context.Context, in *GetFileReq, opts ...grpc.CallOption) (*GetFileResp, error)
UploadFile(ctx context.Context, in *UploadFileReq, opts ...grpc.CallOption) (*UploadFileResp, error)
IsExistFile(ctx context.Context, in *IsExistFileReq, opts ...grpc.CallOption) (*IsExistFileResp, error)
// 用户资源
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
GetMemberJobs(ctx context.Context, in *GetMemberJobsReq, opts ...grpc.CallOption) (*GetMemberJobsResp, error)
@ -448,6 +450,15 @@ func (c *hpcACClient) UploadFile(ctx context.Context, in *UploadFileReq, opts ..
return out, nil
}
func (c *hpcACClient) IsExistFile(ctx context.Context, in *IsExistFileReq, opts ...grpc.CallOption) (*IsExistFileResp, error) {
out := new(IsExistFileResp)
err := c.cc.Invoke(ctx, HpcAC_IsExistFile_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *hpcACClient) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) {
out := new(GetUserInfoResp)
err := c.cc.Invoke(ctx, HpcAC_GetUserInfo_FullMethodName, in, out, opts...)
@ -586,6 +597,7 @@ type HpcACServer interface {
GetFileList(context.Context, *GetFileListReq) (*GetFileListResp, error)
GetFile(context.Context, *GetFileReq) (*GetFileResp, error)
UploadFile(context.Context, *UploadFileReq) (*UploadFileResp, error)
IsExistFile(context.Context, *IsExistFileReq) (*IsExistFileResp, error)
// 用户资源
GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error)
GetMemberJobs(context.Context, *GetMemberJobsReq) (*GetMemberJobsResp, error)
@ -706,6 +718,9 @@ func (UnimplementedHpcACServer) GetFile(context.Context, *GetFileReq) (*GetFileR
func (UnimplementedHpcACServer) UploadFile(context.Context, *UploadFileReq) (*UploadFileResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method UploadFile not implemented")
}
func (UnimplementedHpcACServer) IsExistFile(context.Context, *IsExistFileReq) (*IsExistFileResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsExistFile not implemented")
}
func (UnimplementedHpcACServer) GetUserInfo(context.Context, *GetUserInfoReq) (*GetUserInfoResp, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetUserInfo not implemented")
}
@ -1358,6 +1373,24 @@ func _HpcAC_UploadFile_Handler(srv interface{}, ctx context.Context, dec func(in
return interceptor(ctx, in, info, handler)
}
func _HpcAC_IsExistFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(IsExistFileReq)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(HpcACServer).IsExistFile(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: HpcAC_IsExistFile_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(HpcACServer).IsExistFile(ctx, req.(*IsExistFileReq))
}
return interceptor(ctx, in, info, handler)
}
func _HpcAC_GetUserInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetUserInfoReq)
if err := dec(in); err != nil {
@ -1663,6 +1696,10 @@ var HpcAC_ServiceDesc = grpc.ServiceDesc{
MethodName: "UploadFile",
Handler: _HpcAC_UploadFile_Handler,
},
{
MethodName: "IsExistFile",
Handler: _HpcAC_IsExistFile_Handler,
},
{
MethodName: "GetUserInfo",
Handler: _HpcAC_GetUserInfo_Handler,

View File

@ -35,6 +35,7 @@ type (
DeleteJobResp = hpcAC.DeleteJobResp
DeleteTaskAiReq = hpcAC.DeleteTaskAiReq
DeleteTaskAiResp = hpcAC.DeleteTaskAiResp
Exist = hpcAC.Exist
FileContentResp = hpcAC.FileContentResp
FileDataReq = hpcAC.FileDataReq
FileDataResp = hpcAC.FileDataResp
@ -90,6 +91,8 @@ type (
HistoryJobList = hpcAC.HistoryJobList
ImageAI = hpcAC.ImageAI
InstanceService = hpcAC.InstanceService
IsExistFileReq = hpcAC.IsExistFileReq
IsExistFileResp = hpcAC.IsExistFileResp
Job = hpcAC.Job
JobCore = hpcAC.JobCore
JobDetail = hpcAC.JobDetail
@ -198,6 +201,7 @@ type (
GetFileList(ctx context.Context, in *GetFileListReq, opts ...grpc.CallOption) (*GetFileListResp, error)
GetFile(ctx context.Context, in *GetFileReq, opts ...grpc.CallOption) (*GetFileResp, error)
UploadFile(ctx context.Context, in *UploadFileReq, opts ...grpc.CallOption) (*UploadFileResp, error)
IsExistFile(ctx context.Context, in *IsExistFileReq, opts ...grpc.CallOption) (*IsExistFileResp, error)
// 用户资源
GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error)
GetMemberJobs(ctx context.Context, in *GetMemberJobsReq, opts ...grpc.CallOption) (*GetMemberJobsResp, error)
@ -411,6 +415,11 @@ func (m *defaultHpcAC) UploadFile(ctx context.Context, in *UploadFileReq, opts .
return client.UploadFile(ctx, in, opts...)
}
func (m *defaultHpcAC) IsExistFile(ctx context.Context, in *IsExistFileReq, opts ...grpc.CallOption) (*IsExistFileResp, error) {
client := hpcAC.NewHpcACClient(m.cli.Conn())
return client.IsExistFile(ctx, in, opts...)
}
// 用户资源
func (m *defaultHpcAC) GetUserInfo(ctx context.Context, in *GetUserInfoReq, opts ...grpc.CallOption) (*GetUserInfoResp, error) {
client := hpcAC.NewHpcACClient(m.cli.Conn())

View File

@ -0,0 +1,30 @@
package logic
import (
"context"
"gitlink.org.cn/JointCloud/pcm-ac/hpcAC"
"gitlink.org.cn/JointCloud/pcm-ac/internal/svc"
"github.com/zeromicro/go-zero/core/logx"
)
type IsExistFileLogic struct {
ctx context.Context
svcCtx *svc.ServiceContext
logx.Logger
}
func NewIsExistFileLogic(ctx context.Context, svcCtx *svc.ServiceContext) *IsExistFileLogic {
return &IsExistFileLogic{
ctx: ctx,
svcCtx: svcCtx,
Logger: logx.WithContext(ctx),
}
}
func (l *IsExistFileLogic) IsExistFile(in *hpcAC.IsExistFileReq) (*hpcAC.IsExistFileResp, error) {
// todo: add your logic here and delete this line
return &hpcAC.IsExistFileResp{}, nil
}

View File

@ -211,6 +211,11 @@ func (s *HpcACServer) UploadFile(ctx context.Context, in *hpcAC.UploadFileReq) (
return l.UploadFile(in)
}
func (s *HpcACServer) IsExistFile(ctx context.Context, in *hpcAC.IsExistFileReq) (*hpcAC.IsExistFileResp, error) {
l := logic.NewIsExistFileLogic(ctx, s.svcCtx)
return l.IsExistFile(in)
}
// 用户资源
func (s *HpcACServer) GetUserInfo(ctx context.Context, in *hpcAC.GetUserInfoReq) (*hpcAC.GetUserInfoResp, error) {
l := logic.NewGetUserInfoLogic(ctx, s.svcCtx)