/* * 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; import "common.proto"; import "errordetails.proto"; import "google/protobuf/empty.proto"; // 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; } // SyncPiecesRequest represents request of AnnouncePeer. message SyncPiecesRequest{ oneof request { 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.Piece pieces = 1; } // SyncPiecesResponse represents response of SyncPieces. message SyncPiecesResponse { oneof response { InterestedPiecesResponse interested_pieces_response = 1; } oneof errordetails { errordetails.SyncPiecesFailed sync_pieces_failed = 3; } } // DownloadTaskRequest represents request of DownloadTask. message DownloadTaskRequest { // Download information. common.Download download = 1; } // UploadTaskRequest represents request of UploadTask. message UploadTaskRequest { // Task metadata. common.Task task = 1; } // StatTaskRequest represents request of StatTask. message StatTaskRequest { // Task id. string task_id = 1; } // StatTaskResponse represents response of StatTask. message StatTaskResponse { // Task metadata. common.Task task = 1; } // DeleteTaskRequest represents request of DeleteTask. message DeleteTaskRequest { // Task id. string task_id = 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.Task); // DeleteTask deletes task from p2p network. rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty); }