mirror of https://github.com/dragonflyoss/api.git
143 lines
4.0 KiB
Protocol Buffer
143 lines
4.0 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;
|
|
|
|
import "common.proto";
|
|
import "errordetails.proto";
|
|
import "google/protobuf/duration.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;
|
|
}
|
|
|
|
// StatMetadata represents stat metadata request of SyncPiecesRequest.
|
|
message StatMetadataRequest {
|
|
}
|
|
|
|
// SyncPiecesRequest represents request of AnnouncePeer.
|
|
message SyncPiecesRequest{
|
|
oneof request {
|
|
InterestedAllPiecesRequest interested_all_pieces_request = 1;
|
|
InterestedPiecesRequest interested_pieces_request = 2;
|
|
StatMetadataRequest stat_metadata_request = 3;
|
|
}
|
|
}
|
|
|
|
// InterestedPiecesResponse represents interested pieces response of SyncPiecesResponse.
|
|
message InterestedPiecesResponse {
|
|
// Interested pieces of task.
|
|
repeated common.Piece pieces = 1;
|
|
}
|
|
|
|
// StatMetadata represents stat metadata request of SyncPiecesResponse.
|
|
message StatMetadataResponse {
|
|
// Task metadata.
|
|
common.Metadata metadata = 1;
|
|
}
|
|
|
|
// SyncPiecesResponse represents response of SyncPieces.
|
|
message SyncPiecesResponse {
|
|
oneof response {
|
|
InterestedPiecesResponse interested_pieces_response = 1;
|
|
StatMetadataResponse stat_metadata_response = 2;
|
|
}
|
|
|
|
oneof errordetails {
|
|
errordetails.SyncPiecesFailed sync_pieces_failed = 3;
|
|
errordetails.StatMetadataFailed stat_metadata_failed = 4;
|
|
}
|
|
}
|
|
|
|
// TriggerTaskRequest represents request of TriggerTask.
|
|
message TriggerTaskRequest {
|
|
// Task id.
|
|
string task_id = 1;
|
|
// Task metadata.
|
|
common.Metadata metadata = 2;
|
|
}
|
|
|
|
// StatTaskRequest represents request of StatTask.
|
|
message StatTaskRequest {
|
|
// Task id.
|
|
string task_id = 1;
|
|
}
|
|
|
|
// StatTaskResponse represents response of StatTask.
|
|
message StatTaskResponse {
|
|
common.Task task = 1;
|
|
}
|
|
|
|
// ImportTaskRequest represents request of ImportTask.
|
|
message ImportTaskRequest {
|
|
// Task metadata.
|
|
common.Metadata metadata = 1;
|
|
// File path to be imported.
|
|
string path = 2;
|
|
}
|
|
|
|
// ExportTaskRequest represents request of ExportTask.
|
|
message ExportTaskRequest {
|
|
// Task metadata.
|
|
common.Metadata metadata = 1;
|
|
// File path to be exported.
|
|
string path = 2;
|
|
// Download timeout.
|
|
google.protobuf.Duration timeout = 3;
|
|
// Download rate limit in bytes per second.
|
|
double download_rate_limit = 4;
|
|
// User id.
|
|
uint64 uid = 5;
|
|
// Group id.
|
|
uint64 gid = 6;
|
|
}
|
|
|
|
// 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);
|
|
|
|
// TriggerTask triggers task back-to-source download.
|
|
rpc TriggerTask(TriggerTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// StatTask stats task information.
|
|
rpc StatTask(StatTaskRequest) returns(common.Task);
|
|
|
|
// ImportTask imports task to p2p network.
|
|
rpc ImportTask(ImportTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// ExportTask exports task from p2p network.
|
|
rpc ExportTask(ExportTaskRequest) returns(google.protobuf.Empty);
|
|
|
|
// DeleteTask deletes task from p2p network.
|
|
rpc DeleteTask(DeleteTaskRequest) returns(google.protobuf.Empty);
|
|
}
|