From cce2efdf691bf15de7389e0971e99c540fb250b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Wed, 4 Nov 2020 15:51:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ip2region=E5=BA=93=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/rpc/pb/model_file.pb.go | 164 ++++ pkg/rpc/pb/model_file_chunk.pb.go | 146 ++++ pkg/rpc/pb/model_ip_library.pb.go | 179 +++++ pkg/rpc/pb/service_file.pb.go | 425 +++++++++++ pkg/rpc/pb/service_file_chunk.pb.go | 669 ++++++++++++++++ pkg/rpc/pb/service_ip_library.pb.go | 966 ++++++++++++++++++++++++ pkg/rpc/protos/model_file.proto | 10 + pkg/rpc/protos/model_file_chunk.proto | 8 + pkg/rpc/protos/model_ip_library.proto | 14 + pkg/rpc/protos/service_file.proto | 30 + pkg/rpc/protos/service_file_chunk.proto | 46 ++ pkg/rpc/protos/service_ip_library.proto | 67 ++ pkg/serverconfigs/ip_library.go | 23 + 13 files changed, 2747 insertions(+) create mode 100644 pkg/rpc/pb/model_file.pb.go create mode 100644 pkg/rpc/pb/model_file_chunk.pb.go create mode 100644 pkg/rpc/pb/model_ip_library.pb.go create mode 100644 pkg/rpc/pb/service_file.pb.go create mode 100644 pkg/rpc/pb/service_file_chunk.pb.go create mode 100644 pkg/rpc/pb/service_ip_library.pb.go create mode 100644 pkg/rpc/protos/model_file.proto create mode 100644 pkg/rpc/protos/model_file_chunk.proto create mode 100644 pkg/rpc/protos/model_ip_library.proto create mode 100644 pkg/rpc/protos/service_file.proto create mode 100644 pkg/rpc/protos/service_file_chunk.proto create mode 100644 pkg/rpc/protos/service_ip_library.proto create mode 100644 pkg/serverconfigs/ip_library.go diff --git a/pkg/rpc/pb/model_file.pb.go b/pkg/rpc/pb/model_file.pb.go new file mode 100644 index 0000000..f78f24e --- /dev/null +++ b/pkg/rpc/pb/model_file.pb.go @@ -0,0 +1,164 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_file.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type File struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Filename string `protobuf:"bytes,2,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *File) Reset() { + *x = File{} + if protoimpl.UnsafeEnabled { + mi := &file_model_file_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *File) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*File) ProtoMessage() {} + +func (x *File) ProtoReflect() protoreflect.Message { + mi := &file_model_file_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 File.ProtoReflect.Descriptor instead. +func (*File) Descriptor() ([]byte, []int) { + return file_model_file_proto_rawDescGZIP(), []int{0} +} + +func (x *File) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *File) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *File) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +var File_model_file_proto protoreflect.FileDescriptor + +var file_model_file_proto_rawDesc = []byte{ + 0x0a, 0x10, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x46, 0x0a, 0x04, 0x46, 0x69, 0x6c, 0x65, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x1a, + 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, + 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x42, 0x06, + 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_file_proto_rawDescOnce sync.Once + file_model_file_proto_rawDescData = file_model_file_proto_rawDesc +) + +func file_model_file_proto_rawDescGZIP() []byte { + file_model_file_proto_rawDescOnce.Do(func() { + file_model_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_file_proto_rawDescData) + }) + return file_model_file_proto_rawDescData +} + +var file_model_file_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_file_proto_goTypes = []interface{}{ + (*File)(nil), // 0: pb.File +} +var file_model_file_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_model_file_proto_init() } +func file_model_file_proto_init() { + if File_model_file_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*File); 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_model_file_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_file_proto_goTypes, + DependencyIndexes: file_model_file_proto_depIdxs, + MessageInfos: file_model_file_proto_msgTypes, + }.Build() + File_model_file_proto = out.File + file_model_file_proto_rawDesc = nil + file_model_file_proto_goTypes = nil + file_model_file_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/model_file_chunk.pb.go b/pkg/rpc/pb/model_file_chunk.pb.go new file mode 100644 index 0000000..7ba8cc5 --- /dev/null +++ b/pkg/rpc/pb/model_file_chunk.pb.go @@ -0,0 +1,146 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_file_chunk.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type FileChunk struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *FileChunk) Reset() { + *x = FileChunk{} + if protoimpl.UnsafeEnabled { + mi := &file_model_file_chunk_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FileChunk) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FileChunk) ProtoMessage() {} + +func (x *FileChunk) ProtoReflect() protoreflect.Message { + mi := &file_model_file_chunk_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 FileChunk.ProtoReflect.Descriptor instead. +func (*FileChunk) Descriptor() ([]byte, []int) { + return file_model_file_chunk_proto_rawDescGZIP(), []int{0} +} + +func (x *FileChunk) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +var File_model_file_chunk_proto protoreflect.FileDescriptor + +var file_model_file_chunk_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x68, 0x75, + 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x22, 0x1f, 0x0a, 0x09, + 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, + 0x61, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_file_chunk_proto_rawDescOnce sync.Once + file_model_file_chunk_proto_rawDescData = file_model_file_chunk_proto_rawDesc +) + +func file_model_file_chunk_proto_rawDescGZIP() []byte { + file_model_file_chunk_proto_rawDescOnce.Do(func() { + file_model_file_chunk_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_file_chunk_proto_rawDescData) + }) + return file_model_file_chunk_proto_rawDescData +} + +var file_model_file_chunk_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_file_chunk_proto_goTypes = []interface{}{ + (*FileChunk)(nil), // 0: pb.FileChunk +} +var file_model_file_chunk_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_model_file_chunk_proto_init() } +func file_model_file_chunk_proto_init() { + if File_model_file_chunk_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_model_file_chunk_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FileChunk); 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_model_file_chunk_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_file_chunk_proto_goTypes, + DependencyIndexes: file_model_file_chunk_proto_depIdxs, + MessageInfos: file_model_file_chunk_proto_msgTypes, + }.Build() + File_model_file_chunk_proto = out.File + file_model_file_chunk_proto_rawDesc = nil + file_model_file_chunk_proto_goTypes = nil + file_model_file_chunk_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/model_ip_library.pb.go b/pkg/rpc/pb/model_ip_library.pb.go new file mode 100644 index 0000000..74202ee --- /dev/null +++ b/pkg/rpc/pb/model_ip_library.pb.go @@ -0,0 +1,179 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: model_ip_library.proto + +package pb + +import ( + proto "github.com/golang/protobuf/proto" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +type IPLibrary struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + Type string `protobuf:"bytes,2,opt,name=type,proto3" json:"type,omitempty"` + CreatedAt int64 `protobuf:"varint,3,opt,name=createdAt,proto3" json:"createdAt,omitempty"` + File *File `protobuf:"bytes,30,opt,name=file,proto3" json:"file,omitempty"` +} + +func (x *IPLibrary) Reset() { + *x = IPLibrary{} + if protoimpl.UnsafeEnabled { + mi := &file_model_ip_library_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *IPLibrary) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*IPLibrary) ProtoMessage() {} + +func (x *IPLibrary) ProtoReflect() protoreflect.Message { + mi := &file_model_ip_library_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 IPLibrary.ProtoReflect.Descriptor instead. +func (*IPLibrary) Descriptor() ([]byte, []int) { + return file_model_ip_library_proto_rawDescGZIP(), []int{0} +} + +func (x *IPLibrary) GetId() int64 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *IPLibrary) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *IPLibrary) GetCreatedAt() int64 { + if x != nil { + return x.CreatedAt + } + return 0 +} + +func (x *IPLibrary) GetFile() *File { + if x != nil { + return x.File + } + return nil +} + +var File_model_ip_library_proto protoreflect.FileDescriptor + +var file_model_ip_library_proto_rawDesc = []byte{ + 0x0a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x70, 0x5f, 0x6c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x10, 0x6d, 0x6f, + 0x64, 0x65, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x6b, + 0x0a, 0x09, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x69, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x79, 0x70, 0x65, 0x12, + 0x1c, 0x0a, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x41, 0x74, 0x12, 0x1c, 0x0a, + 0x04, 0x66, 0x69, 0x6c, 0x65, 0x18, 0x1e, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x04, 0x66, 0x69, 0x6c, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, + 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_model_ip_library_proto_rawDescOnce sync.Once + file_model_ip_library_proto_rawDescData = file_model_ip_library_proto_rawDesc +) + +func file_model_ip_library_proto_rawDescGZIP() []byte { + file_model_ip_library_proto_rawDescOnce.Do(func() { + file_model_ip_library_proto_rawDescData = protoimpl.X.CompressGZIP(file_model_ip_library_proto_rawDescData) + }) + return file_model_ip_library_proto_rawDescData +} + +var file_model_ip_library_proto_msgTypes = make([]protoimpl.MessageInfo, 1) +var file_model_ip_library_proto_goTypes = []interface{}{ + (*IPLibrary)(nil), // 0: pb.IPLibrary + (*File)(nil), // 1: pb.File +} +var file_model_ip_library_proto_depIdxs = []int32{ + 1, // 0: pb.IPLibrary.file:type_name -> pb.File + 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_model_ip_library_proto_init() } +func file_model_ip_library_proto_init() { + if File_model_ip_library_proto != nil { + return + } + file_model_file_proto_init() + if !protoimpl.UnsafeEnabled { + file_model_ip_library_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*IPLibrary); 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_model_ip_library_proto_rawDesc, + NumEnums: 0, + NumMessages: 1, + NumExtensions: 0, + NumServices: 0, + }, + GoTypes: file_model_ip_library_proto_goTypes, + DependencyIndexes: file_model_ip_library_proto_depIdxs, + MessageInfos: file_model_ip_library_proto_msgTypes, + }.Build() + File_model_ip_library_proto = out.File + file_model_ip_library_proto_rawDesc = nil + file_model_ip_library_proto_goTypes = nil + file_model_ip_library_proto_depIdxs = nil +} diff --git a/pkg/rpc/pb/service_file.pb.go b/pkg/rpc/pb/service_file.pb.go new file mode 100644 index 0000000..804df9f --- /dev/null +++ b/pkg/rpc/pb/service_file.pb.go @@ -0,0 +1,425 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_file.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 创建文件 +type CreateFileRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Filename string `protobuf:"bytes,1,opt,name=filename,proto3" json:"filename,omitempty"` + Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"` +} + +func (x *CreateFileRequest) Reset() { + *x = CreateFileRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateFileRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFileRequest) ProtoMessage() {} + +func (x *CreateFileRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_file_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 CreateFileRequest.ProtoReflect.Descriptor instead. +func (*CreateFileRequest) Descriptor() ([]byte, []int) { + return file_service_file_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateFileRequest) GetFilename() string { + if x != nil { + return x.Filename + } + return "" +} + +func (x *CreateFileRequest) GetSize() int64 { + if x != nil { + return x.Size + } + return 0 +} + +type CreateFileResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileId int64 `protobuf:"varint,1,opt,name=fileId,proto3" json:"fileId,omitempty"` +} + +func (x *CreateFileResponse) Reset() { + *x = CreateFileResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateFileResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFileResponse) ProtoMessage() {} + +func (x *CreateFileResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_file_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 CreateFileResponse.ProtoReflect.Descriptor instead. +func (*CreateFileResponse) Descriptor() ([]byte, []int) { + return file_service_file_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateFileResponse) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +// 将文件置为已完成 +type UpdateFileFinishedRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileId int64 `protobuf:"varint,1,opt,name=fileId,proto3" json:"fileId,omitempty"` +} + +func (x *UpdateFileFinishedRequest) Reset() { + *x = UpdateFileFinishedRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateFileFinishedRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateFileFinishedRequest) ProtoMessage() {} + +func (x *UpdateFileFinishedRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_file_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 UpdateFileFinishedRequest.ProtoReflect.Descriptor instead. +func (*UpdateFileFinishedRequest) Descriptor() ([]byte, []int) { + return file_service_file_proto_rawDescGZIP(), []int{2} +} + +func (x *UpdateFileFinishedRequest) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +var File_service_file_proto protoreflect.FileDescriptor + +var file_service_file_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, + 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x43, 0x0a, 0x11, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x04, 0x73, 0x69, 0x7a, + 0x65, 0x22, 0x2c, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x22, + 0x33, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x46, 0x69, 0x6e, + 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, + 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, + 0x6c, 0x65, 0x49, 0x64, 0x32, 0x95, 0x01, 0x0a, 0x0b, 0x46, 0x69, 0x6c, 0x65, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x3b, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x12, 0x15, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x70, 0x62, 0x2e, 0x43, + 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x49, 0x0a, 0x12, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x46, + 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x12, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x46, 0x69, 0x6e, 0x69, 0x73, 0x68, 0x65, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_file_proto_rawDescOnce sync.Once + file_service_file_proto_rawDescData = file_service_file_proto_rawDesc +) + +func file_service_file_proto_rawDescGZIP() []byte { + file_service_file_proto_rawDescOnce.Do(func() { + file_service_file_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_file_proto_rawDescData) + }) + return file_service_file_proto_rawDescData +} + +var file_service_file_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_service_file_proto_goTypes = []interface{}{ + (*CreateFileRequest)(nil), // 0: pb.CreateFileRequest + (*CreateFileResponse)(nil), // 1: pb.CreateFileResponse + (*UpdateFileFinishedRequest)(nil), // 2: pb.UpdateFileFinishedRequest + (*RPCUpdateSuccess)(nil), // 3: pb.RPCUpdateSuccess +} +var file_service_file_proto_depIdxs = []int32{ + 0, // 0: pb.FileService.createFile:input_type -> pb.CreateFileRequest + 2, // 1: pb.FileService.updateFileFinished:input_type -> pb.UpdateFileFinishedRequest + 1, // 2: pb.FileService.createFile:output_type -> pb.CreateFileResponse + 3, // 3: pb.FileService.updateFileFinished:output_type -> pb.RPCUpdateSuccess + 2, // [2:4] is the sub-list for method output_type + 0, // [0:2] 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_service_file_proto_init() } +func file_service_file_proto_init() { + if File_service_file_proto != nil { + return + } + file_rpc_messages_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateFileRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateFileResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateFileFinishedRequest); 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_service_file_proto_rawDesc, + NumEnums: 0, + NumMessages: 3, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_file_proto_goTypes, + DependencyIndexes: file_service_file_proto_depIdxs, + MessageInfos: file_service_file_proto_msgTypes, + }.Build() + File_service_file_proto = out.File + file_service_file_proto_rawDesc = nil + file_service_file_proto_goTypes = nil + file_service_file_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// FileServiceClient is the client API for FileService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type FileServiceClient interface { + // 创建文件 + CreateFile(ctx context.Context, in *CreateFileRequest, opts ...grpc.CallOption) (*CreateFileResponse, error) + // 将文件置为已完成 + UpdateFileFinished(ctx context.Context, in *UpdateFileFinishedRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) +} + +type fileServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient { + return &fileServiceClient{cc} +} + +func (c *fileServiceClient) CreateFile(ctx context.Context, in *CreateFileRequest, opts ...grpc.CallOption) (*CreateFileResponse, error) { + out := new(CreateFileResponse) + err := c.cc.Invoke(ctx, "/pb.FileService/createFile", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileServiceClient) UpdateFileFinished(ctx context.Context, in *UpdateFileFinishedRequest, opts ...grpc.CallOption) (*RPCUpdateSuccess, error) { + out := new(RPCUpdateSuccess) + err := c.cc.Invoke(ctx, "/pb.FileService/updateFileFinished", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileServiceServer is the server API for FileService service. +type FileServiceServer interface { + // 创建文件 + CreateFile(context.Context, *CreateFileRequest) (*CreateFileResponse, error) + // 将文件置为已完成 + UpdateFileFinished(context.Context, *UpdateFileFinishedRequest) (*RPCUpdateSuccess, error) +} + +// UnimplementedFileServiceServer can be embedded to have forward compatible implementations. +type UnimplementedFileServiceServer struct { +} + +func (*UnimplementedFileServiceServer) CreateFile(context.Context, *CreateFileRequest) (*CreateFileResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFile not implemented") +} +func (*UnimplementedFileServiceServer) UpdateFileFinished(context.Context, *UpdateFileFinishedRequest) (*RPCUpdateSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateFileFinished not implemented") +} + +func RegisterFileServiceServer(s *grpc.Server, srv FileServiceServer) { + s.RegisterService(&_FileService_serviceDesc, srv) +} + +func _FileService_CreateFile_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateFileRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServiceServer).CreateFile(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.FileService/CreateFile", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServiceServer).CreateFile(ctx, req.(*CreateFileRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FileService_UpdateFileFinished_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateFileFinishedRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileServiceServer).UpdateFileFinished(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.FileService/UpdateFileFinished", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileServiceServer).UpdateFileFinished(ctx, req.(*UpdateFileFinishedRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _FileService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.FileService", + HandlerType: (*FileServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createFile", + Handler: _FileService_CreateFile_Handler, + }, + { + MethodName: "updateFileFinished", + Handler: _FileService_UpdateFileFinished_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_file.proto", +} diff --git a/pkg/rpc/pb/service_file_chunk.pb.go b/pkg/rpc/pb/service_file_chunk.pb.go new file mode 100644 index 0000000..9a8b062 --- /dev/null +++ b/pkg/rpc/pb/service_file_chunk.pb.go @@ -0,0 +1,669 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_file_chunk.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 创建文件片段 +type CreateFileChunkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileId int64 `protobuf:"varint,1,opt,name=fileId,proto3" json:"fileId,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` +} + +func (x *CreateFileChunkRequest) Reset() { + *x = CreateFileChunkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateFileChunkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFileChunkRequest) ProtoMessage() {} + +func (x *CreateFileChunkRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_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 CreateFileChunkRequest.ProtoReflect.Descriptor instead. +func (*CreateFileChunkRequest) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateFileChunkRequest) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +func (x *CreateFileChunkRequest) GetData() []byte { + if x != nil { + return x.Data + } + return nil +} + +type CreateFileChunkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileChunkId int64 `protobuf:"varint,1,opt,name=fileChunkId,proto3" json:"fileChunkId,omitempty"` +} + +func (x *CreateFileChunkResponse) Reset() { + *x = CreateFileChunkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateFileChunkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateFileChunkResponse) ProtoMessage() {} + +func (x *CreateFileChunkResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_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 CreateFileChunkResponse.ProtoReflect.Descriptor instead. +func (*CreateFileChunkResponse) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateFileChunkResponse) GetFileChunkId() int64 { + if x != nil { + return x.FileChunkId + } + return 0 +} + +// 获取的一个文件的所有片段IDs +type FindAllFileChunkIdsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileId int64 `protobuf:"varint,1,opt,name=fileId,proto3" json:"fileId,omitempty"` +} + +func (x *FindAllFileChunkIdsRequest) Reset() { + *x = FindAllFileChunkIdsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllFileChunkIdsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllFileChunkIdsRequest) ProtoMessage() {} + +func (x *FindAllFileChunkIdsRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_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 FindAllFileChunkIdsRequest.ProtoReflect.Descriptor instead. +func (*FindAllFileChunkIdsRequest) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{2} +} + +func (x *FindAllFileChunkIdsRequest) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +type FindAllFileChunkIdsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileChunkIds []int64 `protobuf:"varint,1,rep,packed,name=fileChunkIds,proto3" json:"fileChunkIds,omitempty"` +} + +func (x *FindAllFileChunkIdsResponse) Reset() { + *x = FindAllFileChunkIdsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllFileChunkIdsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllFileChunkIdsResponse) ProtoMessage() {} + +func (x *FindAllFileChunkIdsResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_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 FindAllFileChunkIdsResponse.ProtoReflect.Descriptor instead. +func (*FindAllFileChunkIdsResponse) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{3} +} + +func (x *FindAllFileChunkIdsResponse) GetFileChunkIds() []int64 { + if x != nil { + return x.FileChunkIds + } + return nil +} + +// 下载文件片段 +type DownloadFileChunkRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileChunkId int64 `protobuf:"varint,1,opt,name=fileChunkId,proto3" json:"fileChunkId,omitempty"` +} + +func (x *DownloadFileChunkRequest) Reset() { + *x = DownloadFileChunkRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadFileChunkRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadFileChunkRequest) ProtoMessage() {} + +func (x *DownloadFileChunkRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_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 DownloadFileChunkRequest.ProtoReflect.Descriptor instead. +func (*DownloadFileChunkRequest) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{4} +} + +func (x *DownloadFileChunkRequest) GetFileChunkId() int64 { + if x != nil { + return x.FileChunkId + } + return 0 +} + +type DownloadFileChunkResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + FileChunk *FileChunk `protobuf:"bytes,1,opt,name=fileChunk,proto3" json:"fileChunk,omitempty"` +} + +func (x *DownloadFileChunkResponse) Reset() { + *x = DownloadFileChunkResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_file_chunk_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DownloadFileChunkResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DownloadFileChunkResponse) ProtoMessage() {} + +func (x *DownloadFileChunkResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_file_chunk_proto_msgTypes[5] + 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 DownloadFileChunkResponse.ProtoReflect.Descriptor instead. +func (*DownloadFileChunkResponse) Descriptor() ([]byte, []int) { + return file_service_file_chunk_proto_rawDescGZIP(), []int{5} +} + +func (x *DownloadFileChunkResponse) GetFileChunk() *FileChunk { + if x != nil { + return x.FileChunk + } + return nil +} + +var File_service_file_chunk_proto protoreflect.FileDescriptor + +var file_service_file_chunk_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x16, + 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, + 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x22, 0x3b, 0x0a, 0x17, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x43, + 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x66, 0x69, + 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x22, 0x34, 0x0a, 0x1a, 0x46, 0x69, 0x6e, + 0x64, 0x41, 0x6c, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, 0x22, + 0x41, 0x0a, 0x1b, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, + 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, + 0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x73, 0x18, 0x01, + 0x20, 0x03, 0x28, 0x03, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, + 0x64, 0x73, 0x22, 0x3c, 0x0a, 0x18, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, + 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, + 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, + 0x22, 0x48, 0x0a, 0x19, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, + 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, + 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, + 0x09, 0x66, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x32, 0x88, 0x02, 0x0a, 0x10, 0x46, + 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, + 0x4a, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, + 0x6e, 0x6b, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, + 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, + 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, + 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x56, 0x0a, 0x13, 0x66, + 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, + 0x64, 0x73, 0x12, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x46, + 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x46, + 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x49, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x11, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, + 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x12, 0x1c, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x6f, + 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x6f, 0x77, 0x6e, + 0x6c, 0x6f, 0x61, 0x64, 0x46, 0x69, 0x6c, 0x65, 0x43, 0x68, 0x75, 0x6e, 0x6b, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_file_chunk_proto_rawDescOnce sync.Once + file_service_file_chunk_proto_rawDescData = file_service_file_chunk_proto_rawDesc +) + +func file_service_file_chunk_proto_rawDescGZIP() []byte { + file_service_file_chunk_proto_rawDescOnce.Do(func() { + file_service_file_chunk_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_file_chunk_proto_rawDescData) + }) + return file_service_file_chunk_proto_rawDescData +} + +var file_service_file_chunk_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_service_file_chunk_proto_goTypes = []interface{}{ + (*CreateFileChunkRequest)(nil), // 0: pb.CreateFileChunkRequest + (*CreateFileChunkResponse)(nil), // 1: pb.CreateFileChunkResponse + (*FindAllFileChunkIdsRequest)(nil), // 2: pb.FindAllFileChunkIdsRequest + (*FindAllFileChunkIdsResponse)(nil), // 3: pb.FindAllFileChunkIdsResponse + (*DownloadFileChunkRequest)(nil), // 4: pb.DownloadFileChunkRequest + (*DownloadFileChunkResponse)(nil), // 5: pb.DownloadFileChunkResponse + (*FileChunk)(nil), // 6: pb.FileChunk +} +var file_service_file_chunk_proto_depIdxs = []int32{ + 6, // 0: pb.DownloadFileChunkResponse.fileChunk:type_name -> pb.FileChunk + 0, // 1: pb.FileChunkService.createFileChunk:input_type -> pb.CreateFileChunkRequest + 2, // 2: pb.FileChunkService.findAllFileChunkIds:input_type -> pb.FindAllFileChunkIdsRequest + 4, // 3: pb.FileChunkService.downloadFileChunk:input_type -> pb.DownloadFileChunkRequest + 1, // 4: pb.FileChunkService.createFileChunk:output_type -> pb.CreateFileChunkResponse + 3, // 5: pb.FileChunkService.findAllFileChunkIds:output_type -> pb.FindAllFileChunkIdsResponse + 5, // 6: pb.FileChunkService.downloadFileChunk:output_type -> pb.DownloadFileChunkResponse + 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_service_file_chunk_proto_init() } +func file_service_file_chunk_proto_init() { + if File_service_file_chunk_proto != nil { + return + } + file_model_file_chunk_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_file_chunk_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateFileChunkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_chunk_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateFileChunkResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_chunk_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllFileChunkIdsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_chunk_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllFileChunkIdsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_chunk_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadFileChunkRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_file_chunk_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DownloadFileChunkResponse); 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_service_file_chunk_proto_rawDesc, + NumEnums: 0, + NumMessages: 6, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_file_chunk_proto_goTypes, + DependencyIndexes: file_service_file_chunk_proto_depIdxs, + MessageInfos: file_service_file_chunk_proto_msgTypes, + }.Build() + File_service_file_chunk_proto = out.File + file_service_file_chunk_proto_rawDesc = nil + file_service_file_chunk_proto_goTypes = nil + file_service_file_chunk_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// FileChunkServiceClient is the client API for FileChunkService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type FileChunkServiceClient interface { + // 创建文件片段 + CreateFileChunk(ctx context.Context, in *CreateFileChunkRequest, opts ...grpc.CallOption) (*CreateFileChunkResponse, error) + // 获取的一个文件的所有片段IDs + FindAllFileChunkIds(ctx context.Context, in *FindAllFileChunkIdsRequest, opts ...grpc.CallOption) (*FindAllFileChunkIdsResponse, error) + // 下载文件片段 + DownloadFileChunk(ctx context.Context, in *DownloadFileChunkRequest, opts ...grpc.CallOption) (*DownloadFileChunkResponse, error) +} + +type fileChunkServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewFileChunkServiceClient(cc grpc.ClientConnInterface) FileChunkServiceClient { + return &fileChunkServiceClient{cc} +} + +func (c *fileChunkServiceClient) CreateFileChunk(ctx context.Context, in *CreateFileChunkRequest, opts ...grpc.CallOption) (*CreateFileChunkResponse, error) { + out := new(CreateFileChunkResponse) + err := c.cc.Invoke(ctx, "/pb.FileChunkService/createFileChunk", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileChunkServiceClient) FindAllFileChunkIds(ctx context.Context, in *FindAllFileChunkIdsRequest, opts ...grpc.CallOption) (*FindAllFileChunkIdsResponse, error) { + out := new(FindAllFileChunkIdsResponse) + err := c.cc.Invoke(ctx, "/pb.FileChunkService/findAllFileChunkIds", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *fileChunkServiceClient) DownloadFileChunk(ctx context.Context, in *DownloadFileChunkRequest, opts ...grpc.CallOption) (*DownloadFileChunkResponse, error) { + out := new(DownloadFileChunkResponse) + err := c.cc.Invoke(ctx, "/pb.FileChunkService/downloadFileChunk", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// FileChunkServiceServer is the server API for FileChunkService service. +type FileChunkServiceServer interface { + // 创建文件片段 + CreateFileChunk(context.Context, *CreateFileChunkRequest) (*CreateFileChunkResponse, error) + // 获取的一个文件的所有片段IDs + FindAllFileChunkIds(context.Context, *FindAllFileChunkIdsRequest) (*FindAllFileChunkIdsResponse, error) + // 下载文件片段 + DownloadFileChunk(context.Context, *DownloadFileChunkRequest) (*DownloadFileChunkResponse, error) +} + +// UnimplementedFileChunkServiceServer can be embedded to have forward compatible implementations. +type UnimplementedFileChunkServiceServer struct { +} + +func (*UnimplementedFileChunkServiceServer) CreateFileChunk(context.Context, *CreateFileChunkRequest) (*CreateFileChunkResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateFileChunk not implemented") +} +func (*UnimplementedFileChunkServiceServer) FindAllFileChunkIds(context.Context, *FindAllFileChunkIdsRequest) (*FindAllFileChunkIdsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllFileChunkIds not implemented") +} +func (*UnimplementedFileChunkServiceServer) DownloadFileChunk(context.Context, *DownloadFileChunkRequest) (*DownloadFileChunkResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DownloadFileChunk not implemented") +} + +func RegisterFileChunkServiceServer(s *grpc.Server, srv FileChunkServiceServer) { + s.RegisterService(&_FileChunkService_serviceDesc, srv) +} + +func _FileChunkService_CreateFileChunk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateFileChunkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileChunkServiceServer).CreateFileChunk(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.FileChunkService/CreateFileChunk", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileChunkServiceServer).CreateFileChunk(ctx, req.(*CreateFileChunkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FileChunkService_FindAllFileChunkIds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllFileChunkIdsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileChunkServiceServer).FindAllFileChunkIds(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.FileChunkService/FindAllFileChunkIds", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileChunkServiceServer).FindAllFileChunkIds(ctx, req.(*FindAllFileChunkIdsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _FileChunkService_DownloadFileChunk_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DownloadFileChunkRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(FileChunkServiceServer).DownloadFileChunk(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.FileChunkService/DownloadFileChunk", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(FileChunkServiceServer).DownloadFileChunk(ctx, req.(*DownloadFileChunkRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _FileChunkService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.FileChunkService", + HandlerType: (*FileChunkServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createFileChunk", + Handler: _FileChunkService_CreateFileChunk_Handler, + }, + { + MethodName: "findAllFileChunkIds", + Handler: _FileChunkService_FindAllFileChunkIds_Handler, + }, + { + MethodName: "downloadFileChunk", + Handler: _FileChunkService_DownloadFileChunk_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_file_chunk.proto", +} diff --git a/pkg/rpc/pb/service_ip_library.pb.go b/pkg/rpc/pb/service_ip_library.pb.go new file mode 100644 index 0000000..0d3419c --- /dev/null +++ b/pkg/rpc/pb/service_ip_library.pb.go @@ -0,0 +1,966 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.25.0 +// protoc v3.12.3 +// source: service_ip_library.proto + +package pb + +import ( + context "context" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + 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) +) + +// This is a compile-time assertion that a sufficiently up-to-date version +// of the legacy proto package is being used. +const _ = proto.ProtoPackageIsVersion4 + +// 创建IP库 +type CreateIPLibraryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + FileId int64 `protobuf:"varint,3,opt,name=fileId,proto3" json:"fileId,omitempty"` +} + +func (x *CreateIPLibraryRequest) Reset() { + *x = CreateIPLibraryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateIPLibraryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateIPLibraryRequest) ProtoMessage() {} + +func (x *CreateIPLibraryRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_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 CreateIPLibraryRequest.ProtoReflect.Descriptor instead. +func (*CreateIPLibraryRequest) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{0} +} + +func (x *CreateIPLibraryRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +func (x *CreateIPLibraryRequest) GetFileId() int64 { + if x != nil { + return x.FileId + } + return 0 +} + +type CreateIPLibraryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibraryId int64 `protobuf:"varint,1,opt,name=ipLibraryId,proto3" json:"ipLibraryId,omitempty"` +} + +func (x *CreateIPLibraryResponse) Reset() { + *x = CreateIPLibraryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateIPLibraryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateIPLibraryResponse) ProtoMessage() {} + +func (x *CreateIPLibraryResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_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 CreateIPLibraryResponse.ProtoReflect.Descriptor instead. +func (*CreateIPLibraryResponse) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{1} +} + +func (x *CreateIPLibraryResponse) GetIpLibraryId() int64 { + if x != nil { + return x.IpLibraryId + } + return 0 +} + +// 查找单个IP库 +type FindEnabledIPLibraryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibraryId int64 `protobuf:"varint,1,opt,name=ipLibraryId,proto3" json:"ipLibraryId,omitempty"` +} + +func (x *FindEnabledIPLibraryRequest) Reset() { + *x = FindEnabledIPLibraryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledIPLibraryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledIPLibraryRequest) ProtoMessage() {} + +func (x *FindEnabledIPLibraryRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_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 FindEnabledIPLibraryRequest.ProtoReflect.Descriptor instead. +func (*FindEnabledIPLibraryRequest) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{2} +} + +func (x *FindEnabledIPLibraryRequest) GetIpLibraryId() int64 { + if x != nil { + return x.IpLibraryId + } + return 0 +} + +type FindEnabledIPLibraryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibrary *IPLibrary `protobuf:"bytes,1,opt,name=ipLibrary,proto3" json:"ipLibrary,omitempty"` +} + +func (x *FindEnabledIPLibraryResponse) Reset() { + *x = FindEnabledIPLibraryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindEnabledIPLibraryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindEnabledIPLibraryResponse) ProtoMessage() {} + +func (x *FindEnabledIPLibraryResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_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 FindEnabledIPLibraryResponse.ProtoReflect.Descriptor instead. +func (*FindEnabledIPLibraryResponse) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{3} +} + +func (x *FindEnabledIPLibraryResponse) GetIpLibrary() *IPLibrary { + if x != nil { + return x.IpLibrary + } + return nil +} + +// 查找最新的IP库 +type FindLatestIPLibraryWithTypeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *FindLatestIPLibraryWithTypeRequest) Reset() { + *x = FindLatestIPLibraryWithTypeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindLatestIPLibraryWithTypeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindLatestIPLibraryWithTypeRequest) ProtoMessage() {} + +func (x *FindLatestIPLibraryWithTypeRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_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 FindLatestIPLibraryWithTypeRequest.ProtoReflect.Descriptor instead. +func (*FindLatestIPLibraryWithTypeRequest) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{4} +} + +func (x *FindLatestIPLibraryWithTypeRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type FindLatestIPLibraryWithTypeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibrary *IPLibrary `protobuf:"bytes,1,opt,name=ipLibrary,proto3" json:"ipLibrary,omitempty"` +} + +func (x *FindLatestIPLibraryWithTypeResponse) Reset() { + *x = FindLatestIPLibraryWithTypeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindLatestIPLibraryWithTypeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindLatestIPLibraryWithTypeResponse) ProtoMessage() {} + +func (x *FindLatestIPLibraryWithTypeResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_proto_msgTypes[5] + 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 FindLatestIPLibraryWithTypeResponse.ProtoReflect.Descriptor instead. +func (*FindLatestIPLibraryWithTypeResponse) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{5} +} + +func (x *FindLatestIPLibraryWithTypeResponse) GetIpLibrary() *IPLibrary { + if x != nil { + return x.IpLibrary + } + return nil +} + +// 列出某个类型的所有IP库 +type FindAllEnabledIPLibrariesWithTypeRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` +} + +func (x *FindAllEnabledIPLibrariesWithTypeRequest) Reset() { + *x = FindAllEnabledIPLibrariesWithTypeRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledIPLibrariesWithTypeRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledIPLibrariesWithTypeRequest) ProtoMessage() {} + +func (x *FindAllEnabledIPLibrariesWithTypeRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_proto_msgTypes[6] + 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 FindAllEnabledIPLibrariesWithTypeRequest.ProtoReflect.Descriptor instead. +func (*FindAllEnabledIPLibrariesWithTypeRequest) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{6} +} + +func (x *FindAllEnabledIPLibrariesWithTypeRequest) GetType() string { + if x != nil { + return x.Type + } + return "" +} + +type FindAllEnabledIPLibrariesWithTypeResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibraries []*IPLibrary `protobuf:"bytes,1,rep,name=ipLibraries,proto3" json:"ipLibraries,omitempty"` +} + +func (x *FindAllEnabledIPLibrariesWithTypeResponse) Reset() { + *x = FindAllEnabledIPLibrariesWithTypeResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *FindAllEnabledIPLibrariesWithTypeResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*FindAllEnabledIPLibrariesWithTypeResponse) ProtoMessage() {} + +func (x *FindAllEnabledIPLibrariesWithTypeResponse) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_proto_msgTypes[7] + 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 FindAllEnabledIPLibrariesWithTypeResponse.ProtoReflect.Descriptor instead. +func (*FindAllEnabledIPLibrariesWithTypeResponse) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{7} +} + +func (x *FindAllEnabledIPLibrariesWithTypeResponse) GetIpLibraries() []*IPLibrary { + if x != nil { + return x.IpLibraries + } + return nil +} + +// 删除IP库 +type DeleteIPLibraryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + IpLibraryId int64 `protobuf:"varint,1,opt,name=ipLibraryId,proto3" json:"ipLibraryId,omitempty"` +} + +func (x *DeleteIPLibraryRequest) Reset() { + *x = DeleteIPLibraryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_service_ip_library_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteIPLibraryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteIPLibraryRequest) ProtoMessage() {} + +func (x *DeleteIPLibraryRequest) ProtoReflect() protoreflect.Message { + mi := &file_service_ip_library_proto_msgTypes[8] + 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 DeleteIPLibraryRequest.ProtoReflect.Descriptor instead. +func (*DeleteIPLibraryRequest) Descriptor() ([]byte, []int) { + return file_service_ip_library_proto_rawDescGZIP(), []int{8} +} + +func (x *DeleteIPLibraryRequest) GetIpLibraryId() int64 { + if x != nil { + return x.IpLibraryId + } + return 0 +} + +var File_service_ip_library_proto protoreflect.FileDescriptor + +var file_service_ip_library_proto_rawDesc = []byte{ + 0x0a, 0x18, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x5f, 0x69, 0x70, 0x5f, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x02, 0x70, 0x62, 0x1a, 0x12, + 0x72, 0x70, 0x63, 0x5f, 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x1a, 0x16, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x5f, 0x69, 0x70, 0x5f, 0x6c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x44, 0x0a, 0x16, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 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, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x6c, 0x65, + 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x64, + 0x22, 0x3b, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x69, + 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, + 0x52, 0x0b, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x22, 0x3f, 0x0a, + 0x1b, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x0b, + 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x03, 0x52, 0x0b, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, 0x22, 0x4b, + 0x0a, 0x1c, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, + 0x0a, 0x09, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x09, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x22, 0x38, 0x0a, 0x22, 0x46, + 0x69, 0x6e, 0x64, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x79, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 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, 0x22, 0x52, 0x0a, 0x23, 0x46, 0x69, 0x6e, 0x64, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x57, 0x69, 0x74, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2b, 0x0a, 0x09, + 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x0d, 0x2e, 0x70, 0x62, 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x09, + 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x22, 0x3e, 0x0a, 0x28, 0x46, 0x69, 0x6e, + 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 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, 0x22, 0x5c, 0x0a, 0x29, 0x46, 0x69, 0x6e, + 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2f, 0x0a, 0x0b, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, + 0x61, 0x72, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x70, 0x62, + 0x2e, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x0b, 0x69, 0x70, 0x4c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x22, 0x3a, 0x0a, 0x16, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x20, 0x0a, 0x0b, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0b, 0x69, 0x70, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x49, 0x64, 0x32, 0xf1, 0x03, 0x0a, 0x10, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, + 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x4a, 0x0a, 0x0f, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x62, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x6e, 0x0a, 0x1b, 0x66, 0x69, 0x6e, 0x64, 0x4c, 0x61, 0x74, 0x65, + 0x73, 0x74, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x57, 0x69, 0x74, 0x68, 0x54, + 0x79, 0x70, 0x65, 0x12, 0x26, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4c, 0x61, 0x74, + 0x65, 0x73, 0x74, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x57, 0x69, 0x74, 0x68, + 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x27, 0x2e, 0x70, 0x62, + 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x4c, 0x61, 0x74, 0x65, 0x73, 0x74, 0x49, 0x50, 0x4c, 0x69, 0x62, + 0x72, 0x61, 0x72, 0x79, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, 0x14, 0x66, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, + 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1f, 0x2e, 0x70, + 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, + 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x80, 0x01, 0x0a, 0x21, 0x66, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, 0x65, 0x73, 0x57, 0x69, 0x74, + 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x2c, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, + 0x6c, 0x6c, 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, + 0x72, 0x69, 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2d, 0x2e, 0x70, 0x62, 0x2e, 0x46, 0x69, 0x6e, 0x64, 0x41, 0x6c, 0x6c, + 0x45, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x69, + 0x65, 0x73, 0x57, 0x69, 0x74, 0x68, 0x54, 0x79, 0x70, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x43, 0x0a, 0x0f, 0x64, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x50, 0x4c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x12, 0x1a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, + 0x65, 0x49, 0x50, 0x4c, 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x14, 0x2e, 0x70, 0x62, 0x2e, 0x52, 0x50, 0x43, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, + 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x2f, 0x70, 0x62, 0x62, + 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_service_ip_library_proto_rawDescOnce sync.Once + file_service_ip_library_proto_rawDescData = file_service_ip_library_proto_rawDesc +) + +func file_service_ip_library_proto_rawDescGZIP() []byte { + file_service_ip_library_proto_rawDescOnce.Do(func() { + file_service_ip_library_proto_rawDescData = protoimpl.X.CompressGZIP(file_service_ip_library_proto_rawDescData) + }) + return file_service_ip_library_proto_rawDescData +} + +var file_service_ip_library_proto_msgTypes = make([]protoimpl.MessageInfo, 9) +var file_service_ip_library_proto_goTypes = []interface{}{ + (*CreateIPLibraryRequest)(nil), // 0: pb.CreateIPLibraryRequest + (*CreateIPLibraryResponse)(nil), // 1: pb.CreateIPLibraryResponse + (*FindEnabledIPLibraryRequest)(nil), // 2: pb.FindEnabledIPLibraryRequest + (*FindEnabledIPLibraryResponse)(nil), // 3: pb.FindEnabledIPLibraryResponse + (*FindLatestIPLibraryWithTypeRequest)(nil), // 4: pb.FindLatestIPLibraryWithTypeRequest + (*FindLatestIPLibraryWithTypeResponse)(nil), // 5: pb.FindLatestIPLibraryWithTypeResponse + (*FindAllEnabledIPLibrariesWithTypeRequest)(nil), // 6: pb.FindAllEnabledIPLibrariesWithTypeRequest + (*FindAllEnabledIPLibrariesWithTypeResponse)(nil), // 7: pb.FindAllEnabledIPLibrariesWithTypeResponse + (*DeleteIPLibraryRequest)(nil), // 8: pb.DeleteIPLibraryRequest + (*IPLibrary)(nil), // 9: pb.IPLibrary + (*RPCDeleteSuccess)(nil), // 10: pb.RPCDeleteSuccess +} +var file_service_ip_library_proto_depIdxs = []int32{ + 9, // 0: pb.FindEnabledIPLibraryResponse.ipLibrary:type_name -> pb.IPLibrary + 9, // 1: pb.FindLatestIPLibraryWithTypeResponse.ipLibrary:type_name -> pb.IPLibrary + 9, // 2: pb.FindAllEnabledIPLibrariesWithTypeResponse.ipLibraries:type_name -> pb.IPLibrary + 0, // 3: pb.IPLibraryService.createIPLibrary:input_type -> pb.CreateIPLibraryRequest + 4, // 4: pb.IPLibraryService.findLatestIPLibraryWithType:input_type -> pb.FindLatestIPLibraryWithTypeRequest + 2, // 5: pb.IPLibraryService.findEnabledIPLibrary:input_type -> pb.FindEnabledIPLibraryRequest + 6, // 6: pb.IPLibraryService.findAllEnabledIPLibrariesWithType:input_type -> pb.FindAllEnabledIPLibrariesWithTypeRequest + 8, // 7: pb.IPLibraryService.deleteIPLibrary:input_type -> pb.DeleteIPLibraryRequest + 1, // 8: pb.IPLibraryService.createIPLibrary:output_type -> pb.CreateIPLibraryResponse + 5, // 9: pb.IPLibraryService.findLatestIPLibraryWithType:output_type -> pb.FindLatestIPLibraryWithTypeResponse + 3, // 10: pb.IPLibraryService.findEnabledIPLibrary:output_type -> pb.FindEnabledIPLibraryResponse + 7, // 11: pb.IPLibraryService.findAllEnabledIPLibrariesWithType:output_type -> pb.FindAllEnabledIPLibrariesWithTypeResponse + 10, // 12: pb.IPLibraryService.deleteIPLibrary:output_type -> pb.RPCDeleteSuccess + 8, // [8:13] is the sub-list for method output_type + 3, // [3:8] 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_service_ip_library_proto_init() } +func file_service_ip_library_proto_init() { + if File_service_ip_library_proto != nil { + return + } + file_rpc_messages_proto_init() + file_model_ip_library_proto_init() + if !protoimpl.UnsafeEnabled { + file_service_ip_library_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateIPLibraryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateIPLibraryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledIPLibraryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindEnabledIPLibraryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindLatestIPLibraryWithTypeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindLatestIPLibraryWithTypeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledIPLibrariesWithTypeRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*FindAllEnabledIPLibrariesWithTypeResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_service_ip_library_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteIPLibraryRequest); 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_service_ip_library_proto_rawDesc, + NumEnums: 0, + NumMessages: 9, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_service_ip_library_proto_goTypes, + DependencyIndexes: file_service_ip_library_proto_depIdxs, + MessageInfos: file_service_ip_library_proto_msgTypes, + }.Build() + File_service_ip_library_proto = out.File + file_service_ip_library_proto_rawDesc = nil + file_service_ip_library_proto_goTypes = nil + file_service_ip_library_proto_depIdxs = nil +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConnInterface + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion6 + +// IPLibraryServiceClient is the client API for IPLibraryService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type IPLibraryServiceClient interface { + // 创建IP库 + CreateIPLibrary(ctx context.Context, in *CreateIPLibraryRequest, opts ...grpc.CallOption) (*CreateIPLibraryResponse, error) + // 查找最新的IP库 + FindLatestIPLibraryWithType(ctx context.Context, in *FindLatestIPLibraryWithTypeRequest, opts ...grpc.CallOption) (*FindLatestIPLibraryWithTypeResponse, error) + // 查找单个IP库 + FindEnabledIPLibrary(ctx context.Context, in *FindEnabledIPLibraryRequest, opts ...grpc.CallOption) (*FindEnabledIPLibraryResponse, error) + // 列出某个类型的所有IP库 + FindAllEnabledIPLibrariesWithType(ctx context.Context, in *FindAllEnabledIPLibrariesWithTypeRequest, opts ...grpc.CallOption) (*FindAllEnabledIPLibrariesWithTypeResponse, error) + // 删除IP库 + DeleteIPLibrary(ctx context.Context, in *DeleteIPLibraryRequest, opts ...grpc.CallOption) (*RPCDeleteSuccess, error) +} + +type iPLibraryServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewIPLibraryServiceClient(cc grpc.ClientConnInterface) IPLibraryServiceClient { + return &iPLibraryServiceClient{cc} +} + +func (c *iPLibraryServiceClient) CreateIPLibrary(ctx context.Context, in *CreateIPLibraryRequest, opts ...grpc.CallOption) (*CreateIPLibraryResponse, error) { + out := new(CreateIPLibraryResponse) + err := c.cc.Invoke(ctx, "/pb.IPLibraryService/createIPLibrary", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPLibraryServiceClient) FindLatestIPLibraryWithType(ctx context.Context, in *FindLatestIPLibraryWithTypeRequest, opts ...grpc.CallOption) (*FindLatestIPLibraryWithTypeResponse, error) { + out := new(FindLatestIPLibraryWithTypeResponse) + err := c.cc.Invoke(ctx, "/pb.IPLibraryService/findLatestIPLibraryWithType", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPLibraryServiceClient) FindEnabledIPLibrary(ctx context.Context, in *FindEnabledIPLibraryRequest, opts ...grpc.CallOption) (*FindEnabledIPLibraryResponse, error) { + out := new(FindEnabledIPLibraryResponse) + err := c.cc.Invoke(ctx, "/pb.IPLibraryService/findEnabledIPLibrary", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPLibraryServiceClient) FindAllEnabledIPLibrariesWithType(ctx context.Context, in *FindAllEnabledIPLibrariesWithTypeRequest, opts ...grpc.CallOption) (*FindAllEnabledIPLibrariesWithTypeResponse, error) { + out := new(FindAllEnabledIPLibrariesWithTypeResponse) + err := c.cc.Invoke(ctx, "/pb.IPLibraryService/findAllEnabledIPLibrariesWithType", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *iPLibraryServiceClient) DeleteIPLibrary(ctx context.Context, in *DeleteIPLibraryRequest, opts ...grpc.CallOption) (*RPCDeleteSuccess, error) { + out := new(RPCDeleteSuccess) + err := c.cc.Invoke(ctx, "/pb.IPLibraryService/deleteIPLibrary", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// IPLibraryServiceServer is the server API for IPLibraryService service. +type IPLibraryServiceServer interface { + // 创建IP库 + CreateIPLibrary(context.Context, *CreateIPLibraryRequest) (*CreateIPLibraryResponse, error) + // 查找最新的IP库 + FindLatestIPLibraryWithType(context.Context, *FindLatestIPLibraryWithTypeRequest) (*FindLatestIPLibraryWithTypeResponse, error) + // 查找单个IP库 + FindEnabledIPLibrary(context.Context, *FindEnabledIPLibraryRequest) (*FindEnabledIPLibraryResponse, error) + // 列出某个类型的所有IP库 + FindAllEnabledIPLibrariesWithType(context.Context, *FindAllEnabledIPLibrariesWithTypeRequest) (*FindAllEnabledIPLibrariesWithTypeResponse, error) + // 删除IP库 + DeleteIPLibrary(context.Context, *DeleteIPLibraryRequest) (*RPCDeleteSuccess, error) +} + +// UnimplementedIPLibraryServiceServer can be embedded to have forward compatible implementations. +type UnimplementedIPLibraryServiceServer struct { +} + +func (*UnimplementedIPLibraryServiceServer) CreateIPLibrary(context.Context, *CreateIPLibraryRequest) (*CreateIPLibraryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateIPLibrary not implemented") +} +func (*UnimplementedIPLibraryServiceServer) FindLatestIPLibraryWithType(context.Context, *FindLatestIPLibraryWithTypeRequest) (*FindLatestIPLibraryWithTypeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindLatestIPLibraryWithType not implemented") +} +func (*UnimplementedIPLibraryServiceServer) FindEnabledIPLibrary(context.Context, *FindEnabledIPLibraryRequest) (*FindEnabledIPLibraryResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindEnabledIPLibrary not implemented") +} +func (*UnimplementedIPLibraryServiceServer) FindAllEnabledIPLibrariesWithType(context.Context, *FindAllEnabledIPLibrariesWithTypeRequest) (*FindAllEnabledIPLibrariesWithTypeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method FindAllEnabledIPLibrariesWithType not implemented") +} +func (*UnimplementedIPLibraryServiceServer) DeleteIPLibrary(context.Context, *DeleteIPLibraryRequest) (*RPCDeleteSuccess, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteIPLibrary not implemented") +} + +func RegisterIPLibraryServiceServer(s *grpc.Server, srv IPLibraryServiceServer) { + s.RegisterService(&_IPLibraryService_serviceDesc, srv) +} + +func _IPLibraryService_CreateIPLibrary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateIPLibraryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPLibraryServiceServer).CreateIPLibrary(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.IPLibraryService/CreateIPLibrary", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPLibraryServiceServer).CreateIPLibrary(ctx, req.(*CreateIPLibraryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPLibraryService_FindLatestIPLibraryWithType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindLatestIPLibraryWithTypeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPLibraryServiceServer).FindLatestIPLibraryWithType(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.IPLibraryService/FindLatestIPLibraryWithType", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPLibraryServiceServer).FindLatestIPLibraryWithType(ctx, req.(*FindLatestIPLibraryWithTypeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPLibraryService_FindEnabledIPLibrary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindEnabledIPLibraryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPLibraryServiceServer).FindEnabledIPLibrary(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.IPLibraryService/FindEnabledIPLibrary", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPLibraryServiceServer).FindEnabledIPLibrary(ctx, req.(*FindEnabledIPLibraryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPLibraryService_FindAllEnabledIPLibrariesWithType_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(FindAllEnabledIPLibrariesWithTypeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPLibraryServiceServer).FindAllEnabledIPLibrariesWithType(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.IPLibraryService/FindAllEnabledIPLibrariesWithType", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPLibraryServiceServer).FindAllEnabledIPLibrariesWithType(ctx, req.(*FindAllEnabledIPLibrariesWithTypeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _IPLibraryService_DeleteIPLibrary_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteIPLibraryRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(IPLibraryServiceServer).DeleteIPLibrary(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/pb.IPLibraryService/DeleteIPLibrary", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(IPLibraryServiceServer).DeleteIPLibrary(ctx, req.(*DeleteIPLibraryRequest)) + } + return interceptor(ctx, in, info, handler) +} + +var _IPLibraryService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "pb.IPLibraryService", + HandlerType: (*IPLibraryServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "createIPLibrary", + Handler: _IPLibraryService_CreateIPLibrary_Handler, + }, + { + MethodName: "findLatestIPLibraryWithType", + Handler: _IPLibraryService_FindLatestIPLibraryWithType_Handler, + }, + { + MethodName: "findEnabledIPLibrary", + Handler: _IPLibraryService_FindEnabledIPLibrary_Handler, + }, + { + MethodName: "findAllEnabledIPLibrariesWithType", + Handler: _IPLibraryService_FindAllEnabledIPLibrariesWithType_Handler, + }, + { + MethodName: "deleteIPLibrary", + Handler: _IPLibraryService_DeleteIPLibrary_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "service_ip_library.proto", +} diff --git a/pkg/rpc/protos/model_file.proto b/pkg/rpc/protos/model_file.proto new file mode 100644 index 0000000..9cb558d --- /dev/null +++ b/pkg/rpc/protos/model_file.proto @@ -0,0 +1,10 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message File { + int64 id = 1; + string filename = 2; + int64 size = 3; +} \ No newline at end of file diff --git a/pkg/rpc/protos/model_file_chunk.proto b/pkg/rpc/protos/model_file_chunk.proto new file mode 100644 index 0000000..96ad8b4 --- /dev/null +++ b/pkg/rpc/protos/model_file_chunk.proto @@ -0,0 +1,8 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +message FileChunk { + bytes data = 1; +} \ No newline at end of file diff --git a/pkg/rpc/protos/model_ip_library.proto b/pkg/rpc/protos/model_ip_library.proto new file mode 100644 index 0000000..75b0c98 --- /dev/null +++ b/pkg/rpc/protos/model_ip_library.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "model_file.proto"; + +message IPLibrary { + int64 id = 1; + string type = 2; + int64 createdAt = 3; + + File file = 30; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_file.proto b/pkg/rpc/protos/service_file.proto new file mode 100644 index 0000000..844230e --- /dev/null +++ b/pkg/rpc/protos/service_file.proto @@ -0,0 +1,30 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "rpc_messages.proto"; + +// 文件相关服务 +service FileService { + // 创建文件 + rpc createFile (CreateFileRequest) returns (CreateFileResponse); + + // 将文件置为已完成 + rpc updateFileFinished (UpdateFileFinishedRequest) returns (RPCUpdateSuccess); +} + +// 创建文件 +message CreateFileRequest { + string filename = 1; + int64 size = 2; +} + +message CreateFileResponse { + int64 fileId = 1; +} + +// 将文件置为已完成 +message UpdateFileFinishedRequest { + int64 fileId = 1; +} diff --git a/pkg/rpc/protos/service_file_chunk.proto b/pkg/rpc/protos/service_file_chunk.proto new file mode 100644 index 0000000..36fb9e6 --- /dev/null +++ b/pkg/rpc/protos/service_file_chunk.proto @@ -0,0 +1,46 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "model_file_chunk.proto"; + +// 文件片段相关服务 +service FileChunkService { + // 创建文件片段 + rpc createFileChunk (CreateFileChunkRequest) returns (CreateFileChunkResponse); + + // 获取的一个文件的所有片段IDs + rpc findAllFileChunkIds (FindAllFileChunkIdsRequest) returns (FindAllFileChunkIdsResponse); + + // 下载文件片段 + rpc downloadFileChunk (DownloadFileChunkRequest) returns (DownloadFileChunkResponse); +} + +// 创建文件片段 +message CreateFileChunkRequest { + int64 fileId = 1; + bytes data = 2; +} + +message CreateFileChunkResponse { + int64 fileChunkId = 1; +} + +// 获取的一个文件的所有片段IDs +message FindAllFileChunkIdsRequest { + int64 fileId = 1; +} + +message FindAllFileChunkIdsResponse { + repeated int64 fileChunkIds = 1; +} + +// 下载文件片段 +message DownloadFileChunkRequest { + int64 fileChunkId = 1; +} + +message DownloadFileChunkResponse { + FileChunk fileChunk = 1; +} \ No newline at end of file diff --git a/pkg/rpc/protos/service_ip_library.proto b/pkg/rpc/protos/service_ip_library.proto new file mode 100644 index 0000000..e236aa7 --- /dev/null +++ b/pkg/rpc/protos/service_ip_library.proto @@ -0,0 +1,67 @@ +syntax = "proto3"; +option go_package = "./pb"; + +package pb; + +import "rpc_messages.proto"; +import "model_ip_library.proto"; + +// IP库 +service IPLibraryService { + // 创建IP库 + rpc createIPLibrary (CreateIPLibraryRequest) returns (CreateIPLibraryResponse); + + // 查找最新的IP库 + rpc findLatestIPLibraryWithType (FindLatestIPLibraryWithTypeRequest) returns (FindLatestIPLibraryWithTypeResponse); + + // 查找单个IP库 + rpc findEnabledIPLibrary (FindEnabledIPLibraryRequest) returns (FindEnabledIPLibraryResponse); + + // 列出某个类型的所有IP库 + rpc findAllEnabledIPLibrariesWithType (FindAllEnabledIPLibrariesWithTypeRequest) returns (FindAllEnabledIPLibrariesWithTypeResponse); + + // 删除IP库 + rpc deleteIPLibrary (DeleteIPLibraryRequest) returns (RPCDeleteSuccess); +} + +// 创建IP库 +message CreateIPLibraryRequest { + string type = 1; + int64 fileId = 3; +} + +message CreateIPLibraryResponse { + int64 ipLibraryId = 1; +} + +// 查找单个IP库 +message FindEnabledIPLibraryRequest { + int64 ipLibraryId = 1; +} + +message FindEnabledIPLibraryResponse { + IPLibrary ipLibrary = 1; +} + +// 查找最新的IP库 +message FindLatestIPLibraryWithTypeRequest { + string type = 1; +} + +message FindLatestIPLibraryWithTypeResponse { + IPLibrary ipLibrary = 1; +} + +// 列出某个类型的所有IP库 +message FindAllEnabledIPLibrariesWithTypeRequest { + string type = 1; +} + +message FindAllEnabledIPLibrariesWithTypeResponse { + repeated IPLibrary ipLibraries = 1; +} + +// 删除IP库 +message DeleteIPLibraryRequest { + int64 ipLibraryId = 1; +} \ No newline at end of file diff --git a/pkg/serverconfigs/ip_library.go b/pkg/serverconfigs/ip_library.go new file mode 100644 index 0000000..7389256 --- /dev/null +++ b/pkg/serverconfigs/ip_library.go @@ -0,0 +1,23 @@ +package serverconfigs + +import "github.com/iwind/TeaGo/maps" + +// 所有的IP库类型 +var IPLibraryTypes = []maps.Map{ + { + "name": "ip2region", + "code": "ip2region", + "description": "一个开源的IP库:https://github.com/lionsoul2014/ip2region", + "ext": ".db", + }, +} + +// 根据类型查找IP库 +func FindIPLibraryWithType(libraryType string) maps.Map { + for _, t := range IPLibraryTypes { + if t.GetString("code") == libraryType { + return t + } + } + return nil +}