init
This commit is contained in:
@@ -0,0 +1,552 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.26.0
|
||||
// protoc v3.15.8
|
||||
// source: transport.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
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)
|
||||
)
|
||||
|
||||
type FileRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
|
||||
FileRangeStart int64 `protobuf:"varint,2,opt,name=file_range_start,json=fileRangeStart,proto3" json:"file_range_start,omitempty"`
|
||||
FileRangeEnd int64 `protobuf:"varint,3,opt,name=file_range_end,json=fileRangeEnd,proto3" json:"file_range_end,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FileRequest) Reset() {
|
||||
*x = FileRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_transport_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FileRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FileRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_transport_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 FileRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FileRequest) Descriptor() ([]byte, []int) {
|
||||
return file_transport_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *FileRequest) GetFileName() string {
|
||||
if x != nil {
|
||||
return x.FileName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FileRequest) GetFileRangeStart() int64 {
|
||||
if x != nil {
|
||||
return x.FileRangeStart
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FileRequest) GetFileRangeEnd() int64 {
|
||||
if x != nil {
|
||||
return x.FileRangeEnd
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FileResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
Block []byte `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"`
|
||||
FileSize int64 `protobuf:"varint,2,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"`
|
||||
BlockSize int64 `protobuf:"varint,3,opt,name=block_size,json=blockSize,proto3" json:"block_size,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FileResponse) Reset() {
|
||||
*x = FileResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_transport_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FileResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FileResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_transport_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 FileResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FileResponse) Descriptor() ([]byte, []int) {
|
||||
return file_transport_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *FileResponse) GetBlock() []byte {
|
||||
if x != nil {
|
||||
return x.Block
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *FileResponse) GetFileSize() int64 {
|
||||
if x != nil {
|
||||
return x.FileSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FileResponse) GetBlockSize() int64 {
|
||||
if x != nil {
|
||||
return x.BlockSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type FileInfoRequest struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FileInfoRequest) Reset() {
|
||||
*x = FileInfoRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_transport_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FileInfoRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileInfoRequest) ProtoMessage() {}
|
||||
|
||||
func (x *FileInfoRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_transport_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 FileInfoRequest.ProtoReflect.Descriptor instead.
|
||||
func (*FileInfoRequest) Descriptor() ([]byte, []int) {
|
||||
return file_transport_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *FileInfoRequest) GetFileName() string {
|
||||
if x != nil {
|
||||
return x.FileName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type FileInfoResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
FileName string `protobuf:"bytes,1,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"`
|
||||
FileSize int64 `protobuf:"varint,2,opt,name=file_size,json=fileSize,proto3" json:"file_size,omitempty"`
|
||||
FileSha256 string `protobuf:"bytes,3,opt,name=file_sha256,json=fileSha256,proto3" json:"file_sha256,omitempty"`
|
||||
}
|
||||
|
||||
func (x *FileInfoResponse) Reset() {
|
||||
*x = FileInfoResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_transport_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *FileInfoResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*FileInfoResponse) ProtoMessage() {}
|
||||
|
||||
func (x *FileInfoResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_transport_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 FileInfoResponse.ProtoReflect.Descriptor instead.
|
||||
func (*FileInfoResponse) Descriptor() ([]byte, []int) {
|
||||
return file_transport_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *FileInfoResponse) GetFileName() string {
|
||||
if x != nil {
|
||||
return x.FileName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *FileInfoResponse) GetFileSize() int64 {
|
||||
if x != nil {
|
||||
return x.FileSize
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *FileInfoResponse) GetFileSha256() string {
|
||||
if x != nil {
|
||||
return x.FileSha256
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
var File_transport_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_transport_proto_rawDesc = []byte{
|
||||
0x0a, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x6f, 0x72, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74,
|
||||
0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x7a, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f,
|
||||
0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x4e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x61, 0x6e,
|
||||
0x67, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0e,
|
||||
0x66, 0x69, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67, 0x65, 0x53, 0x74, 0x61, 0x72, 0x74, 0x12, 0x24,
|
||||
0x0a, 0x0e, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x5f, 0x65, 0x6e, 0x64,
|
||||
0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x61, 0x6e, 0x67,
|
||||
0x65, 0x45, 0x6e, 0x64, 0x22, 0x60, 0x0a, 0x0c, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0c, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x53, 0x69, 0x7a, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x62, 0x6c, 0x6f, 0x63, 0x6b,
|
||||
0x5f, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x62, 0x6c, 0x6f,
|
||||
0x63, 0x6b, 0x53, 0x69, 0x7a, 0x65, 0x22, 0x2e, 0x0a, 0x0f, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c,
|
||||
0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x22, 0x6d, 0x0a, 0x10, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e,
|
||||
0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66,
|
||||
0x69, 0x6c, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x69, 0x6c, 0x65, 0x5f,
|
||||
0x73, 0x69, 0x7a, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x66, 0x69, 0x6c, 0x65,
|
||||
0x53, 0x69, 0x7a, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x73, 0x68, 0x61,
|
||||
0x32, 0x35, 0x36, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x66, 0x69, 0x6c, 0x65, 0x53,
|
||||
0x68, 0x61, 0x32, 0x35, 0x36, 0x32, 0x88, 0x01, 0x0a, 0x0b, 0x66, 0x69, 0x6c, 0x65, 0x53, 0x65,
|
||||
0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61,
|
||||
0x64, 0x12, 0x12, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x30, 0x01, 0x12, 0x40,
|
||||
0x0a, 0x0b, 0x47, 0x65, 0x74, 0x46, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x2e,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x69, 0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x69,
|
||||
0x6c, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
|
||||
0x42, 0x09, 0x5a, 0x07, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
file_transport_proto_rawDescOnce sync.Once
|
||||
file_transport_proto_rawDescData = file_transport_proto_rawDesc
|
||||
)
|
||||
|
||||
func file_transport_proto_rawDescGZIP() []byte {
|
||||
file_transport_proto_rawDescOnce.Do(func() {
|
||||
file_transport_proto_rawDescData = protoimpl.X.CompressGZIP(file_transport_proto_rawDescData)
|
||||
})
|
||||
return file_transport_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_transport_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_transport_proto_goTypes = []interface{}{
|
||||
(*FileRequest)(nil), // 0: proto.fileRequest
|
||||
(*FileResponse)(nil), // 1: proto.fileResponse
|
||||
(*FileInfoRequest)(nil), // 2: proto.fileInfoRequest
|
||||
(*FileInfoResponse)(nil), // 3: proto.fileInfoResponse
|
||||
}
|
||||
var file_transport_proto_depIdxs = []int32{
|
||||
0, // 0: proto.fileService.Download:input_type -> proto.fileRequest
|
||||
2, // 1: proto.fileService.GetFileInfo:input_type -> proto.fileInfoRequest
|
||||
1, // 2: proto.fileService.Download:output_type -> proto.fileResponse
|
||||
3, // 3: proto.fileService.GetFileInfo:output_type -> proto.fileInfoResponse
|
||||
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_transport_proto_init() }
|
||||
func file_transport_proto_init() {
|
||||
if File_transport_proto != nil {
|
||||
return
|
||||
}
|
||||
if !protoimpl.UnsafeEnabled {
|
||||
file_transport_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FileRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_transport_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FileResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_transport_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FileInfoRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_transport_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*FileInfoResponse); 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_transport_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_transport_proto_goTypes,
|
||||
DependencyIndexes: file_transport_proto_depIdxs,
|
||||
MessageInfos: file_transport_proto_msgTypes,
|
||||
}.Build()
|
||||
File_transport_proto = out.File
|
||||
file_transport_proto_rawDesc = nil
|
||||
file_transport_proto_goTypes = nil
|
||||
file_transport_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 {
|
||||
Download(ctx context.Context, in *FileRequest, opts ...grpc.CallOption) (FileService_DownloadClient, error)
|
||||
GetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpc.CallOption) (*FileInfoResponse, error)
|
||||
}
|
||||
|
||||
type fileServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewFileServiceClient(cc grpc.ClientConnInterface) FileServiceClient {
|
||||
return &fileServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *fileServiceClient) Download(ctx context.Context, in *FileRequest, opts ...grpc.CallOption) (FileService_DownloadClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &_FileService_serviceDesc.Streams[0], "/proto.fileService/Download", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
x := &fileServiceDownloadClient{stream}
|
||||
if err := x.ClientStream.SendMsg(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := x.ClientStream.CloseSend(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return x, nil
|
||||
}
|
||||
|
||||
type FileService_DownloadClient interface {
|
||||
Recv() (*FileResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type fileServiceDownloadClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *fileServiceDownloadClient) Recv() (*FileResponse, error) {
|
||||
m := new(FileResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *fileServiceClient) GetFileInfo(ctx context.Context, in *FileInfoRequest, opts ...grpc.CallOption) (*FileInfoResponse, error) {
|
||||
out := new(FileInfoResponse)
|
||||
err := c.cc.Invoke(ctx, "/proto.fileService/GetFileInfo", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// FileServiceServer is the server API for FileService service.
|
||||
type FileServiceServer interface {
|
||||
Download(*FileRequest, FileService_DownloadServer) error
|
||||
GetFileInfo(context.Context, *FileInfoRequest) (*FileInfoResponse, error)
|
||||
}
|
||||
|
||||
// UnimplementedFileServiceServer can be embedded to have forward compatible implementations.
|
||||
type UnimplementedFileServiceServer struct {
|
||||
}
|
||||
|
||||
func (*UnimplementedFileServiceServer) Download(*FileRequest, FileService_DownloadServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method Download not implemented")
|
||||
}
|
||||
func (*UnimplementedFileServiceServer) GetFileInfo(context.Context, *FileInfoRequest) (*FileInfoResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method GetFileInfo not implemented")
|
||||
}
|
||||
|
||||
func RegisterFileServiceServer(s *grpc.Server, srv FileServiceServer) {
|
||||
s.RegisterService(&_FileService_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _FileService_Download_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(FileRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
return srv.(FileServiceServer).Download(m, &fileServiceDownloadServer{stream})
|
||||
}
|
||||
|
||||
type FileService_DownloadServer interface {
|
||||
Send(*FileResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type fileServiceDownloadServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *fileServiceDownloadServer) Send(m *FileResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _FileService_GetFileInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(FileInfoRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(FileServiceServer).GetFileInfo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/proto.fileService/GetFileInfo",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(FileServiceServer).GetFileInfo(ctx, req.(*FileInfoRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _FileService_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "proto.fileService",
|
||||
HandlerType: (*FileServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "GetFileInfo",
|
||||
Handler: _FileService_GetFileInfo_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{
|
||||
{
|
||||
StreamName: "Download",
|
||||
Handler: _FileService_Download_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "transport.proto",
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package proto;
|
||||
|
||||
option go_package = "./proto";
|
||||
|
||||
|
||||
message fileRequest{
|
||||
string file_name = 1;
|
||||
int64 file_range_start = 2;
|
||||
int64 file_range_end = 3;
|
||||
}
|
||||
|
||||
message fileResponse{
|
||||
bytes block = 1;
|
||||
int64 file_size = 2;
|
||||
int64 block_size = 3;
|
||||
}
|
||||
|
||||
message fileInfoRequest{
|
||||
string file_name = 1;
|
||||
}
|
||||
|
||||
message fileInfoResponse{
|
||||
string file_name = 1;
|
||||
int64 file_size = 2;
|
||||
string file_sha256 = 3;
|
||||
}
|
||||
|
||||
service fileService{
|
||||
rpc Download(fileRequest) returns (stream fileResponse){};
|
||||
rpc GetFileInfo(fileInfoRequest) returns (fileInfoResponse) {};
|
||||
}
|
||||
Reference in New Issue
Block a user