diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/ceph/pcm-ceph.pb.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/ceph/pcm-ceph.pb.go index 0c9ccafc..df522a2f 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/ceph/pcm-ceph.pb.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/ceph/pcm-ceph.pb.go @@ -64,8 +64,8 @@ type StorageArg struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StorageScale string `protobuf:"bytes,1,opt,name=storageScale,proto3" json:"storageScale,omitempty"` // @gotags: copier:"storageScale" - ConnectionState string `protobuf:"bytes,2,opt,name=connectionState,proto3" json:"connectionState,omitempty"` // @gotags: copier:"connectionState" + TotalSize int32 `protobuf:"varint,1,opt,name=totalSize,proto3" json:"totalSize,omitempty"` // @gotags: copier:"totalSize" + AiCenterInfos []*AiCenterInfos `protobuf:"bytes,2,rep,name=aiCenterInfos,proto3" json:"aiCenterInfos,omitempty"` // @gotags: copier:"aiCenterInfos" } func (x *StorageArg) Reset() { @@ -100,17 +100,96 @@ func (*StorageArg) Descriptor() ([]byte, []int) { return file_pcm_ceph_proto_rawDescGZIP(), []int{1} } -func (x *StorageArg) GetStorageScale() string { +func (x *StorageArg) GetTotalSize() int32 { + if x != nil { + return x.TotalSize + } + return 0 +} + +func (x *StorageArg) GetAiCenterInfos() []*AiCenterInfos { + if x != nil { + return x.AiCenterInfos + } + return nil +} + +type AiCenterInfos struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + StorageScale int32 `protobuf:"varint,1,opt,name=storageScale,proto3" json:"storageScale,omitempty"` // @gotags: copier:"storageScale" + ConnectionState int32 `protobuf:"varint,2,opt,name=connectionState,proto3" json:"connectionState,omitempty"` // @gotags: copier:"connectionState" + Id string `protobuf:"bytes,3,opt,name=id,proto3" json:"id,omitempty"` // @gotags: copier:"id" + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` // @gotags: copier:"name" + City string `protobuf:"bytes,5,opt,name=city,proto3" json:"city,omitempty"` // @gotags: copier:"city" +} + +func (x *AiCenterInfos) Reset() { + *x = AiCenterInfos{} + if protoimpl.UnsafeEnabled { + mi := &file_pcm_ceph_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *AiCenterInfos) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*AiCenterInfos) ProtoMessage() {} + +func (x *AiCenterInfos) ProtoReflect() protoreflect.Message { + mi := &file_pcm_ceph_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 AiCenterInfos.ProtoReflect.Descriptor instead. +func (*AiCenterInfos) Descriptor() ([]byte, []int) { + return file_pcm_ceph_proto_rawDescGZIP(), []int{2} +} + +func (x *AiCenterInfos) GetStorageScale() int32 { if x != nil { return x.StorageScale } - return "" + return 0 } -func (x *StorageArg) GetConnectionState() string { +func (x *AiCenterInfos) GetConnectionState() int32 { if x != nil { return x.ConnectionState } + return 0 +} + +func (x *AiCenterInfos) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *AiCenterInfos) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *AiCenterInfos) GetCity() string { + if x != nil { + return x.City + } return "" } @@ -119,7 +198,7 @@ type StorageScreenResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - StorageArg *StorageArg `protobuf:"bytes,1,opt,name=storageArg,proto3" json:"storageArg,omitempty"` // @gotags: copier:"Datasets" + StorageArg *StorageArg `protobuf:"bytes,1,opt,name=storageArg,proto3" json:"storageArg,omitempty"` // @gotags: copier:"StorageArg" Code int32 `protobuf:"varint,2,opt,name=code,proto3" json:"code,omitempty"` // @gotags: copier:"Code" Msg string `protobuf:"bytes,3,opt,name=msg,proto3" json:"msg,omitempty"` // @gotags: copier:"Msg" ErrorMsg string `protobuf:"bytes,4,opt,name=error_msg,json=errorMsg,proto3" json:"error_msg,omitempty"` // @gotags: copier:"ErrorMsg" @@ -128,7 +207,7 @@ type StorageScreenResp struct { func (x *StorageScreenResp) Reset() { *x = StorageScreenResp{} if protoimpl.UnsafeEnabled { - mi := &file_pcm_ceph_proto_msgTypes[2] + mi := &file_pcm_ceph_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +220,7 @@ func (x *StorageScreenResp) String() string { func (*StorageScreenResp) ProtoMessage() {} func (x *StorageScreenResp) ProtoReflect() protoreflect.Message { - mi := &file_pcm_ceph_proto_msgTypes[2] + mi := &file_pcm_ceph_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +233,7 @@ func (x *StorageScreenResp) ProtoReflect() protoreflect.Message { // Deprecated: Use StorageScreenResp.ProtoReflect.Descriptor instead. func (*StorageScreenResp) Descriptor() ([]byte, []int) { - return file_pcm_ceph_proto_rawDescGZIP(), []int{2} + return file_pcm_ceph_proto_rawDescGZIP(), []int{3} } func (x *StorageScreenResp) GetStorageArg() *StorageArg { @@ -189,29 +268,40 @@ var File_pcm_ceph_proto protoreflect.FileDescriptor var file_pcm_ceph_proto_rawDesc = []byte{ 0x0a, 0x0e, 0x70, 0x63, 0x6d, 0x2d, 0x63, 0x65, 0x70, 0x68, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x12, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x5a, - 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x12, 0x22, 0x0a, 0x0c, - 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x65, - 0x12, 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, - 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x22, 0x8c, 0x01, 0x0a, 0x11, 0x73, - 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x12, 0x34, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, - 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, - 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, - 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6d, 0x73, 0x67, 0x12, 0x1b, 0x0a, 0x09, - 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, 0x32, 0x50, 0x0a, 0x04, 0x43, 0x65, 0x70, - 0x68, 0x12, 0x48, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, - 0x65, 0x6e, 0x12, 0x1a, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, - 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1b, - 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, - 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x42, 0x07, 0x5a, 0x05, 0x2f, - 0x63, 0x65, 0x70, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x12, 0x08, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x22, 0x12, 0x0a, 0x10, 0x53, 0x74, + 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x22, 0x69, + 0x0a, 0x0a, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x12, 0x1c, 0x0a, 0x09, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x09, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x3d, 0x0a, 0x0d, 0x61, 0x69, + 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, + 0x0b, 0x32, 0x17, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x41, 0x69, 0x43, + 0x65, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x52, 0x0d, 0x61, 0x69, 0x43, 0x65, + 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x95, 0x01, 0x0a, 0x0d, 0x41, 0x69, + 0x43, 0x65, 0x6e, 0x74, 0x65, 0x72, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x73, + 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0c, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x12, + 0x28, 0x0a, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, + 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0f, 0x63, 0x6f, 0x6e, 0x6e, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x63, 0x69, 0x74, 0x79, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x69, 0x74, + 0x79, 0x22, 0x8c, 0x01, 0x0a, 0x11, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, + 0x65, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x34, 0x0a, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, + 0x67, 0x65, 0x41, 0x72, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x74, 0x65, + 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, + 0x67, 0x52, 0x0a, 0x73, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x41, 0x72, 0x67, 0x12, 0x12, 0x0a, + 0x04, 0x63, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, + 0x65, 0x12, 0x10, 0x0a, 0x03, 0x6d, 0x73, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, + 0x6d, 0x73, 0x67, 0x12, 0x1b, 0x0a, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x5f, 0x6d, 0x73, 0x67, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x4d, 0x73, 0x67, + 0x32, 0x50, 0x0a, 0x04, 0x43, 0x65, 0x70, 0x68, 0x12, 0x48, 0x0a, 0x0d, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x12, 0x1a, 0x2e, 0x74, 0x65, 0x6d, 0x70, + 0x6c, 0x61, 0x74, 0x65, 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, + 0x65, 0x6e, 0x52, 0x65, 0x71, 0x1a, 0x1b, 0x2e, 0x74, 0x65, 0x6d, 0x70, 0x6c, 0x61, 0x74, 0x65, + 0x2e, 0x53, 0x74, 0x6f, 0x72, 0x61, 0x67, 0x65, 0x53, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x42, 0x07, 0x5a, 0x05, 0x2f, 0x63, 0x65, 0x70, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -226,21 +316,23 @@ func file_pcm_ceph_proto_rawDescGZIP() []byte { return file_pcm_ceph_proto_rawDescData } -var file_pcm_ceph_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_pcm_ceph_proto_msgTypes = make([]protoimpl.MessageInfo, 4) var file_pcm_ceph_proto_goTypes = []interface{}{ - (*StorageScreenReq)(nil), // 0: template.storageScreenReq + (*StorageScreenReq)(nil), // 0: template.StorageScreenReq (*StorageArg)(nil), // 1: template.StorageArg - (*StorageScreenResp)(nil), // 2: template.storageScreenResp + (*AiCenterInfos)(nil), // 2: template.AiCenterInfos + (*StorageScreenResp)(nil), // 3: template.StorageScreenResp } var file_pcm_ceph_proto_depIdxs = []int32{ - 1, // 0: template.storageScreenResp.storageArg:type_name -> template.StorageArg - 0, // 1: template.Ceph.storageScreen:input_type -> template.storageScreenReq - 2, // 2: template.Ceph.storageScreen:output_type -> template.storageScreenResp - 2, // [2:3] is the sub-list for method output_type - 1, // [1:2] 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 + 2, // 0: template.StorageArg.aiCenterInfos:type_name -> template.AiCenterInfos + 1, // 1: template.StorageScreenResp.storageArg:type_name -> template.StorageArg + 0, // 2: template.Ceph.storageScreen:input_type -> template.StorageScreenReq + 3, // 3: template.Ceph.storageScreen:output_type -> template.StorageScreenResp + 3, // [3:4] is the sub-list for method output_type + 2, // [2:3] 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_pcm_ceph_proto_init() } @@ -274,6 +366,18 @@ func file_pcm_ceph_proto_init() { } } file_pcm_ceph_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*AiCenterInfos); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_pcm_ceph_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*StorageScreenResp); i { case 0: return &v.state @@ -292,7 +396,7 @@ func file_pcm_ceph_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_pcm_ceph_proto_rawDesc, NumEnums: 0, - NumMessages: 3, + NumMessages: 4, NumExtensions: 0, NumServices: 1, }, diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/cephclient/ceph.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/cephclient/ceph.go index 4e83bab5..34302809 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/cephclient/ceph.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/cephclient/ceph.go @@ -13,6 +13,7 @@ import ( ) type ( + AiCenterInfos = ceph.AiCenterInfos StorageArg = ceph.StorageArg StorageScreenReq = ceph.StorageScreenReq StorageScreenResp = ceph.StorageScreenResp diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go index 70d3ed34..38ce5a88 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/logic/storagescreenlogic.go @@ -4,6 +4,7 @@ import ( "PCM/adaptor/PCM-STORAGE/PCM-CEPH/rpc/internal/config" "PCM/common/tool" "context" + "fmt" "k8s.io/apimachinery/pkg/util/json" "strings" @@ -19,6 +20,35 @@ type StorageScreenLogic struct { logx.Logger } +type StorageArg struct { + totalSize int32 + aiCenterInfos []AiCenterInfos +} + +type AiCenterInfos struct { + id string + name string + desc string + resource string + trainJob string + computeScale int32 + storageScale int32 + province string + city string + coordinateX int32 + coordinateY int32 + weight int32 + connectionState int32 + busyState int32 + imageUrl string + accDevices string + marketTime int64 + createdAt int64 + accessTime int32 + cardRunTime int32 + jobCount int32 +} + func NewStorageScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *StorageScreenLogic { return &StorageScreenLogic{ ctx: ctx, @@ -31,15 +61,23 @@ func NewStorageScreenLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Sto func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.StorageScreenResp, error) { // todo: add your logic here and delete this line var resp ceph.StorageScreenResp + var storageArg StorageArg screenConfig := config.Cfg screenUrl := screenConfig.ScreenConfig.ScreenUrl - token := "" - statusCode, body, err := tool.HttpClientWithBodyAndCode(tool.GET, screenUrl, strings.NewReader(``), token) + statusCode, body, err := tool.HttpClientWithScreen(tool.GET, screenUrl+"aicenter?sortBy=weight&orderBy=asc", strings.NewReader(``)) if err != nil { return nil, err } if statusCode == 200 { - json.Unmarshal(body, &resp) + err := json.Unmarshal([]byte(body), &storageArg) + if err == nil { + fmt.Println(storageArg.totalSize) + fmt.Println(storageArg.aiCenterInfos) + } else { + fmt.Println(storageArg.aiCenterInfos) + + } + //json.Unmarshal(body, &resp) resp.Code = 200 resp.Msg = "Success" } else if statusCode != 200 { @@ -47,6 +85,5 @@ func (l *StorageScreenLogic) StorageScreen(in *ceph.StorageScreenReq) (*ceph.Sto resp.Code = 400 resp.Msg = "Failure" } - return &ceph.StorageScreenResp{}, nil } diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pb/pcm-ceph.proto b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pb/pcm-ceph.proto index 2a13ad71..1c4f4a51 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pb/pcm-ceph.proto +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pb/pcm-ceph.proto @@ -4,17 +4,25 @@ package template; option go_package = "/ceph"; /******************auth Start*************************/ -message storageScreenReq{ +message StorageScreenReq{ } message StorageArg{ - string storageScale = 1; // @gotags: copier:"storageScale" - string connectionState = 2; // @gotags: copier:"connectionState" + int32 totalSize = 1; // @gotags: copier:"totalSize" + repeated AiCenterInfos aiCenterInfos = 2; // @gotags: copier:"aiCenterInfos" } -message storageScreenResp{ - StorageArg storageArg =1; // @gotags: copier:"Datasets" +message AiCenterInfos{ + int32 storageScale = 1; // @gotags: copier:"storageScale" + int32 connectionState = 2; // @gotags: copier:"connectionState" + string id = 3; // @gotags: copier:"id" + string name = 4; // @gotags: copier:"name" + string city = 5 ; // @gotags: copier:"city" +} + +message StorageScreenResp{ + StorageArg storageArg =1; // @gotags: copier:"StorageArg" int32 code = 2; // @gotags: copier:"Code" string msg = 3; // @gotags: copier:"Msg" string error_msg =4;// @gotags: copier:"ErrorMsg" @@ -22,5 +30,5 @@ message storageScreenResp{ service Ceph { - rpc storageScreen(storageScreenReq) returns (storageScreenResp); + rpc storageScreen(StorageScreenReq) returns (StorageScreenResp); } \ No newline at end of file diff --git a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pcmceph.go b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pcmceph.go index 57a2ba9c..e971c53f 100644 --- a/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pcmceph.go +++ b/adaptor/PCM-STORAGE/PCM-CEPH/rpc/pcmceph.go @@ -26,7 +26,7 @@ func main() { ctx := svc.NewServiceContext(c) s := zrpc.MustNewServer(c.RpcServerConf, func(grpcServer *grpc.Server) { - ceph.RegisterModelArtsServer(grpcServer, server.NewModelArtsServer(ctx)) + ceph.RegisterCephServer(grpcServer, server.NewCephServer(ctx)) if c.Mode == service.DevMode || c.Mode == service.TestMode { reflection.Register(grpcServer) diff --git a/common/tool/http.go b/common/tool/http.go index e4b58de7..a0dbbb21 100644 --- a/common/tool/http.go +++ b/common/tool/http.go @@ -175,3 +175,17 @@ func HttpClientWithBodyAndCode(method string, url string, payload io.Reader, tok return res.StatusCode, body, err } + +func HttpClientWithScreen(method string, url string, payload io.Reader) (int, []byte, error) { + request, err := http.NewRequest(method, url, payload) + + client := &http.Client{} + res, err := client.Do(request) + if err != nil { + log.Fatal(err) + } + defer res.Body.Close() + body, err := io.ReadAll(res.Body) + + return res.StatusCode, body, err +}