mirror of https://github.com/dragonflyoss/api.git
feat: add stream response to DownloadTask (#212)
Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
parent
3394a576ec
commit
6d865929d3
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "dragonfly-api"
|
||||
version = "2.0.49"
|
||||
version = "2.0.50"
|
||||
authors = ["Gaius <gaius.qi@gmail.com>"]
|
||||
edition = "2021"
|
||||
license = "Apache-2.0"
|
||||
|
|
|
|||
|
|
@ -428,6 +428,55 @@ func (x *DownloadTaskRequest) GetDownload() *v2.Download {
|
|||
return nil
|
||||
}
|
||||
|
||||
// DownloadTaskResponse represents response of DownloadTask.
|
||||
type DownloadTaskResponse struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Finished piece of task.
|
||||
Piece *v2.Piece `protobuf:"bytes,1,opt,name=piece,proto3" json:"piece,omitempty"`
|
||||
}
|
||||
|
||||
func (x *DownloadTaskResponse) Reset() {
|
||||
*x = DownloadTaskResponse{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
}
|
||||
|
||||
func (x *DownloadTaskResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DownloadTaskResponse) ProtoMessage() {}
|
||||
|
||||
func (x *DownloadTaskResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_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 DownloadTaskResponse.ProtoReflect.Descriptor instead.
|
||||
func (*DownloadTaskResponse) Descriptor() ([]byte, []int) {
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *DownloadTaskResponse) GetPiece() *v2.Piece {
|
||||
if x != nil {
|
||||
return x.Piece
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// UploadTaskRequest represents request of UploadTask.
|
||||
type UploadTaskRequest struct {
|
||||
state protoimpl.MessageState
|
||||
|
|
@ -441,7 +490,7 @@ type UploadTaskRequest struct {
|
|||
func (x *UploadTaskRequest) Reset() {
|
||||
*x = UploadTaskRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[7]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -454,7 +503,7 @@ func (x *UploadTaskRequest) String() string {
|
|||
func (*UploadTaskRequest) ProtoMessage() {}
|
||||
|
||||
func (x *UploadTaskRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[7]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[8]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -467,7 +516,7 @@ func (x *UploadTaskRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use UploadTaskRequest.ProtoReflect.Descriptor instead.
|
||||
func (*UploadTaskRequest) Descriptor() ([]byte, []int) {
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{7}
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *UploadTaskRequest) GetTask() *v2.Task {
|
||||
|
|
@ -490,7 +539,7 @@ type StatTaskRequest struct {
|
|||
func (x *StatTaskRequest) Reset() {
|
||||
*x = StatTaskRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[8]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -503,7 +552,7 @@ func (x *StatTaskRequest) String() string {
|
|||
func (*StatTaskRequest) ProtoMessage() {}
|
||||
|
||||
func (x *StatTaskRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[8]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[9]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -516,7 +565,7 @@ func (x *StatTaskRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use StatTaskRequest.ProtoReflect.Descriptor instead.
|
||||
func (*StatTaskRequest) Descriptor() ([]byte, []int) {
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{8}
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *StatTaskRequest) GetTaskId() string {
|
||||
|
|
@ -539,7 +588,7 @@ type DeleteTaskRequest struct {
|
|||
func (x *DeleteTaskRequest) Reset() {
|
||||
*x = DeleteTaskRequest{}
|
||||
if protoimpl.UnsafeEnabled {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[9]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[10]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
|
@ -552,7 +601,7 @@ func (x *DeleteTaskRequest) String() string {
|
|||
func (*DeleteTaskRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DeleteTaskRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[9]
|
||||
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[10]
|
||||
if protoimpl.UnsafeEnabled && x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
|
|
@ -565,7 +614,7 @@ func (x *DeleteTaskRequest) ProtoReflect() protoreflect.Message {
|
|||
|
||||
// Deprecated: Use DeleteTaskRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DeleteTaskRequest) Descriptor() ([]byte, []int) {
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{9}
|
||||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{10}
|
||||
}
|
||||
|
||||
func (x *DeleteTaskRequest) GetTaskId() string {
|
||||
|
|
@ -628,50 +677,56 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc = []byte{
|
|||
0x39, 0x0a, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x13, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x6f,
|
||||
0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01,
|
||||
0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x42, 0x0a, 0x11, 0x55, 0x70,
|
||||
0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12,
|
||||
0x2d, 0x0a, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e,
|
||||
0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x42, 0x08,
|
||||
0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x33,
|
||||
0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01,
|
||||
0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73,
|
||||
0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b,
|
||||
0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02,
|
||||
0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x32, 0xcc, 0x03, 0x0a, 0x08, 0x44,
|
||||
0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x69,
|
||||
0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x64, 0x66, 0x64,
|
||||
0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x65, 0x63,
|
||||
0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x24, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65,
|
||||
0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65,
|
||||
0x63, 0x65, 0x73, 0x12, 0x1e, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
|
||||
0x32, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
|
||||
0x32, 0x2e, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70,
|
||||
0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01, 0x30, 0x01, 0x12, 0x48, 0x0a, 0x0c, 0x44, 0x6f, 0x77, 0x6e,
|
||||
0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x20, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f,
|
||||
0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70,
|
||||
0x74, 0x79, 0x12, 0x44, 0x0a, 0x0a, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x12, 0x1e, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x55,
|
||||
0x70, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
|
||||
0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62,
|
||||
0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12, 0x39, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x74,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x12, 0x1c, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x54,
|
||||
0x61, 0x73, 0x6b, 0x12, 0x44, 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73,
|
||||
0x6b, 0x12, 0x1e, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e,
|
||||
0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
|
||||
0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||
0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x42, 0x2d, 0x5a, 0x2b, 0x64, 0x37, 0x79,
|
||||
0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61,
|
||||
0x70, 0x69, 0x73, 0x2f, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x32, 0x3b,
|
||||
0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x52, 0x08, 0x64, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x22, 0x48, 0x0a, 0x14, 0x44, 0x6f,
|
||||
0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x12, 0x30, 0x0a, 0x05, 0x70, 0x69, 0x65, 0x63, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x50, 0x69,
|
||||
0x65, 0x63, 0x65, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02, 0x10, 0x01, 0x52, 0x05, 0x70,
|
||||
0x69, 0x65, 0x63, 0x65, 0x22, 0x42, 0x0a, 0x11, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x2d, 0x0a, 0x04, 0x74, 0x61, 0x73,
|
||||
0x6b, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e,
|
||||
0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x8a, 0x01, 0x02,
|
||||
0x10, 0x01, 0x52, 0x04, 0x74, 0x61, 0x73, 0x6b, 0x22, 0x33, 0x0a, 0x0f, 0x53, 0x74, 0x61, 0x74,
|
||||
0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74,
|
||||
0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42,
|
||||
0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x22, 0x35, 0x0a,
|
||||
0x11, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x12, 0x20, 0x0a, 0x07, 0x74, 0x61, 0x73, 0x6b, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x09, 0x42, 0x07, 0xfa, 0x42, 0x04, 0x72, 0x02, 0x10, 0x01, 0x52, 0x06, 0x74, 0x61,
|
||||
0x73, 0x6b, 0x49, 0x64, 0x32, 0xd9, 0x03, 0x0a, 0x08, 0x44, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f,
|
||||
0x6e, 0x12, 0x5c, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d,
|
||||
0x62, 0x65, 0x72, 0x73, 0x12, 0x23, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65,
|
||||
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x64, 0x66, 0x64, 0x61,
|
||||
0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x69, 0x65, 0x63, 0x65,
|
||||
0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
|
||||
0x51, 0x0a, 0x0a, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x12, 0x1e, 0x2e,
|
||||
0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x79, 0x6e, 0x63,
|
||||
0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e,
|
||||
0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x79, 0x6e, 0x63,
|
||||
0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x28, 0x01,
|
||||
0x30, 0x01, 0x12, 0x55, 0x0a, 0x0c, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x12, 0x20, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32,
|
||||
0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71,
|
||||
0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e,
|
||||
0x76, 0x32, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52,
|
||||
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x30, 0x01, 0x12, 0x44, 0x0a, 0x0a, 0x55, 0x70, 0x6c,
|
||||
0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b,
|
||||
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65,
|
||||
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79, 0x12,
|
||||
0x39, 0x0a, 0x08, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1c, 0x2e, 0x64, 0x66,
|
||||
0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x54, 0x61,
|
||||
0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x0f, 0x2e, 0x63, 0x6f, 0x6d, 0x6d,
|
||||
0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x44, 0x0a, 0x0a, 0x44, 0x65,
|
||||
0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73, 0x6b, 0x12, 0x1e, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65,
|
||||
0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x54, 0x61, 0x73,
|
||||
0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c,
|
||||
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x45, 0x6d, 0x70, 0x74, 0x79,
|
||||
0x42, 0x2d, 0x5a, 0x2b, 0x64, 0x37, 0x79, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76,
|
||||
0x32, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x61, 0x70, 0x69, 0x73, 0x2f, 0x64, 0x66, 0x64, 0x61, 0x65,
|
||||
0x6d, 0x6f, 0x6e, 0x2f, 0x76, 0x32, 0x3b, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x62,
|
||||
0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
@ -686,7 +741,7 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP() []byte {
|
|||
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes = make([]protoimpl.MessageInfo, 11)
|
||||
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_goTypes = []interface{}{
|
||||
(*GetPieceNumbersRequest)(nil), // 0: dfdaemon.v2.GetPieceNumbersRequest
|
||||
(*GetPieceNumbersResponse)(nil), // 1: dfdaemon.v2.GetPieceNumbersResponse
|
||||
|
|
@ -695,37 +750,39 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_goTypes = []interface{}{
|
|||
(*InterestedPiecesResponse)(nil), // 4: dfdaemon.v2.InterestedPiecesResponse
|
||||
(*SyncPiecesResponse)(nil), // 5: dfdaemon.v2.SyncPiecesResponse
|
||||
(*DownloadTaskRequest)(nil), // 6: dfdaemon.v2.DownloadTaskRequest
|
||||
(*UploadTaskRequest)(nil), // 7: dfdaemon.v2.UploadTaskRequest
|
||||
(*StatTaskRequest)(nil), // 8: dfdaemon.v2.StatTaskRequest
|
||||
(*DeleteTaskRequest)(nil), // 9: dfdaemon.v2.DeleteTaskRequest
|
||||
(*v2.Piece)(nil), // 10: common.v2.Piece
|
||||
(*v2.Download)(nil), // 11: common.v2.Download
|
||||
(*v2.Task)(nil), // 12: common.v2.Task
|
||||
(*emptypb.Empty)(nil), // 13: google.protobuf.Empty
|
||||
(*DownloadTaskResponse)(nil), // 7: dfdaemon.v2.DownloadTaskResponse
|
||||
(*UploadTaskRequest)(nil), // 8: dfdaemon.v2.UploadTaskRequest
|
||||
(*StatTaskRequest)(nil), // 9: dfdaemon.v2.StatTaskRequest
|
||||
(*DeleteTaskRequest)(nil), // 10: dfdaemon.v2.DeleteTaskRequest
|
||||
(*v2.Piece)(nil), // 11: common.v2.Piece
|
||||
(*v2.Download)(nil), // 12: common.v2.Download
|
||||
(*v2.Task)(nil), // 13: common.v2.Task
|
||||
(*emptypb.Empty)(nil), // 14: google.protobuf.Empty
|
||||
}
|
||||
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_depIdxs = []int32{
|
||||
2, // 0: dfdaemon.v2.SyncPiecesRequest.interested_pieces_request:type_name -> dfdaemon.v2.InterestedPiecesRequest
|
||||
10, // 1: dfdaemon.v2.InterestedPiecesResponse.piece:type_name -> common.v2.Piece
|
||||
11, // 1: dfdaemon.v2.InterestedPiecesResponse.piece:type_name -> common.v2.Piece
|
||||
4, // 2: dfdaemon.v2.SyncPiecesResponse.interested_pieces_response:type_name -> dfdaemon.v2.InterestedPiecesResponse
|
||||
11, // 3: dfdaemon.v2.DownloadTaskRequest.download:type_name -> common.v2.Download
|
||||
12, // 4: dfdaemon.v2.UploadTaskRequest.task:type_name -> common.v2.Task
|
||||
0, // 5: dfdaemon.v2.Dfdaemon.GetPieceNumbers:input_type -> dfdaemon.v2.GetPieceNumbersRequest
|
||||
3, // 6: dfdaemon.v2.Dfdaemon.SyncPieces:input_type -> dfdaemon.v2.SyncPiecesRequest
|
||||
6, // 7: dfdaemon.v2.Dfdaemon.DownloadTask:input_type -> dfdaemon.v2.DownloadTaskRequest
|
||||
7, // 8: dfdaemon.v2.Dfdaemon.UploadTask:input_type -> dfdaemon.v2.UploadTaskRequest
|
||||
8, // 9: dfdaemon.v2.Dfdaemon.StatTask:input_type -> dfdaemon.v2.StatTaskRequest
|
||||
9, // 10: dfdaemon.v2.Dfdaemon.DeleteTask:input_type -> dfdaemon.v2.DeleteTaskRequest
|
||||
1, // 11: dfdaemon.v2.Dfdaemon.GetPieceNumbers:output_type -> dfdaemon.v2.GetPieceNumbersResponse
|
||||
5, // 12: dfdaemon.v2.Dfdaemon.SyncPieces:output_type -> dfdaemon.v2.SyncPiecesResponse
|
||||
13, // 13: dfdaemon.v2.Dfdaemon.DownloadTask:output_type -> google.protobuf.Empty
|
||||
13, // 14: dfdaemon.v2.Dfdaemon.UploadTask:output_type -> google.protobuf.Empty
|
||||
12, // 15: dfdaemon.v2.Dfdaemon.StatTask:output_type -> common.v2.Task
|
||||
13, // 16: dfdaemon.v2.Dfdaemon.DeleteTask:output_type -> google.protobuf.Empty
|
||||
11, // [11:17] is the sub-list for method output_type
|
||||
5, // [5:11] is the sub-list for method input_type
|
||||
5, // [5:5] is the sub-list for extension type_name
|
||||
5, // [5:5] is the sub-list for extension extendee
|
||||
0, // [0:5] is the sub-list for field type_name
|
||||
12, // 3: dfdaemon.v2.DownloadTaskRequest.download:type_name -> common.v2.Download
|
||||
11, // 4: dfdaemon.v2.DownloadTaskResponse.piece:type_name -> common.v2.Piece
|
||||
13, // 5: dfdaemon.v2.UploadTaskRequest.task:type_name -> common.v2.Task
|
||||
0, // 6: dfdaemon.v2.Dfdaemon.GetPieceNumbers:input_type -> dfdaemon.v2.GetPieceNumbersRequest
|
||||
3, // 7: dfdaemon.v2.Dfdaemon.SyncPieces:input_type -> dfdaemon.v2.SyncPiecesRequest
|
||||
6, // 8: dfdaemon.v2.Dfdaemon.DownloadTask:input_type -> dfdaemon.v2.DownloadTaskRequest
|
||||
8, // 9: dfdaemon.v2.Dfdaemon.UploadTask:input_type -> dfdaemon.v2.UploadTaskRequest
|
||||
9, // 10: dfdaemon.v2.Dfdaemon.StatTask:input_type -> dfdaemon.v2.StatTaskRequest
|
||||
10, // 11: dfdaemon.v2.Dfdaemon.DeleteTask:input_type -> dfdaemon.v2.DeleteTaskRequest
|
||||
1, // 12: dfdaemon.v2.Dfdaemon.GetPieceNumbers:output_type -> dfdaemon.v2.GetPieceNumbersResponse
|
||||
5, // 13: dfdaemon.v2.Dfdaemon.SyncPieces:output_type -> dfdaemon.v2.SyncPiecesResponse
|
||||
7, // 14: dfdaemon.v2.Dfdaemon.DownloadTask:output_type -> dfdaemon.v2.DownloadTaskResponse
|
||||
14, // 15: dfdaemon.v2.Dfdaemon.UploadTask:output_type -> google.protobuf.Empty
|
||||
13, // 16: dfdaemon.v2.Dfdaemon.StatTask:output_type -> common.v2.Task
|
||||
14, // 17: dfdaemon.v2.Dfdaemon.DeleteTask:output_type -> google.protobuf.Empty
|
||||
12, // [12:18] is the sub-list for method output_type
|
||||
6, // [6:12] is the sub-list for method input_type
|
||||
6, // [6:6] is the sub-list for extension type_name
|
||||
6, // [6:6] is the sub-list for extension extendee
|
||||
0, // [0:6] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() }
|
||||
|
|
@ -819,7 +876,7 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
|
|||
}
|
||||
}
|
||||
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*UploadTaskRequest); i {
|
||||
switch v := v.(*DownloadTaskResponse); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -831,7 +888,7 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
|
|||
}
|
||||
}
|
||||
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatTaskRequest); i {
|
||||
switch v := v.(*UploadTaskRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
|
|
@ -843,6 +900,18 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
|
|||
}
|
||||
}
|
||||
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*StatTaskRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
case 1:
|
||||
return &v.sizeCache
|
||||
case 2:
|
||||
return &v.unknownFields
|
||||
default:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
|
||||
switch v := v.(*DeleteTaskRequest); i {
|
||||
case 0:
|
||||
return &v.state
|
||||
|
|
@ -867,7 +936,7 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
|
|||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumMessages: 11,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -978,6 +978,148 @@ var _ interface {
|
|||
ErrorName() string
|
||||
} = DownloadTaskRequestValidationError{}
|
||||
|
||||
// Validate checks the field values on DownloadTaskResponse with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the first error encountered is returned, or nil if there are no violations.
|
||||
func (m *DownloadTaskResponse) Validate() error {
|
||||
return m.validate(false)
|
||||
}
|
||||
|
||||
// ValidateAll checks the field values on DownloadTaskResponse with the rules
|
||||
// defined in the proto definition for this message. If any rules are
|
||||
// violated, the result is a list of violation errors wrapped in
|
||||
// DownloadTaskResponseMultiError, or nil if none found.
|
||||
func (m *DownloadTaskResponse) ValidateAll() error {
|
||||
return m.validate(true)
|
||||
}
|
||||
|
||||
func (m *DownloadTaskResponse) validate(all bool) error {
|
||||
if m == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
var errors []error
|
||||
|
||||
if m.GetPiece() == nil {
|
||||
err := DownloadTaskResponseValidationError{
|
||||
field: "Piece",
|
||||
reason: "value is required",
|
||||
}
|
||||
if !all {
|
||||
return err
|
||||
}
|
||||
errors = append(errors, err)
|
||||
}
|
||||
|
||||
if all {
|
||||
switch v := interface{}(m.GetPiece()).(type) {
|
||||
case interface{ ValidateAll() error }:
|
||||
if err := v.ValidateAll(); err != nil {
|
||||
errors = append(errors, DownloadTaskResponseValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
case interface{ Validate() error }:
|
||||
if err := v.Validate(); err != nil {
|
||||
errors = append(errors, DownloadTaskResponseValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
})
|
||||
}
|
||||
}
|
||||
} else if v, ok := interface{}(m.GetPiece()).(interface{ Validate() error }); ok {
|
||||
if err := v.Validate(); err != nil {
|
||||
return DownloadTaskResponseValidationError{
|
||||
field: "Piece",
|
||||
reason: "embedded message failed validation",
|
||||
cause: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if len(errors) > 0 {
|
||||
return DownloadTaskResponseMultiError(errors)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// DownloadTaskResponseMultiError is an error wrapping multiple validation
|
||||
// errors returned by DownloadTaskResponse.ValidateAll() if the designated
|
||||
// constraints aren't met.
|
||||
type DownloadTaskResponseMultiError []error
|
||||
|
||||
// Error returns a concatenation of all the error messages it wraps.
|
||||
func (m DownloadTaskResponseMultiError) Error() string {
|
||||
var msgs []string
|
||||
for _, err := range m {
|
||||
msgs = append(msgs, err.Error())
|
||||
}
|
||||
return strings.Join(msgs, "; ")
|
||||
}
|
||||
|
||||
// AllErrors returns a list of validation violation errors.
|
||||
func (m DownloadTaskResponseMultiError) AllErrors() []error { return m }
|
||||
|
||||
// DownloadTaskResponseValidationError is the validation error returned by
|
||||
// DownloadTaskResponse.Validate if the designated constraints aren't met.
|
||||
type DownloadTaskResponseValidationError struct {
|
||||
field string
|
||||
reason string
|
||||
cause error
|
||||
key bool
|
||||
}
|
||||
|
||||
// Field function returns field value.
|
||||
func (e DownloadTaskResponseValidationError) Field() string { return e.field }
|
||||
|
||||
// Reason function returns reason value.
|
||||
func (e DownloadTaskResponseValidationError) Reason() string { return e.reason }
|
||||
|
||||
// Cause function returns cause value.
|
||||
func (e DownloadTaskResponseValidationError) Cause() error { return e.cause }
|
||||
|
||||
// Key function returns key value.
|
||||
func (e DownloadTaskResponseValidationError) Key() bool { return e.key }
|
||||
|
||||
// ErrorName returns error name.
|
||||
func (e DownloadTaskResponseValidationError) ErrorName() string {
|
||||
return "DownloadTaskResponseValidationError"
|
||||
}
|
||||
|
||||
// Error satisfies the builtin error interface
|
||||
func (e DownloadTaskResponseValidationError) Error() string {
|
||||
cause := ""
|
||||
if e.cause != nil {
|
||||
cause = fmt.Sprintf(" | caused by: %v", e.cause)
|
||||
}
|
||||
|
||||
key := ""
|
||||
if e.key {
|
||||
key = "key for "
|
||||
}
|
||||
|
||||
return fmt.Sprintf(
|
||||
"invalid %sDownloadTaskResponse.%s: %s%s",
|
||||
key,
|
||||
e.field,
|
||||
e.reason,
|
||||
cause)
|
||||
}
|
||||
|
||||
var _ error = DownloadTaskResponseValidationError{}
|
||||
|
||||
var _ interface {
|
||||
Field() string
|
||||
Reason() string
|
||||
Key() bool
|
||||
Cause() error
|
||||
ErrorName() string
|
||||
} = DownloadTaskResponseValidationError{}
|
||||
|
||||
// Validate checks the field values on UploadTaskRequest with the rules defined
|
||||
// in the proto definition for this message. If any rules are violated, the
|
||||
// first error encountered is returned, or nil if there are no violations.
|
||||
|
|
|
|||
|
|
@ -75,6 +75,12 @@ message DownloadTaskRequest {
|
|||
common.v2.Download download = 1 [(validate.rules).message.required = true];
|
||||
}
|
||||
|
||||
// DownloadTaskResponse represents response of DownloadTask.
|
||||
message DownloadTaskResponse {
|
||||
// Finished piece of task.
|
||||
common.v2.Piece piece = 1 [(validate.rules).message.required = true];
|
||||
}
|
||||
|
||||
// UploadTaskRequest represents request of UploadTask.
|
||||
message UploadTaskRequest {
|
||||
// Task metadata.
|
||||
|
|
@ -102,7 +108,7 @@ service Dfdaemon {
|
|||
rpc SyncPieces(stream SyncPiecesRequest)returns(stream SyncPiecesResponse);
|
||||
|
||||
// DownloadTask downloads task back-to-source.
|
||||
rpc DownloadTask(DownloadTaskRequest) returns(google.protobuf.Empty);
|
||||
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
|
||||
|
||||
// UploadTask uploads task to p2p network.
|
||||
rpc UploadTask(UploadTaskRequest) returns(google.protobuf.Empty);
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ type DfdaemonClient interface {
|
|||
// SyncPieces syncs pieces from the other peer.
|
||||
SyncPieces(ctx context.Context, opts ...grpc.CallOption) (Dfdaemon_SyncPiecesClient, error)
|
||||
// DownloadTask downloads task back-to-source.
|
||||
DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (Dfdaemon_DownloadTaskClient, error)
|
||||
// UploadTask uploads task to p2p network.
|
||||
UploadTask(ctx context.Context, in *UploadTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
|
||||
// StatTask stats task information.
|
||||
|
|
@ -86,13 +86,36 @@ func (x *dfdaemonSyncPiecesClient) Recv() (*SyncPiecesResponse, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func (c *dfdaemonClient) DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
out := new(emptypb.Empty)
|
||||
err := c.cc.Invoke(ctx, "/dfdaemon.v2.Dfdaemon/DownloadTask", in, out, opts...)
|
||||
func (c *dfdaemonClient) DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (Dfdaemon_DownloadTaskClient, error) {
|
||||
stream, err := c.cc.NewStream(ctx, &Dfdaemon_ServiceDesc.Streams[1], "/dfdaemon.v2.Dfdaemon/DownloadTask", opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
x := &dfdaemonDownloadTaskClient{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 Dfdaemon_DownloadTaskClient interface {
|
||||
Recv() (*DownloadTaskResponse, error)
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
type dfdaemonDownloadTaskClient struct {
|
||||
grpc.ClientStream
|
||||
}
|
||||
|
||||
func (x *dfdaemonDownloadTaskClient) Recv() (*DownloadTaskResponse, error) {
|
||||
m := new(DownloadTaskResponse)
|
||||
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return m, nil
|
||||
}
|
||||
|
||||
func (c *dfdaemonClient) UploadTask(ctx context.Context, in *UploadTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
|
|
@ -131,7 +154,7 @@ type DfdaemonServer interface {
|
|||
// SyncPieces syncs pieces from the other peer.
|
||||
SyncPieces(Dfdaemon_SyncPiecesServer) error
|
||||
// DownloadTask downloads task back-to-source.
|
||||
DownloadTask(context.Context, *DownloadTaskRequest) (*emptypb.Empty, error)
|
||||
DownloadTask(*DownloadTaskRequest, Dfdaemon_DownloadTaskServer) error
|
||||
// UploadTask uploads task to p2p network.
|
||||
UploadTask(context.Context, *UploadTaskRequest) (*emptypb.Empty, error)
|
||||
// StatTask stats task information.
|
||||
|
|
@ -150,8 +173,8 @@ func (UnimplementedDfdaemonServer) GetPieceNumbers(context.Context, *GetPieceNum
|
|||
func (UnimplementedDfdaemonServer) SyncPieces(Dfdaemon_SyncPiecesServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method SyncPieces not implemented")
|
||||
}
|
||||
func (UnimplementedDfdaemonServer) DownloadTask(context.Context, *DownloadTaskRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method DownloadTask not implemented")
|
||||
func (UnimplementedDfdaemonServer) DownloadTask(*DownloadTaskRequest, Dfdaemon_DownloadTaskServer) error {
|
||||
return status.Errorf(codes.Unimplemented, "method DownloadTask not implemented")
|
||||
}
|
||||
func (UnimplementedDfdaemonServer) UploadTask(context.Context, *UploadTaskRequest) (*emptypb.Empty, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UploadTask not implemented")
|
||||
|
|
@ -218,22 +241,25 @@ func (x *dfdaemonSyncPiecesServer) Recv() (*SyncPiecesRequest, error) {
|
|||
return m, nil
|
||||
}
|
||||
|
||||
func _Dfdaemon_DownloadTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DownloadTaskRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
func _Dfdaemon_DownloadTask_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||||
m := new(DownloadTaskRequest)
|
||||
if err := stream.RecvMsg(m); err != nil {
|
||||
return err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(DfdaemonServer).DownloadTask(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/dfdaemon.v2.Dfdaemon/DownloadTask",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(DfdaemonServer).DownloadTask(ctx, req.(*DownloadTaskRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
return srv.(DfdaemonServer).DownloadTask(m, &dfdaemonDownloadTaskServer{stream})
|
||||
}
|
||||
|
||||
type Dfdaemon_DownloadTaskServer interface {
|
||||
Send(*DownloadTaskResponse) error
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
type dfdaemonDownloadTaskServer struct {
|
||||
grpc.ServerStream
|
||||
}
|
||||
|
||||
func (x *dfdaemonDownloadTaskServer) Send(m *DownloadTaskResponse) error {
|
||||
return x.ServerStream.SendMsg(m)
|
||||
}
|
||||
|
||||
func _Dfdaemon_UploadTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
|
|
@ -301,10 +327,6 @@ var Dfdaemon_ServiceDesc = grpc.ServiceDesc{
|
|||
MethodName: "GetPieceNumbers",
|
||||
Handler: _Dfdaemon_GetPieceNumbers_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DownloadTask",
|
||||
Handler: _Dfdaemon_DownloadTask_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "UploadTask",
|
||||
Handler: _Dfdaemon_UploadTask_Handler,
|
||||
|
|
@ -325,6 +347,11 @@ var Dfdaemon_ServiceDesc = grpc.ServiceDesc{
|
|||
ServerStreams: true,
|
||||
ClientStreams: true,
|
||||
},
|
||||
{
|
||||
StreamName: "DownloadTask",
|
||||
Handler: _Dfdaemon_DownloadTask_Handler,
|
||||
ServerStreams: true,
|
||||
},
|
||||
},
|
||||
Metadata: "pkg/apis/dfdaemon/v2/dfdaemon.proto",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,14 +64,14 @@ func (mr *MockDfdaemonClientMockRecorder) DeleteTask(ctx, in any, opts ...any) *
|
|||
}
|
||||
|
||||
// DownloadTask mocks base method.
|
||||
func (m *MockDfdaemonClient) DownloadTask(ctx context.Context, in *dfdaemon.DownloadTaskRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
|
||||
func (m *MockDfdaemonClient) DownloadTask(ctx context.Context, in *dfdaemon.DownloadTaskRequest, opts ...grpc.CallOption) (dfdaemon.Dfdaemon_DownloadTaskClient, error) {
|
||||
m.ctrl.T.Helper()
|
||||
varargs := []any{ctx, in}
|
||||
for _, a := range opts {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "DownloadTask", varargs...)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret0, _ := ret[0].(dfdaemon.Dfdaemon_DownloadTaskClient)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
|
@ -300,6 +300,129 @@ func (mr *MockDfdaemon_SyncPiecesClientMockRecorder) Trailer() *gomock.Call {
|
|||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockDfdaemon_SyncPiecesClient)(nil).Trailer))
|
||||
}
|
||||
|
||||
// MockDfdaemon_DownloadTaskClient is a mock of Dfdaemon_DownloadTaskClient interface.
|
||||
type MockDfdaemon_DownloadTaskClient struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDfdaemon_DownloadTaskClientMockRecorder
|
||||
}
|
||||
|
||||
// MockDfdaemon_DownloadTaskClientMockRecorder is the mock recorder for MockDfdaemon_DownloadTaskClient.
|
||||
type MockDfdaemon_DownloadTaskClientMockRecorder struct {
|
||||
mock *MockDfdaemon_DownloadTaskClient
|
||||
}
|
||||
|
||||
// NewMockDfdaemon_DownloadTaskClient creates a new mock instance.
|
||||
func NewMockDfdaemon_DownloadTaskClient(ctrl *gomock.Controller) *MockDfdaemon_DownloadTaskClient {
|
||||
mock := &MockDfdaemon_DownloadTaskClient{ctrl: ctrl}
|
||||
mock.recorder = &MockDfdaemon_DownloadTaskClientMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) EXPECT() *MockDfdaemon_DownloadTaskClientMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// CloseSend mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) CloseSend() error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "CloseSend")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CloseSend indicates an expected call of CloseSend.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) CloseSend() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).CloseSend))
|
||||
}
|
||||
|
||||
// Context mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) Context() context.Context {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Context")
|
||||
ret0, _ := ret[0].(context.Context)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Context indicates an expected call of Context.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) Context() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).Context))
|
||||
}
|
||||
|
||||
// Header mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) Header() (metadata.MD, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Header")
|
||||
ret0, _ := ret[0].(metadata.MD)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Header indicates an expected call of Header.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) Header() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).Header))
|
||||
}
|
||||
|
||||
// Recv mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) Recv() (*dfdaemon.DownloadTaskResponse, error) {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Recv")
|
||||
ret0, _ := ret[0].(*dfdaemon.DownloadTaskResponse)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Recv indicates an expected call of Recv.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) Recv() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).Recv))
|
||||
}
|
||||
|
||||
// RecvMsg mocks base method.
|
||||
func (m_2 *MockDfdaemon_DownloadTaskClient) RecvMsg(m any) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "RecvMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// RecvMsg indicates an expected call of RecvMsg.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) RecvMsg(m any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).RecvMsg), m)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m_2 *MockDfdaemon_DownloadTaskClient) SendMsg(m any) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "SendMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) SendMsg(m any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).SendMsg), m)
|
||||
}
|
||||
|
||||
// Trailer mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskClient) Trailer() metadata.MD {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Trailer")
|
||||
ret0, _ := ret[0].(metadata.MD)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Trailer indicates an expected call of Trailer.
|
||||
func (mr *MockDfdaemon_DownloadTaskClientMockRecorder) Trailer() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockDfdaemon_DownloadTaskClient)(nil).Trailer))
|
||||
}
|
||||
|
||||
// MockDfdaemonServer is a mock of DfdaemonServer interface.
|
||||
type MockDfdaemonServer struct {
|
||||
ctrl *gomock.Controller
|
||||
|
|
@ -339,12 +462,11 @@ func (mr *MockDfdaemonServerMockRecorder) DeleteTask(arg0, arg1 any) *gomock.Cal
|
|||
}
|
||||
|
||||
// DownloadTask mocks base method.
|
||||
func (m *MockDfdaemonServer) DownloadTask(arg0 context.Context, arg1 *dfdaemon.DownloadTaskRequest) (*emptypb.Empty, error) {
|
||||
func (m *MockDfdaemonServer) DownloadTask(arg0 *dfdaemon.DownloadTaskRequest, arg1 dfdaemon.Dfdaemon_DownloadTaskServer) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "DownloadTask", arg0, arg1)
|
||||
ret0, _ := ret[0].(*emptypb.Empty)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// DownloadTask indicates an expected call of DownloadTask.
|
||||
|
|
@ -580,3 +702,122 @@ func (mr *MockDfdaemon_SyncPiecesServerMockRecorder) SetTrailer(arg0 any) *gomoc
|
|||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockDfdaemon_SyncPiecesServer)(nil).SetTrailer), arg0)
|
||||
}
|
||||
|
||||
// MockDfdaemon_DownloadTaskServer is a mock of Dfdaemon_DownloadTaskServer interface.
|
||||
type MockDfdaemon_DownloadTaskServer struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDfdaemon_DownloadTaskServerMockRecorder
|
||||
}
|
||||
|
||||
// MockDfdaemon_DownloadTaskServerMockRecorder is the mock recorder for MockDfdaemon_DownloadTaskServer.
|
||||
type MockDfdaemon_DownloadTaskServerMockRecorder struct {
|
||||
mock *MockDfdaemon_DownloadTaskServer
|
||||
}
|
||||
|
||||
// NewMockDfdaemon_DownloadTaskServer creates a new mock instance.
|
||||
func NewMockDfdaemon_DownloadTaskServer(ctrl *gomock.Controller) *MockDfdaemon_DownloadTaskServer {
|
||||
mock := &MockDfdaemon_DownloadTaskServer{ctrl: ctrl}
|
||||
mock.recorder = &MockDfdaemon_DownloadTaskServerMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) EXPECT() *MockDfdaemon_DownloadTaskServerMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Context mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) Context() context.Context {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Context")
|
||||
ret0, _ := ret[0].(context.Context)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Context indicates an expected call of Context.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) Context() *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).Context))
|
||||
}
|
||||
|
||||
// RecvMsg mocks base method.
|
||||
func (m_2 *MockDfdaemon_DownloadTaskServer) RecvMsg(m any) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "RecvMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// RecvMsg indicates an expected call of RecvMsg.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) RecvMsg(m any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).RecvMsg), m)
|
||||
}
|
||||
|
||||
// Send mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) Send(arg0 *dfdaemon.DownloadTaskResponse) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "Send", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Send indicates an expected call of Send.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) Send(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).Send), arg0)
|
||||
}
|
||||
|
||||
// SendHeader mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) SendHeader(arg0 metadata.MD) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SendHeader", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendHeader indicates an expected call of SendHeader.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) SendHeader(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).SendHeader), arg0)
|
||||
}
|
||||
|
||||
// SendMsg mocks base method.
|
||||
func (m_2 *MockDfdaemon_DownloadTaskServer) SendMsg(m any) error {
|
||||
m_2.ctrl.T.Helper()
|
||||
ret := m_2.ctrl.Call(m_2, "SendMsg", m)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SendMsg indicates an expected call of SendMsg.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) SendMsg(m any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).SendMsg), m)
|
||||
}
|
||||
|
||||
// SetHeader mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) SetHeader(arg0 metadata.MD) error {
|
||||
m.ctrl.T.Helper()
|
||||
ret := m.ctrl.Call(m, "SetHeader", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetHeader indicates an expected call of SetHeader.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) SetHeader(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).SetHeader), arg0)
|
||||
}
|
||||
|
||||
// SetTrailer mocks base method.
|
||||
func (m *MockDfdaemon_DownloadTaskServer) SetTrailer(arg0 metadata.MD) {
|
||||
m.ctrl.T.Helper()
|
||||
m.ctrl.Call(m, "SetTrailer", arg0)
|
||||
}
|
||||
|
||||
// SetTrailer indicates an expected call of SetTrailer.
|
||||
func (mr *MockDfdaemon_DownloadTaskServerMockRecorder) SetTrailer(arg0 any) *gomock.Call {
|
||||
mr.mock.ctrl.T.Helper()
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockDfdaemon_DownloadTaskServer)(nil).SetTrailer), arg0)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,6 +68,12 @@ message DownloadTaskRequest {
|
|||
common.v2.Download download = 1;
|
||||
}
|
||||
|
||||
// DownloadTaskResponse represents response of DownloadTask.
|
||||
message DownloadTaskResponse {
|
||||
// Finished piece of task.
|
||||
common.v2.Piece piece = 1;
|
||||
}
|
||||
|
||||
// UploadTaskRequest represents request of UploadTask.
|
||||
message UploadTaskRequest {
|
||||
// Task metadata.
|
||||
|
|
@ -95,7 +101,7 @@ service Dfdaemon{
|
|||
rpc SyncPieces(stream SyncPiecesRequest)returns(stream SyncPiecesResponse);
|
||||
|
||||
// DownloadTask downloads task back-to-source.
|
||||
rpc DownloadTask(DownloadTaskRequest) returns(google.protobuf.Empty);
|
||||
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
|
||||
|
||||
// UploadTask uploads task to p2p network.
|
||||
rpc UploadTask(UploadTaskRequest) returns(google.protobuf.Empty);
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -82,6 +82,15 @@ pub struct DownloadTaskRequest {
|
|||
#[prost(message, optional, tag = "1")]
|
||||
pub download: ::core::option::Option<super::super::common::v2::Download>,
|
||||
}
|
||||
/// DownloadTaskResponse represents response of DownloadTask.
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct DownloadTaskResponse {
|
||||
/// Finished piece of task.
|
||||
#[prost(message, optional, tag = "1")]
|
||||
pub piece: ::core::option::Option<super::super::common::v2::Piece>,
|
||||
}
|
||||
/// UploadTaskRequest represents request of UploadTask.
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
#[allow(clippy::derive_partial_eq_without_eq)]
|
||||
|
|
@ -251,7 +260,10 @@ pub mod dfdaemon_client {
|
|||
pub async fn download_task(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::DownloadTaskRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status> {
|
||||
) -> std::result::Result<
|
||||
tonic::Response<tonic::codec::Streaming<super::DownloadTaskResponse>>,
|
||||
tonic::Status,
|
||||
> {
|
||||
self.inner
|
||||
.ready()
|
||||
.await
|
||||
|
|
@ -268,7 +280,7 @@ pub mod dfdaemon_client {
|
|||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(GrpcMethod::new("dfdaemon.v2.Dfdaemon", "DownloadTask"));
|
||||
self.inner.unary(req, path, codec).await
|
||||
self.inner.server_streaming(req, path, codec).await
|
||||
}
|
||||
/// UploadTask uploads task to p2p network.
|
||||
pub async fn upload_task(
|
||||
|
|
@ -370,11 +382,20 @@ pub mod dfdaemon_server {
|
|||
&self,
|
||||
request: tonic::Request<tonic::Streaming<super::SyncPiecesRequest>>,
|
||||
) -> std::result::Result<tonic::Response<Self::SyncPiecesStream>, tonic::Status>;
|
||||
/// Server streaming response type for the DownloadTask method.
|
||||
type DownloadTaskStream: futures_core::Stream<
|
||||
Item = std::result::Result<super::DownloadTaskResponse, tonic::Status>,
|
||||
>
|
||||
+ Send
|
||||
+ 'static;
|
||||
/// DownloadTask downloads task back-to-source.
|
||||
async fn download_task(
|
||||
&self,
|
||||
request: tonic::Request<super::DownloadTaskRequest>,
|
||||
) -> std::result::Result<tonic::Response<()>, tonic::Status>;
|
||||
) -> std::result::Result<
|
||||
tonic::Response<Self::DownloadTaskStream>,
|
||||
tonic::Status,
|
||||
>;
|
||||
/// UploadTask uploads task to p2p network.
|
||||
async fn upload_task(
|
||||
&self,
|
||||
|
|
@ -572,11 +593,12 @@ pub mod dfdaemon_server {
|
|||
struct DownloadTaskSvc<T: Dfdaemon>(pub Arc<T>);
|
||||
impl<
|
||||
T: Dfdaemon,
|
||||
> tonic::server::UnaryService<super::DownloadTaskRequest>
|
||||
> tonic::server::ServerStreamingService<super::DownloadTaskRequest>
|
||||
for DownloadTaskSvc<T> {
|
||||
type Response = ();
|
||||
type Response = super::DownloadTaskResponse;
|
||||
type ResponseStream = T::DownloadTaskStream;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Response<Self::ResponseStream>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
|
|
@ -608,7 +630,7 @@ pub mod dfdaemon_server {
|
|||
max_decoding_message_size,
|
||||
max_encoding_message_size,
|
||||
);
|
||||
let res = grpc.unary(method, req).await;
|
||||
let res = grpc.server_streaming(method, req).await;
|
||||
Ok(res)
|
||||
};
|
||||
Box::pin(fut)
|
||||
|
|
|
|||
Loading…
Reference in New Issue