mirror of https://github.com/dragonflyoss/api.git
126 lines
3.4 KiB
Protocol Buffer
126 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 "common.proto";
|
|
import "google/protobuf/empty.proto";
|
|
|
|
// TriggerDownloadTaskRequest represents request of TriggerDownloadTask.
|
|
message TriggerDownloadTaskRequest {
|
|
// Download information.
|
|
common.v2.Download download = 1;
|
|
}
|
|
|
|
// SyncPiecesRequest represents request of SyncPieces.
|
|
message SyncPiecesRequest {
|
|
// Task id.
|
|
string task_id = 1;
|
|
// Interested piece numbers.
|
|
repeated uint32 interested_piece_numbers = 2;
|
|
}
|
|
|
|
// SyncPiecesResponse represents response of SyncPieces.
|
|
message SyncPiecesResponse {
|
|
// Exist piece number.
|
|
uint32 number = 1;
|
|
// Piece offset.
|
|
uint64 offset = 2;
|
|
// Piece length.
|
|
uint64 length = 3;
|
|
}
|
|
|
|
// DownloadPieceRequest represents request of DownloadPiece.
|
|
message DownloadPieceRequest{
|
|
// Task id.
|
|
string task_id = 1;
|
|
// Piece number.
|
|
uint32 piece_number = 2;
|
|
}
|
|
|
|
// DownloadPieceResponse represents response of DownloadPieces.
|
|
message DownloadPieceResponse {
|
|
// Piece information.
|
|
common.v2.Piece piece = 1;
|
|
}
|
|
|
|
// DfdaemonUpload represents upload service of dfdaemon.
|
|
service DfdaemonUpload{
|
|
// TriggerDownloadTask triggers download task.
|
|
rpc TriggerDownloadTask(TriggerDownloadTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// SyncPieces syncs piece metadatas from remote peer.
|
|
rpc SyncPieces(SyncPiecesRequest) returns(stream SyncPiecesResponse);
|
|
|
|
// DownloadPiece downloads piece from the remote peer.
|
|
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 {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
// Task response headers.
|
|
map<string, string> response_header = 4;
|
|
// Finished piece of task.
|
|
common.v2.Piece piece = 5;
|
|
}
|
|
|
|
// UploadTaskRequest represents request of UploadTask.
|
|
message UploadTaskRequest {
|
|
// Task metadata.
|
|
common.v2.Task task = 1;
|
|
}
|
|
|
|
// StatTaskRequest represents request of StatTask.
|
|
message StatTaskRequest {
|
|
// Task id.
|
|
string task_id = 1;
|
|
}
|
|
|
|
// DeleteTaskRequest represents request of DeleteTask.
|
|
message DeleteTaskRequest {
|
|
// Task id.
|
|
string task_id = 1;
|
|
}
|
|
|
|
// DfdaemonDownload represents download service of dfdaemon.
|
|
service DfdaemonDownload{
|
|
// DownloadTask downloads task back-to-source.
|
|
rpc DownloadTask(DownloadTaskRequest) returns(stream DownloadTaskResponse);
|
|
|
|
// 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);
|
|
}
|