/* * Copyright 2020 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 "pkg/rpc/base/base.proto"; import "google/protobuf/empty.proto"; import "validate/validate.proto"; option go_package = "d7y.io/dragonfly/v2/pkg/rpc/dfdaemon"; message DownRequest{ // identify one downloading, the framework will fill it automatically string uuid = 1 [(validate.rules).string.uuid = true]; // download file from the url, not only for http string url = 2 [(validate.rules).string.uri = true]; // pieces will be written to output path directly, // at the same time, dfdaemon workspace also makes soft link to the output string output = 3 [(validate.rules).string.min_len = 1]; // timeout duration uint64 timeout = 4 [(validate.rules).uint64.gte = 0]; // rate limit in bytes per second double limit = 5 [(validate.rules).double.gte = 0]; bool disable_back_source = 6; base.UrlMeta url_meta = 7; // p2p/cdn/source, default is p2p string pattern = 8 [(validate.rules).string = {in:["p2p", "cdn", "source"], ignore_empty:true}]; // call system string callsystem = 9; // user id int64 uid = 10; // group id int64 gid = 11; // keep original offset, used for ranged request, only available for hard link, otherwise will failed bool keep_original_offset = 12; } message DownResult{ string task_id = 2 [(validate.rules).string.min_len = 1]; string peer_id = 3 [(validate.rules).string.min_len = 1]; uint64 completed_length = 4 [(validate.rules).uint64.gte = 0]; bool done = 5; } // Daemon Client RPC Service service Daemon{ // Trigger client to download file rpc Download(DownRequest) returns(stream DownResult); // Get piece tasks from other peers rpc GetPieceTasks(base.PieceTaskRequest)returns(base.PiecePacket); // Check daemon health rpc CheckHealth(google.protobuf.Empty)returns(google.protobuf.Empty); // Sync piece tasks with other peers rpc SyncPieceTasks(stream base.PieceTaskRequest)returns(stream base.PiecePacket); }