feat: add DownloadTask to DfdaemonUpload (#232)

Signed-off-by: Gaius <gaius.qi@gmail.com>
This commit is contained in:
Gaius 2023-12-18 21:23:19 +08:00 committed by GitHub
parent 5425d1bb1b
commit 79249ee02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1041 additions and 599 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "dragonfly-api"
version = "2.0.63"
version = "2.0.64"
authors = ["Gaius <gaius.qi@gmail.com>"]
edition = "2021"
license = "Apache-2.0"

View File

@ -38,6 +38,113 @@ const (
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// DownloadTaskRequest represents request of DownloadTask.
type DownloadTaskRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Download information.
Download *v2.Download `protobuf:"bytes,1,opt,name=download,proto3" json:"download,omitempty"`
}
func (x *DownloadTaskRequest) Reset() {
*x = DownloadTaskRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DownloadTaskRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadTaskRequest) ProtoMessage() {}
func (x *DownloadTaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_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 DownloadTaskRequest.ProtoReflect.Descriptor instead.
func (*DownloadTaskRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{0}
}
func (x *DownloadTaskRequest) GetDownload() *v2.Download {
if x != nil {
return x.Download
}
return nil
}
// DownloadTaskResponse represents response of DownloadTask.
type DownloadTaskResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Task content length.
ContentLength uint64 `protobuf:"varint,1,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
// Finished piece of task.
Piece *v2.Piece `protobuf:"bytes,2,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[1]
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[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 DownloadTaskResponse.ProtoReflect.Descriptor instead.
func (*DownloadTaskResponse) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{1}
}
func (x *DownloadTaskResponse) GetContentLength() uint64 {
if x != nil {
return x.ContentLength
}
return 0
}
func (x *DownloadTaskResponse) GetPiece() *v2.Piece {
if x != nil {
return x.Piece
}
return nil
}
// SyncPiecesRequest represents request of SyncPieces.
type SyncPiecesRequest struct {
state protoimpl.MessageState
@ -53,7 +160,7 @@ type SyncPiecesRequest struct {
func (x *SyncPiecesRequest) Reset() {
*x = SyncPiecesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[0]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -66,7 +173,7 @@ func (x *SyncPiecesRequest) String() string {
func (*SyncPiecesRequest) ProtoMessage() {}
func (x *SyncPiecesRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[0]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -79,7 +186,7 @@ func (x *SyncPiecesRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use SyncPiecesRequest.ProtoReflect.Descriptor instead.
func (*SyncPiecesRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{0}
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{2}
}
func (x *SyncPiecesRequest) GetTaskId() string {
@ -109,7 +216,7 @@ type SyncPiecesResponse struct {
func (x *SyncPiecesResponse) Reset() {
*x = SyncPiecesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[1]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -122,7 +229,7 @@ func (x *SyncPiecesResponse) String() string {
func (*SyncPiecesResponse) ProtoMessage() {}
func (x *SyncPiecesResponse) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[1]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -135,7 +242,7 @@ func (x *SyncPiecesResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use SyncPiecesResponse.ProtoReflect.Descriptor instead.
func (*SyncPiecesResponse) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{1}
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{3}
}
func (x *SyncPiecesResponse) GetPieceNumber() uint32 {
@ -160,7 +267,7 @@ type DownloadPieceRequest struct {
func (x *DownloadPieceRequest) Reset() {
*x = DownloadPieceRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[2]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -173,7 +280,7 @@ func (x *DownloadPieceRequest) String() string {
func (*DownloadPieceRequest) ProtoMessage() {}
func (x *DownloadPieceRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[2]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -186,7 +293,7 @@ func (x *DownloadPieceRequest) ProtoReflect() protoreflect.Message {
// Deprecated: Use DownloadPieceRequest.ProtoReflect.Descriptor instead.
func (*DownloadPieceRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{2}
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{4}
}
func (x *DownloadPieceRequest) GetTaskId() string {
@ -216,7 +323,7 @@ type DownloadPieceResponse struct {
func (x *DownloadPieceResponse) Reset() {
*x = DownloadPieceResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[3]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@ -229,7 +336,7 @@ func (x *DownloadPieceResponse) String() string {
func (*DownloadPieceResponse) ProtoMessage() {}
func (x *DownloadPieceResponse) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[3]
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@ -242,117 +349,10 @@ func (x *DownloadPieceResponse) ProtoReflect() protoreflect.Message {
// Deprecated: Use DownloadPieceResponse.ProtoReflect.Descriptor instead.
func (*DownloadPieceResponse) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{3}
}
func (x *DownloadPieceResponse) GetPiece() *v2.Piece {
if x != nil {
return x.Piece
}
return nil
}
// DownloadTaskRequest represents request of DownloadTask.
type DownloadTaskRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Download information.
Download *v2.Download `protobuf:"bytes,1,opt,name=download,proto3" json:"download,omitempty"`
}
func (x *DownloadTaskRequest) Reset() {
*x = DownloadTaskRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *DownloadTaskRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*DownloadTaskRequest) ProtoMessage() {}
func (x *DownloadTaskRequest) ProtoReflect() protoreflect.Message {
mi := &file_pkg_apis_dfdaemon_v2_dfdaemon_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 DownloadTaskRequest.ProtoReflect.Descriptor instead.
func (*DownloadTaskRequest) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{4}
}
func (x *DownloadTaskRequest) GetDownload() *v2.Download {
if x != nil {
return x.Download
}
return nil
}
// DownloadTaskResponse represents response of DownloadTask.
type DownloadTaskResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Task content length.
ContentLength uint64 `protobuf:"varint,1,opt,name=content_length,json=contentLength,proto3" json:"content_length,omitempty"`
// Finished piece of task.
Piece *v2.Piece `protobuf:"bytes,2,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[5]
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[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 DownloadTaskResponse.ProtoReflect.Descriptor instead.
func (*DownloadTaskResponse) Descriptor() ([]byte, []int) {
return file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP(), []int{5}
}
func (x *DownloadTaskResponse) GetContentLength() uint64 {
if x != nil {
return x.ContentLength
}
return 0
}
func (x *DownloadTaskResponse) GetPiece() *v2.Piece {
func (x *DownloadPieceResponse) GetPiece() *v2.Piece {
if x != nil {
return x.Piece
}
@ -517,39 +517,39 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc = []byte{
0x6f, 0x74, 0x6f, 0x1a, 0x1b, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x62, 0x75, 0x66, 0x2f, 0x65, 0x6d, 0x70, 0x74, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x1a, 0x17, 0x76, 0x61, 0x6c, 0x69, 0x64, 0x61, 0x74, 0x65, 0x2f, 0x76, 0x61, 0x6c, 0x69, 0x64,
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x79, 0x0a, 0x11, 0x53, 0x79, 0x6e,
0x63, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 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,
0x12, 0x42, 0x0a, 0x18, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x65, 0x64, 0x5f, 0x70,
0x69, 0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, 0x03,
0x28, 0x0d, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52, 0x16, 0x69, 0x6e,
0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d,
0x62, 0x65, 0x72, 0x73, 0x22, 0x37, 0x0a, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65, 0x63,
0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x69,
0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x5b, 0x0a,
0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 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, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x69, 0x65, 0x63, 0x65,
0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0b, 0x70,
0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x49, 0x0a, 0x15, 0x44, 0x6f,
0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 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, 0x50, 0x0a, 0x13, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61,
0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 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, 0x6f, 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c,
0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12,
0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c, 0x65, 0x6e, 0x67, 0x74,
0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74,
0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x70, 0x69, 0x65, 0x63, 0x65, 0x18,
0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x76,
0x61, 0x74, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x50, 0x0a, 0x13, 0x44, 0x6f, 0x77,
0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x12, 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, 0x6f, 0x0a, 0x14, 0x44,
0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x54, 0x61, 0x73, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f,
0x6e, 0x73, 0x65, 0x12, 0x25, 0x0a, 0x0e, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x5f, 0x6c,
0x65, 0x6e, 0x67, 0x74, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0d, 0x63, 0x6f, 0x6e,
0x74, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x12, 0x30, 0x0a, 0x05, 0x70, 0x69,
0x65, 0x63, 0x65, 0x18, 0x02, 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, 0x79, 0x0a, 0x11,
0x53, 0x79, 0x6e, 0x63, 0x50, 0x69, 0x65, 0x63, 0x65, 0x73, 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, 0x12, 0x42, 0x0a, 0x18, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x65,
0x64, 0x5f, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18,
0x02, 0x20, 0x03, 0x28, 0x0d, 0x42, 0x08, 0xfa, 0x42, 0x05, 0x92, 0x01, 0x02, 0x08, 0x01, 0x52,
0x16, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x65, 0x73, 0x74, 0x65, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65,
0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0x37, 0x0a, 0x12, 0x53, 0x79, 0x6e, 0x63, 0x50,
0x69, 0x65, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a,
0x0c, 0x70, 0x69, 0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x01, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
0x22, 0x5b, 0x0a, 0x14, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63,
0x65, 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, 0x12, 0x21, 0x0a, 0x0c, 0x70, 0x69,
0x65, 0x63, 0x65, 0x5f, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x0b, 0x70, 0x69, 0x65, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x49, 0x0a,
0x15, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 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,
@ -562,41 +562,47 @@ var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDesc = []byte{
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, 0xb9, 0x01, 0x0a, 0x0e, 0x44, 0x66, 0x64,
0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 0x12, 0x4f, 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, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x0d,
0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 0x12, 0x21, 0x2e,
0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x6f, 0x77, 0x6e,
0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x22, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44,
0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb0, 0x02, 0x0a, 0x10, 0x44, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f,
0x6e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 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,
0x52, 0x06, 0x74, 0x61, 0x73, 0x6b, 0x49, 0x64, 0x32, 0x90, 0x02, 0x0a, 0x0e, 0x44, 0x66, 0x64,
0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x55, 0x70, 0x6c, 0x6f, 0x61, 0x64, 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, 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,
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, 0x4f, 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, 0x30, 0x01, 0x12, 0x56, 0x0a, 0x0d, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50,
0x69, 0x65, 0x63, 0x65, 0x12, 0x21, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x2e,
0x76, 0x32, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69, 0x65, 0x63, 0x65,
0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x64, 0x66, 0x64, 0x61, 0x65, 0x6d,
0x6f, 0x6e, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64, 0x50, 0x69,
0x65, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb0, 0x02, 0x0a, 0x10,
0x44, 0x66, 0x64, 0x61, 0x65, 0x6d, 0x6f, 0x6e, 0x44, 0x6f, 0x77, 0x6e, 0x6c, 0x6f, 0x61, 0x64,
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 (
@ -613,39 +619,41 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_rawDescGZIP() []byte {
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_goTypes = []interface{}{
(*SyncPiecesRequest)(nil), // 0: dfdaemon.v2.SyncPiecesRequest
(*SyncPiecesResponse)(nil), // 1: dfdaemon.v2.SyncPiecesResponse
(*DownloadPieceRequest)(nil), // 2: dfdaemon.v2.DownloadPieceRequest
(*DownloadPieceResponse)(nil), // 3: dfdaemon.v2.DownloadPieceResponse
(*DownloadTaskRequest)(nil), // 4: dfdaemon.v2.DownloadTaskRequest
(*DownloadTaskResponse)(nil), // 5: dfdaemon.v2.DownloadTaskResponse
(*DownloadTaskRequest)(nil), // 0: dfdaemon.v2.DownloadTaskRequest
(*DownloadTaskResponse)(nil), // 1: dfdaemon.v2.DownloadTaskResponse
(*SyncPiecesRequest)(nil), // 2: dfdaemon.v2.SyncPiecesRequest
(*SyncPiecesResponse)(nil), // 3: dfdaemon.v2.SyncPiecesResponse
(*DownloadPieceRequest)(nil), // 4: dfdaemon.v2.DownloadPieceRequest
(*DownloadPieceResponse)(nil), // 5: dfdaemon.v2.DownloadPieceResponse
(*UploadTaskRequest)(nil), // 6: dfdaemon.v2.UploadTaskRequest
(*StatTaskRequest)(nil), // 7: dfdaemon.v2.StatTaskRequest
(*DeleteTaskRequest)(nil), // 8: dfdaemon.v2.DeleteTaskRequest
(*v2.Piece)(nil), // 9: common.v2.Piece
(*v2.Download)(nil), // 10: common.v2.Download
(*v2.Download)(nil), // 9: common.v2.Download
(*v2.Piece)(nil), // 10: common.v2.Piece
(*v2.Task)(nil), // 11: common.v2.Task
(*emptypb.Empty)(nil), // 12: google.protobuf.Empty
}
var file_pkg_apis_dfdaemon_v2_dfdaemon_proto_depIdxs = []int32{
9, // 0: dfdaemon.v2.DownloadPieceResponse.piece:type_name -> common.v2.Piece
10, // 1: dfdaemon.v2.DownloadTaskRequest.download:type_name -> common.v2.Download
9, // 2: dfdaemon.v2.DownloadTaskResponse.piece:type_name -> common.v2.Piece
9, // 0: dfdaemon.v2.DownloadTaskRequest.download:type_name -> common.v2.Download
10, // 1: dfdaemon.v2.DownloadTaskResponse.piece:type_name -> common.v2.Piece
10, // 2: dfdaemon.v2.DownloadPieceResponse.piece:type_name -> common.v2.Piece
11, // 3: dfdaemon.v2.UploadTaskRequest.task:type_name -> common.v2.Task
0, // 4: dfdaemon.v2.DfdaemonUpload.SyncPieces:input_type -> dfdaemon.v2.SyncPiecesRequest
2, // 5: dfdaemon.v2.DfdaemonUpload.DownloadPiece:input_type -> dfdaemon.v2.DownloadPieceRequest
4, // 6: dfdaemon.v2.DfdaemonDownload.DownloadTask:input_type -> dfdaemon.v2.DownloadTaskRequest
6, // 7: dfdaemon.v2.DfdaemonDownload.UploadTask:input_type -> dfdaemon.v2.UploadTaskRequest
7, // 8: dfdaemon.v2.DfdaemonDownload.StatTask:input_type -> dfdaemon.v2.StatTaskRequest
8, // 9: dfdaemon.v2.DfdaemonDownload.DeleteTask:input_type -> dfdaemon.v2.DeleteTaskRequest
1, // 10: dfdaemon.v2.DfdaemonUpload.SyncPieces:output_type -> dfdaemon.v2.SyncPiecesResponse
3, // 11: dfdaemon.v2.DfdaemonUpload.DownloadPiece:output_type -> dfdaemon.v2.DownloadPieceResponse
5, // 12: dfdaemon.v2.DfdaemonDownload.DownloadTask:output_type -> dfdaemon.v2.DownloadTaskResponse
12, // 13: dfdaemon.v2.DfdaemonDownload.UploadTask:output_type -> google.protobuf.Empty
11, // 14: dfdaemon.v2.DfdaemonDownload.StatTask:output_type -> common.v2.Task
12, // 15: dfdaemon.v2.DfdaemonDownload.DeleteTask:output_type -> google.protobuf.Empty
10, // [10:16] is the sub-list for method output_type
4, // [4:10] is the sub-list for method input_type
0, // 4: dfdaemon.v2.DfdaemonUpload.DownloadTask:input_type -> dfdaemon.v2.DownloadTaskRequest
2, // 5: dfdaemon.v2.DfdaemonUpload.SyncPieces:input_type -> dfdaemon.v2.SyncPiecesRequest
4, // 6: dfdaemon.v2.DfdaemonUpload.DownloadPiece:input_type -> dfdaemon.v2.DownloadPieceRequest
0, // 7: dfdaemon.v2.DfdaemonDownload.DownloadTask:input_type -> dfdaemon.v2.DownloadTaskRequest
6, // 8: dfdaemon.v2.DfdaemonDownload.UploadTask:input_type -> dfdaemon.v2.UploadTaskRequest
7, // 9: dfdaemon.v2.DfdaemonDownload.StatTask:input_type -> dfdaemon.v2.StatTaskRequest
8, // 10: dfdaemon.v2.DfdaemonDownload.DeleteTask:input_type -> dfdaemon.v2.DeleteTaskRequest
1, // 11: dfdaemon.v2.DfdaemonUpload.DownloadTask:output_type -> dfdaemon.v2.DownloadTaskResponse
3, // 12: dfdaemon.v2.DfdaemonUpload.SyncPieces:output_type -> dfdaemon.v2.SyncPiecesResponse
5, // 13: dfdaemon.v2.DfdaemonUpload.DownloadPiece:output_type -> dfdaemon.v2.DownloadPieceResponse
1, // 14: dfdaemon.v2.DfdaemonDownload.DownloadTask:output_type -> dfdaemon.v2.DownloadTaskResponse
12, // 15: dfdaemon.v2.DfdaemonDownload.UploadTask:output_type -> google.protobuf.Empty
11, // 16: dfdaemon.v2.DfdaemonDownload.StatTask:output_type -> common.v2.Task
12, // 17: dfdaemon.v2.DfdaemonDownload.DeleteTask:output_type -> google.protobuf.Empty
11, // [11:18] is the sub-list for method output_type
4, // [4:11] is the sub-list for method input_type
4, // [4:4] is the sub-list for extension type_name
4, // [4:4] is the sub-list for extension extendee
0, // [0:4] is the sub-list for field type_name
@ -658,54 +666,6 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
}
if !protoimpl.UnsafeEnabled {
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncPiecesRequest); 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[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncPiecesResponse); 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[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadPieceRequest); 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[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadPieceResponse); 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[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadTaskRequest); i {
case 0:
return &v.state
@ -717,7 +677,7 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
return nil
}
}
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadTaskResponse); i {
case 0:
return &v.state
@ -729,6 +689,54 @@ func file_pkg_apis_dfdaemon_v2_dfdaemon_proto_init() {
return nil
}
}
file_pkg_apis_dfdaemon_v2_dfdaemon_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncPiecesRequest); 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[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*SyncPiecesResponse); 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[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadPieceRequest); 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[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DownloadPieceResponse); 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[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*UploadTaskRequest); i {
case 0:

View File

@ -35,6 +35,292 @@ var (
_ = sort.Sort
)
// Validate checks the field values on DownloadTaskRequest 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 *DownloadTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadTaskRequest 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
// DownloadTaskRequestMultiError, or nil if none found.
func (m *DownloadTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetDownload() == nil {
err := DownloadTaskRequestValidationError{
field: "Download",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetDownload()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownload()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return DownloadTaskRequestMultiError(errors)
}
return nil
}
// DownloadTaskRequestMultiError is an error wrapping multiple validation
// errors returned by DownloadTaskRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadTaskRequestMultiError) 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 DownloadTaskRequestMultiError) AllErrors() []error { return m }
// DownloadTaskRequestValidationError is the validation error returned by
// DownloadTaskRequest.Validate if the designated constraints aren't met.
type DownloadTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadTaskRequestValidationError) ErrorName() string {
return "DownloadTaskRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadTaskRequestValidationError) 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 %sDownloadTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
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
// no validation rules for ContentLength
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 SyncPiecesRequest 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.
@ -520,292 +806,6 @@ var _ interface {
ErrorName() string
} = DownloadPieceResponseValidationError{}
// Validate checks the field values on DownloadTaskRequest 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 *DownloadTaskRequest) Validate() error {
return m.validate(false)
}
// ValidateAll checks the field values on DownloadTaskRequest 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
// DownloadTaskRequestMultiError, or nil if none found.
func (m *DownloadTaskRequest) ValidateAll() error {
return m.validate(true)
}
func (m *DownloadTaskRequest) validate(all bool) error {
if m == nil {
return nil
}
var errors []error
if m.GetDownload() == nil {
err := DownloadTaskRequestValidationError{
field: "Download",
reason: "value is required",
}
if !all {
return err
}
errors = append(errors, err)
}
if all {
switch v := interface{}(m.GetDownload()).(type) {
case interface{ ValidateAll() error }:
if err := v.ValidateAll(); err != nil {
errors = append(errors, DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
case interface{ Validate() error }:
if err := v.Validate(); err != nil {
errors = append(errors, DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
})
}
}
} else if v, ok := interface{}(m.GetDownload()).(interface{ Validate() error }); ok {
if err := v.Validate(); err != nil {
return DownloadTaskRequestValidationError{
field: "Download",
reason: "embedded message failed validation",
cause: err,
}
}
}
if len(errors) > 0 {
return DownloadTaskRequestMultiError(errors)
}
return nil
}
// DownloadTaskRequestMultiError is an error wrapping multiple validation
// errors returned by DownloadTaskRequest.ValidateAll() if the designated
// constraints aren't met.
type DownloadTaskRequestMultiError []error
// Error returns a concatenation of all the error messages it wraps.
func (m DownloadTaskRequestMultiError) 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 DownloadTaskRequestMultiError) AllErrors() []error { return m }
// DownloadTaskRequestValidationError is the validation error returned by
// DownloadTaskRequest.Validate if the designated constraints aren't met.
type DownloadTaskRequestValidationError struct {
field string
reason string
cause error
key bool
}
// Field function returns field value.
func (e DownloadTaskRequestValidationError) Field() string { return e.field }
// Reason function returns reason value.
func (e DownloadTaskRequestValidationError) Reason() string { return e.reason }
// Cause function returns cause value.
func (e DownloadTaskRequestValidationError) Cause() error { return e.cause }
// Key function returns key value.
func (e DownloadTaskRequestValidationError) Key() bool { return e.key }
// ErrorName returns error name.
func (e DownloadTaskRequestValidationError) ErrorName() string {
return "DownloadTaskRequestValidationError"
}
// Error satisfies the builtin error interface
func (e DownloadTaskRequestValidationError) 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 %sDownloadTaskRequest.%s: %s%s",
key,
e.field,
e.reason,
cause)
}
var _ error = DownloadTaskRequestValidationError{}
var _ interface {
Field() string
Reason() string
Key() bool
Cause() error
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
// no validation rules for ContentLength
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.

View File

@ -24,6 +24,21 @@ import "validate/validate.proto";
option go_package = "d7y.io/api/v2/pkg/apis/dfdaemon/v2;dfdaemon";
// DownloadTaskRequest represents request of DownloadTask.
message DownloadTaskRequest {
// Download information.
common.v2.Download download = 1 [(validate.rules).message.required = true];
}
// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Task content length.
uint64 content_length = 1;
// Finished piece of task.
common.v2.Piece piece = 2 [(validate.rules).message.required = true];
}
// SyncPiecesRequest represents request of SyncPieces.
message SyncPiecesRequest {
// Task id.
@ -56,6 +71,9 @@ message DownloadPieceResponse {
// DfdaemonUpload represents dfdaemon upload service.
service DfdaemonUpload {
// DownloadTask downloads task back-to-source.
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
// SyncPieces syncs piece metadatas from remote peer.
rpc SyncPieces(SyncPiecesRequest) returns(stream SyncPiecesResponse);
@ -63,21 +81,6 @@ service DfdaemonUpload {
rpc DownloadPiece(DownloadPieceRequest)returns(DownloadPieceResponse);
}
// DownloadTaskRequest represents request of DownloadTask.
message DownloadTaskRequest {
// Download information.
common.v2.Download download = 1 [(validate.rules).message.required = true];
}
// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Task content length.
uint64 content_length = 1;
// Finished piece of task.
common.v2.Piece piece = 2 [(validate.rules).message.required = true];
}
// UploadTaskRequest represents request of UploadTask.
message UploadTaskRequest {
// Task metadata.

View File

@ -24,6 +24,8 @@ const _ = grpc.SupportPackageIsVersion7
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type DfdaemonUploadClient interface {
// DownloadTask downloads task back-to-source.
DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (DfdaemonUpload_DownloadTaskClient, error)
// SyncPieces syncs piece metadatas from remote peer.
SyncPieces(ctx context.Context, in *SyncPiecesRequest, opts ...grpc.CallOption) (DfdaemonUpload_SyncPiecesClient, error)
// DownloadPiece downloads piece from the remote peer.
@ -38,8 +40,40 @@ func NewDfdaemonUploadClient(cc grpc.ClientConnInterface) DfdaemonUploadClient {
return &dfdaemonUploadClient{cc}
}
func (c *dfdaemonUploadClient) DownloadTask(ctx context.Context, in *DownloadTaskRequest, opts ...grpc.CallOption) (DfdaemonUpload_DownloadTaskClient, error) {
stream, err := c.cc.NewStream(ctx, &DfdaemonUpload_ServiceDesc.Streams[0], "/dfdaemon.v2.DfdaemonUpload/DownloadTask", opts...)
if err != nil {
return nil, err
}
x := &dfdaemonUploadDownloadTaskClient{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 DfdaemonUpload_DownloadTaskClient interface {
Recv() (*DownloadTaskResponse, error)
grpc.ClientStream
}
type dfdaemonUploadDownloadTaskClient struct {
grpc.ClientStream
}
func (x *dfdaemonUploadDownloadTaskClient) Recv() (*DownloadTaskResponse, error) {
m := new(DownloadTaskResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
func (c *dfdaemonUploadClient) SyncPieces(ctx context.Context, in *SyncPiecesRequest, opts ...grpc.CallOption) (DfdaemonUpload_SyncPiecesClient, error) {
stream, err := c.cc.NewStream(ctx, &DfdaemonUpload_ServiceDesc.Streams[0], "/dfdaemon.v2.DfdaemonUpload/SyncPieces", opts...)
stream, err := c.cc.NewStream(ctx, &DfdaemonUpload_ServiceDesc.Streams[1], "/dfdaemon.v2.DfdaemonUpload/SyncPieces", opts...)
if err != nil {
return nil, err
}
@ -83,6 +117,8 @@ func (c *dfdaemonUploadClient) DownloadPiece(ctx context.Context, in *DownloadPi
// All implementations should embed UnimplementedDfdaemonUploadServer
// for forward compatibility
type DfdaemonUploadServer interface {
// DownloadTask downloads task back-to-source.
DownloadTask(*DownloadTaskRequest, DfdaemonUpload_DownloadTaskServer) error
// SyncPieces syncs piece metadatas from remote peer.
SyncPieces(*SyncPiecesRequest, DfdaemonUpload_SyncPiecesServer) error
// DownloadPiece downloads piece from the remote peer.
@ -93,6 +129,9 @@ type DfdaemonUploadServer interface {
type UnimplementedDfdaemonUploadServer struct {
}
func (UnimplementedDfdaemonUploadServer) DownloadTask(*DownloadTaskRequest, DfdaemonUpload_DownloadTaskServer) error {
return status.Errorf(codes.Unimplemented, "method DownloadTask not implemented")
}
func (UnimplementedDfdaemonUploadServer) SyncPieces(*SyncPiecesRequest, DfdaemonUpload_SyncPiecesServer) error {
return status.Errorf(codes.Unimplemented, "method SyncPieces not implemented")
}
@ -111,6 +150,27 @@ func RegisterDfdaemonUploadServer(s grpc.ServiceRegistrar, srv DfdaemonUploadSer
s.RegisterService(&DfdaemonUpload_ServiceDesc, srv)
}
func _DfdaemonUpload_DownloadTask_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(DownloadTaskRequest)
if err := stream.RecvMsg(m); err != nil {
return err
}
return srv.(DfdaemonUploadServer).DownloadTask(m, &dfdaemonUploadDownloadTaskServer{stream})
}
type DfdaemonUpload_DownloadTaskServer interface {
Send(*DownloadTaskResponse) error
grpc.ServerStream
}
type dfdaemonUploadDownloadTaskServer struct {
grpc.ServerStream
}
func (x *dfdaemonUploadDownloadTaskServer) Send(m *DownloadTaskResponse) error {
return x.ServerStream.SendMsg(m)
}
func _DfdaemonUpload_SyncPieces_Handler(srv interface{}, stream grpc.ServerStream) error {
m := new(SyncPiecesRequest)
if err := stream.RecvMsg(m); err != nil {
@ -163,6 +223,11 @@ var DfdaemonUpload_ServiceDesc = grpc.ServiceDesc{
},
},
Streams: []grpc.StreamDesc{
{
StreamName: "DownloadTask",
Handler: _DfdaemonUpload_DownloadTask_Handler,
ServerStreams: true,
},
{
StreamName: "SyncPieces",
Handler: _DfdaemonUpload_SyncPieces_Handler,

View File

@ -63,6 +63,26 @@ func (mr *MockDfdaemonUploadClientMockRecorder) DownloadPiece(ctx, in any, opts
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadPiece", reflect.TypeOf((*MockDfdaemonUploadClient)(nil).DownloadPiece), varargs...)
}
// DownloadTask mocks base method.
func (m *MockDfdaemonUploadClient) DownloadTask(ctx context.Context, in *dfdaemon.DownloadTaskRequest, opts ...grpc.CallOption) (dfdaemon.DfdaemonUpload_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].(dfdaemon.DfdaemonUpload_DownloadTaskClient)
ret1, _ := ret[1].(error)
return ret0, ret1
}
// DownloadTask indicates an expected call of DownloadTask.
func (mr *MockDfdaemonUploadClientMockRecorder) DownloadTask(ctx, in any, opts ...any) *gomock.Call {
mr.mock.ctrl.T.Helper()
varargs := append([]any{ctx, in}, opts...)
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadTask", reflect.TypeOf((*MockDfdaemonUploadClient)(nil).DownloadTask), varargs...)
}
// SyncPieces mocks base method.
func (m *MockDfdaemonUploadClient) SyncPieces(ctx context.Context, in *dfdaemon.SyncPiecesRequest, opts ...grpc.CallOption) (dfdaemon.DfdaemonUpload_SyncPiecesClient, error) {
m.ctrl.T.Helper()
@ -83,6 +103,129 @@ func (mr *MockDfdaemonUploadClientMockRecorder) SyncPieces(ctx, in any, opts ...
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SyncPieces", reflect.TypeOf((*MockDfdaemonUploadClient)(nil).SyncPieces), varargs...)
}
// MockDfdaemonUpload_DownloadTaskClient is a mock of DfdaemonUpload_DownloadTaskClient interface.
type MockDfdaemonUpload_DownloadTaskClient struct {
ctrl *gomock.Controller
recorder *MockDfdaemonUpload_DownloadTaskClientMockRecorder
}
// MockDfdaemonUpload_DownloadTaskClientMockRecorder is the mock recorder for MockDfdaemonUpload_DownloadTaskClient.
type MockDfdaemonUpload_DownloadTaskClientMockRecorder struct {
mock *MockDfdaemonUpload_DownloadTaskClient
}
// NewMockDfdaemonUpload_DownloadTaskClient creates a new mock instance.
func NewMockDfdaemonUpload_DownloadTaskClient(ctrl *gomock.Controller) *MockDfdaemonUpload_DownloadTaskClient {
mock := &MockDfdaemonUpload_DownloadTaskClient{ctrl: ctrl}
mock.recorder = &MockDfdaemonUpload_DownloadTaskClientMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockDfdaemonUpload_DownloadTaskClient) EXPECT() *MockDfdaemonUpload_DownloadTaskClientMockRecorder {
return m.recorder
}
// CloseSend mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) CloseSend() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CloseSend", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).CloseSend))
}
// Context mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).Context))
}
// Header mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) Header() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Header", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).Header))
}
// Recv mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) Recv() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Recv", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).Recv))
}
// RecvMsg mocks base method.
func (m_2 *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) RecvMsg(m any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).RecvMsg), m)
}
// SendMsg mocks base method.
func (m_2 *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) SendMsg(m any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).SendMsg), m)
}
// Trailer mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskClientMockRecorder) Trailer() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Trailer", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskClient)(nil).Trailer))
}
// MockDfdaemonUpload_SyncPiecesClient is a mock of DfdaemonUpload_SyncPiecesClient interface.
type MockDfdaemonUpload_SyncPiecesClient struct {
ctrl *gomock.Controller
@ -244,6 +387,20 @@ func (mr *MockDfdaemonUploadServerMockRecorder) DownloadPiece(arg0, arg1 any) *g
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadPiece", reflect.TypeOf((*MockDfdaemonUploadServer)(nil).DownloadPiece), arg0, arg1)
}
// DownloadTask mocks base method.
func (m *MockDfdaemonUploadServer) DownloadTask(arg0 *dfdaemon.DownloadTaskRequest, arg1 dfdaemon.DfdaemonUpload_DownloadTaskServer) error {
m.ctrl.T.Helper()
ret := m.ctrl.Call(m, "DownloadTask", arg0, arg1)
ret0, _ := ret[0].(error)
return ret0
}
// DownloadTask indicates an expected call of DownloadTask.
func (mr *MockDfdaemonUploadServerMockRecorder) DownloadTask(arg0, arg1 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "DownloadTask", reflect.TypeOf((*MockDfdaemonUploadServer)(nil).DownloadTask), arg0, arg1)
}
// SyncPieces mocks base method.
func (m *MockDfdaemonUploadServer) SyncPieces(arg0 *dfdaemon.SyncPiecesRequest, arg1 dfdaemon.DfdaemonUpload_SyncPiecesServer) error {
m.ctrl.T.Helper()
@ -293,6 +450,125 @@ func (mr *MockUnsafeDfdaemonUploadServerMockRecorder) mustEmbedUnimplementedDfda
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "mustEmbedUnimplementedDfdaemonUploadServer", reflect.TypeOf((*MockUnsafeDfdaemonUploadServer)(nil).mustEmbedUnimplementedDfdaemonUploadServer))
}
// MockDfdaemonUpload_DownloadTaskServer is a mock of DfdaemonUpload_DownloadTaskServer interface.
type MockDfdaemonUpload_DownloadTaskServer struct {
ctrl *gomock.Controller
recorder *MockDfdaemonUpload_DownloadTaskServerMockRecorder
}
// MockDfdaemonUpload_DownloadTaskServerMockRecorder is the mock recorder for MockDfdaemonUpload_DownloadTaskServer.
type MockDfdaemonUpload_DownloadTaskServerMockRecorder struct {
mock *MockDfdaemonUpload_DownloadTaskServer
}
// NewMockDfdaemonUpload_DownloadTaskServer creates a new mock instance.
func NewMockDfdaemonUpload_DownloadTaskServer(ctrl *gomock.Controller) *MockDfdaemonUpload_DownloadTaskServer {
mock := &MockDfdaemonUpload_DownloadTaskServer{ctrl: ctrl}
mock.recorder = &MockDfdaemonUpload_DownloadTaskServerMockRecorder{mock}
return mock
}
// EXPECT returns an object that allows the caller to indicate expected use.
func (m *MockDfdaemonUpload_DownloadTaskServer) EXPECT() *MockDfdaemonUpload_DownloadTaskServerMockRecorder {
return m.recorder
}
// Context mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) Context() *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Context", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).Context))
}
// RecvMsg mocks base method.
func (m_2 *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) RecvMsg(m any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "RecvMsg", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).RecvMsg), m)
}
// Send mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) Send(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Send", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).Send), arg0)
}
// SendHeader mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) SendHeader(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendHeader", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).SendHeader), arg0)
}
// SendMsg mocks base method.
func (m_2 *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) SendMsg(m any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendMsg", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).SendMsg), m)
}
// SetHeader mocks base method.
func (m *MockDfdaemonUpload_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 *MockDfdaemonUpload_DownloadTaskServerMockRecorder) SetHeader(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetHeader", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).SetHeader), arg0)
}
// SetTrailer mocks base method.
func (m *MockDfdaemonUpload_DownloadTaskServer) SetTrailer(arg0 metadata.MD) {
m.ctrl.T.Helper()
m.ctrl.Call(m, "SetTrailer", arg0)
}
// SetTrailer indicates an expected call of SetTrailer.
func (mr *MockDfdaemonUpload_DownloadTaskServerMockRecorder) SetTrailer(arg0 any) *gomock.Call {
mr.mock.ctrl.T.Helper()
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetTrailer", reflect.TypeOf((*MockDfdaemonUpload_DownloadTaskServer)(nil).SetTrailer), arg0)
}
// MockDfdaemonUpload_SyncPiecesServer is a mock of DfdaemonUpload_SyncPiecesServer interface.
type MockDfdaemonUpload_SyncPiecesServer struct {
ctrl *gomock.Controller

View File

@ -21,6 +21,21 @@ package dfdaemon.v2;
import "common.proto";
import "google/protobuf/empty.proto";
// DownloadTaskRequest represents request of DownloadTask.
message DownloadTaskRequest {
// Download information.
common.v2.Download download = 1;
}
// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Task content length.
uint64 content_length = 1;
// Finished piece of task.
common.v2.Piece piece = 2;
}
// SyncPiecesRequest represents request of SyncPieces.
message SyncPiecesRequest {
// Task id.
@ -53,6 +68,9 @@ message DownloadPieceResponse {
// DfdaemonUpload represents upload service of dfdaemon.
service DfdaemonUpload{
// DownloadTask downloads task back-to-source.
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
// SyncPieces syncs piece metadatas from remote peer.
rpc SyncPieces(SyncPiecesRequest) returns(stream SyncPiecesResponse);
@ -60,21 +78,6 @@ service DfdaemonUpload{
rpc DownloadPiece(DownloadPieceRequest)returns(DownloadPieceResponse);
}
// DownloadTaskRequest represents request of DownloadTask.
message DownloadTaskRequest {
// Download information.
common.v2.Download download = 1;
}
// DownloadTaskResponse represents response of DownloadTask.
message DownloadTaskResponse {
// Task content length.
uint64 content_length = 1;
// Finished piece of task.
common.v2.Piece piece = 2;
}
// UploadTaskRequest represents request of UploadTask.
message UploadTaskRequest {
// Task metadata.

Binary file not shown.

View File

@ -1,3 +1,24 @@
/// DownloadTaskRequest represents request of DownloadTask.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DownloadTaskRequest {
/// Download information.
#[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 {
/// Task content length.
#[prost(uint64, tag = "1")]
pub content_length: u64,
/// Finished piece of task.
#[prost(message, optional, tag = "2")]
pub piece: ::core::option::Option<super::super::common::v2::Piece>,
}
/// SyncPiecesRequest represents request of SyncPieces.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
@ -40,27 +61,6 @@ pub struct DownloadPieceResponse {
#[prost(message, optional, tag = "1")]
pub piece: ::core::option::Option<super::super::common::v2::Piece>,
}
/// DownloadTaskRequest represents request of DownloadTask.
#[derive(serde::Serialize, serde::Deserialize)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DownloadTaskRequest {
/// Download information.
#[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 {
/// Task content length.
#[prost(uint64, tag = "1")]
pub content_length: u64,
/// Finished piece of task.
#[prost(message, optional, tag = "2")]
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)]
@ -174,6 +174,32 @@ pub mod dfdaemon_upload_client {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
/// DownloadTask downloads task back-to-source.
pub async fn download_task(
&mut self,
request: impl tonic::IntoRequest<super::DownloadTaskRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::DownloadTaskResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/dfdaemon.v2.DfdaemonUpload/DownloadTask",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("dfdaemon.v2.DfdaemonUpload", "DownloadTask"));
self.inner.server_streaming(req, path, codec).await
}
/// SyncPieces syncs piece metadatas from remote peer.
pub async fn sync_pieces(
&mut self,
@ -421,6 +447,20 @@ pub mod dfdaemon_upload_server {
/// Generated trait containing gRPC methods that should be implemented for use with DfdaemonUploadServer.
#[async_trait]
pub trait DfdaemonUpload: Send + Sync + 'static {
/// 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<Self::DownloadTaskStream>,
tonic::Status,
>;
/// Server streaming response type for the SyncPieces method.
type SyncPiecesStream: futures_core::Stream<
Item = std::result::Result<super::SyncPiecesResponse, tonic::Status>,
@ -521,6 +561,53 @@ pub mod dfdaemon_upload_server {
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/dfdaemon.v2.DfdaemonUpload/DownloadTask" => {
#[allow(non_camel_case_types)]
struct DownloadTaskSvc<T: DfdaemonUpload>(pub Arc<T>);
impl<
T: DfdaemonUpload,
> tonic::server::ServerStreamingService<super::DownloadTaskRequest>
for DownloadTaskSvc<T> {
type Response = super::DownloadTaskResponse;
type ResponseStream = T::DownloadTaskStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DownloadTaskRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
(*inner).download_task(request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = DownloadTaskSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/dfdaemon.v2.DfdaemonUpload/SyncPieces" => {
#[allow(non_camel_case_types)]
struct SyncPiecesSvc<T: DfdaemonUpload>(pub Arc<T>);