mirror of https://github.com/dragonflyoss/api.git
109 lines
3.4 KiB
Protocol Buffer
109 lines
3.4 KiB
Protocol Buffer
/*
|
|
* Copyright 2022 The Dragonfly Authors
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
syntax = "proto3";
|
|
|
|
package dfdaemon.v2;
|
|
|
|
import "pkg/apis/common/v2/common.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "validate/validate.proto";
|
|
|
|
option go_package = "d7y.io/api/pkg/apis/dfdaemon/v2;dfdaemon";
|
|
|
|
// InterestedAllPiecesRequest represents interested all pieces request of SyncPiecesRequest.
|
|
message InterestedAllPiecesRequest {
|
|
}
|
|
|
|
// InterestedPiecesRequest represents interested pieces request of SyncPiecesRequest.
|
|
message InterestedPiecesRequest {
|
|
// Interested piece numbers.
|
|
repeated uint32 piece_numbers = 1 [(validate.rules).repeated = {min_items: 1}];
|
|
}
|
|
|
|
// SyncPiecesRequest represents request of AnnouncePeer.
|
|
message SyncPiecesRequest{
|
|
oneof request {
|
|
option (validate.required) = true;
|
|
|
|
InterestedAllPiecesRequest interested_all_pieces_request = 1;
|
|
InterestedPiecesRequest interested_pieces_request = 2;
|
|
}
|
|
}
|
|
|
|
// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse.
|
|
message InterestedPiecesResponse {
|
|
// Interested pieces of task.
|
|
repeated common.v2.Piece pieces = 1 [(validate.rules).repeated = {min_items: 1, ignore_empty: true}];
|
|
}
|
|
|
|
// SyncPiecesResponse represents response of SyncPieces.
|
|
message SyncPiecesResponse {
|
|
oneof response {
|
|
option (validate.required) = true;
|
|
|
|
InterestedPiecesResponse interested_pieces_response = 1;
|
|
}
|
|
}
|
|
|
|
// DownloadTaskRequest represents request of DownloadTask.
|
|
message DownloadTaskRequest {
|
|
// Download information.
|
|
common.v2.Download download = 1 [(validate.rules).message.required = true];
|
|
}
|
|
|
|
// UploadTaskRequest represents request of UploadTask.
|
|
message UploadTaskRequest {
|
|
// Task metadata.
|
|
common.v2.Task task = 1 [(validate.rules).message.required = true];
|
|
}
|
|
|
|
// StatTaskRequest represents request of StatTask.
|
|
message StatTaskRequest {
|
|
// Task id.
|
|
string task_id = 1 [(validate.rules).string.min_len = 1];
|
|
}
|
|
|
|
// StatTaskResponse represents response of StatTask.
|
|
message StatTaskResponse {
|
|
// Task metadata.
|
|
common.v2.Task task = 1 [(validate.rules).message.required = true];
|
|
}
|
|
|
|
// DeleteTaskRequest represents request of DeleteTask.
|
|
message DeleteTaskRequest {
|
|
// Task id.
|
|
string task_id = 1 [(validate.rules).string.min_len = 1];
|
|
}
|
|
|
|
// Dfdaemon RPC Service.
|
|
service Dfdaemon {
|
|
// SyncPieces syncs pieces from the other peers.
|
|
rpc SyncPieces(stream SyncPiecesRequest)returns(stream SyncPiecesResponse);
|
|
|
|
// DownloadTask downloads task back-to-source.
|
|
rpc DownloadTask(DownloadTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// UploadTask uploads task to p2p network.
|
|
rpc UploadTask(UploadTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// StatTask stats task information.
|
|
rpc StatTask(StatTaskRequest) returns(common.v2.Task);
|
|
|
|
// DeleteTask deletes task from p2p network.
|
|
rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty);
|
|
}
|