mirror of https://github.com/dragonflyoss/api.git
483 lines
15 KiB
Protocol Buffer
483 lines
15 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 scheduler.v2;
|
|
|
|
import "common.proto";
|
|
import "errordetails.proto";
|
|
import "google/protobuf/empty.proto";
|
|
import "google/protobuf/duration.proto";
|
|
import "google/protobuf/timestamp.proto";
|
|
|
|
// RegisterPeerRequest represents peer registered request of AnnouncePeerRequest.
|
|
message RegisterPeerRequest {
|
|
// Download information.
|
|
common.v2.Download download = 1;
|
|
}
|
|
|
|
// DownloadPeerStartedRequest represents peer download started request of AnnouncePeerRequest.
|
|
message DownloadPeerStartedRequest {
|
|
}
|
|
|
|
// DownloadPeerBackToSourceStartedRequest represents peer download back-to-source started request of AnnouncePeerRequest.
|
|
message DownloadPeerBackToSourceStartedRequest {
|
|
// The description of the back-to-source reason.
|
|
optional string description = 1;
|
|
}
|
|
|
|
// ReschedulePeerRequest represents reschedule request of AnnouncePeerRequest.
|
|
message ReschedulePeerRequest {
|
|
// Candidate parent ids.
|
|
repeated common.v2.Peer candidate_parents = 1;
|
|
// The description of the reschedule reason.
|
|
optional string description = 2;
|
|
}
|
|
|
|
// DownloadPeerFinishedRequest represents peer download finished request of AnnouncePeerRequest.
|
|
message DownloadPeerFinishedRequest {
|
|
// Total content length.
|
|
uint64 content_length = 1;
|
|
// Total piece count.
|
|
uint32 piece_count = 2;
|
|
}
|
|
|
|
// DownloadPeerBackToSourceFinishedRequest represents peer download back-to-source finished request of AnnouncePeerRequest.
|
|
message DownloadPeerBackToSourceFinishedRequest {
|
|
// Total content length.
|
|
uint64 content_length = 1;
|
|
// Total piece count.
|
|
uint32 piece_count = 2;
|
|
}
|
|
|
|
// DownloadPeerFailedRequest represents peer download failed request of AnnouncePeerRequest.
|
|
message DownloadPeerFailedRequest {
|
|
// The description of the download failed.
|
|
optional string description = 1;
|
|
}
|
|
|
|
// DownloadPeerBackToSourceFailedRequest represents peer download back-to-source failed request of AnnouncePeerRequest.
|
|
message DownloadPeerBackToSourceFailedRequest {
|
|
// The description of the download back-to-source failed.
|
|
optional string description = 1;
|
|
}
|
|
|
|
// DownloadPieceFinishedRequest represents piece download finished request of AnnouncePeerRequest.
|
|
message DownloadPieceFinishedRequest {
|
|
// Piece info.
|
|
common.v2.Piece piece = 1;
|
|
}
|
|
|
|
// DownloadPieceBackToSourceFinishedRequest represents piece download back-to-source finished request of AnnouncePeerRequest.
|
|
message DownloadPieceBackToSourceFinishedRequest {
|
|
// Piece info.
|
|
common.v2.Piece piece = 1;
|
|
}
|
|
|
|
// DownloadPieceFailedRequest downloads piece failed request of AnnouncePeerRequest.
|
|
message DownloadPieceFailedRequest {
|
|
// Piece number.
|
|
optional uint32 piece_number = 1;
|
|
// Parent id.
|
|
string parent_id = 2;
|
|
// Temporary indicates whether the error is temporary.
|
|
bool temporary = 3;
|
|
}
|
|
|
|
// DownloadPieceBackToSourceFailedRequest downloads piece back-to-source failed request of AnnouncePeerRequest.
|
|
message DownloadPieceBackToSourceFailedRequest {
|
|
// Piece number.
|
|
optional uint32 piece_number = 1;
|
|
|
|
oneof response {
|
|
errordetails.v2.Backend backend = 2;
|
|
}
|
|
}
|
|
|
|
// AnnouncePeerRequest represents request of AnnouncePeer.
|
|
message AnnouncePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
|
|
oneof request {
|
|
RegisterPeerRequest register_peer_request = 4;
|
|
DownloadPeerStartedRequest download_peer_started_request = 5;
|
|
DownloadPeerBackToSourceStartedRequest download_peer_back_to_source_started_request = 6;
|
|
ReschedulePeerRequest reschedule_peer_request = 7;
|
|
DownloadPeerFinishedRequest download_peer_finished_request = 8;
|
|
DownloadPeerBackToSourceFinishedRequest download_peer_back_to_source_finished_request = 9;
|
|
DownloadPeerFailedRequest download_peer_failed_request = 10;
|
|
DownloadPeerBackToSourceFailedRequest download_peer_back_to_source_failed_request = 11;
|
|
DownloadPieceFinishedRequest download_piece_finished_request = 12;
|
|
DownloadPieceBackToSourceFinishedRequest download_piece_back_to_source_finished_request = 13;
|
|
DownloadPieceFailedRequest download_piece_failed_request = 14;
|
|
DownloadPieceBackToSourceFailedRequest download_piece_back_to_source_failed_request = 15;
|
|
}
|
|
}
|
|
|
|
// EmptyTaskResponse represents empty task response of AnnouncePeerResponse.
|
|
message EmptyTaskResponse {
|
|
}
|
|
|
|
// NormalTaskResponse represents normal task response of AnnouncePeerResponse.
|
|
message NormalTaskResponse {
|
|
// Candidate parents.
|
|
repeated common.v2.Peer candidate_parents = 1;
|
|
}
|
|
|
|
// NeedBackToSourceResponse represents need back-to-source response of AnnouncePeerResponse.
|
|
message NeedBackToSourceResponse {
|
|
// The description of the back-to-source reason.
|
|
optional string description = 1;
|
|
}
|
|
|
|
// AnnouncePeerResponse represents response of AnnouncePeer.
|
|
message AnnouncePeerResponse {
|
|
oneof response {
|
|
EmptyTaskResponse empty_task_response = 1;
|
|
NormalTaskResponse normal_task_response = 2;
|
|
NeedBackToSourceResponse need_back_to_source_response = 3;
|
|
}
|
|
}
|
|
|
|
// StatPeerRequest represents request of StatPeer.
|
|
message StatPeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
}
|
|
|
|
// DeletePeerRequest represents request of DeletePeer.
|
|
message DeletePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
}
|
|
|
|
// AnnouncePeersRequest represents request of AnnouncePeers.
|
|
message AnnouncePeersRequest{
|
|
// Peers information.
|
|
repeated common.v2.Peer peers = 1;
|
|
}
|
|
|
|
// StatTaskRequest represents request of StatTask.
|
|
message StatTaskRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
}
|
|
|
|
// DeleteTaskRequest represents request of DeleteTask.
|
|
message DeleteTaskRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
}
|
|
|
|
// AnnounceHostRequest represents request of AnnounceHost.
|
|
message AnnounceHostRequest {
|
|
// Host information.
|
|
common.v2.Host host = 1;
|
|
// The interval between dfdaemon announces to scheduler.
|
|
optional google.protobuf.Duration interval = 2;
|
|
}
|
|
|
|
// DeleteHostRequest represents request of DeleteHost.
|
|
message DeleteHostRequest{
|
|
// Host id.
|
|
string host_id = 1;
|
|
}
|
|
|
|
// ProbeStartedRequest represents started request of SyncProbesRequest.
|
|
message ProbeStartedRequest {
|
|
}
|
|
|
|
// Probe information.
|
|
message Probe {
|
|
// Destination host metadata.
|
|
common.v2.Host host = 1;
|
|
// RTT is the round-trip time sent via this pinger.
|
|
google.protobuf.Duration rtt = 2;
|
|
// Probe create time.
|
|
google.protobuf.Timestamp created_at = 3;
|
|
}
|
|
|
|
// ProbeFinishedRequest represents finished request of SyncProbesRequest.
|
|
message ProbeFinishedRequest {
|
|
// Probes information.
|
|
repeated Probe probes = 1;
|
|
}
|
|
|
|
// FailedProbe information.
|
|
message FailedProbe {
|
|
// Destination host metadata.
|
|
common.v2.Host host = 1;
|
|
// The description of probing failed.
|
|
optional string description = 2;
|
|
}
|
|
|
|
// ProbeFailedRequest represents failed request of SyncProbesRequest.
|
|
message ProbeFailedRequest {
|
|
// Failed probes information.
|
|
repeated FailedProbe probes = 1;
|
|
}
|
|
|
|
// SyncProbesRequest represents request of SyncProbes.
|
|
message SyncProbesRequest {
|
|
// Source host metadata.
|
|
common.v2.Host host = 1;
|
|
|
|
oneof request {
|
|
ProbeStartedRequest probe_started_request = 2;
|
|
ProbeFinishedRequest probe_finished_request = 3;
|
|
ProbeFailedRequest probe_failed_request = 4;
|
|
}
|
|
}
|
|
|
|
// SyncProbesResponse represents response of SyncProbes.
|
|
message SyncProbesResponse {
|
|
// Hosts needs to be probed.
|
|
repeated common.v2.Host hosts = 1;
|
|
}
|
|
|
|
// RegisterCachePeerRequest represents cache peer registered request of AnnounceCachePeerRequest.
|
|
message RegisterCachePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Tag is used to distinguish different cache tasks.
|
|
optional string tag = 3;
|
|
// Application of task.
|
|
optional string application = 4;
|
|
// Task piece length.
|
|
uint64 piece_length = 5;
|
|
// File path to be exported.
|
|
string output_path = 6;
|
|
// Download timeout.
|
|
optional google.protobuf.Duration timeout = 7;
|
|
}
|
|
|
|
// DownloadCachePeerStartedRequest represents cache peer download started request of AnnounceCachePeerRequest.
|
|
message DownloadCachePeerStartedRequest {
|
|
}
|
|
|
|
// RescheduleCachePeerRequest represents reschedule request of AnnounceCachePeerRequest.
|
|
message RescheduleCachePeerRequest {
|
|
// Candidate parent ids.
|
|
repeated common.v2.CachePeer candidate_parents = 1;
|
|
|
|
// The description of the reschedule reason.
|
|
optional string description = 2;
|
|
}
|
|
|
|
// DownloadCachePeerFinishedRequest represents cache peer download finished request of AnnounceCachePeerRequest.
|
|
message DownloadCachePeerFinishedRequest {
|
|
// Total piece count.
|
|
uint32 piece_count = 1;
|
|
}
|
|
|
|
// DownloadCachePeerFailedRequest represents cache peer download failed request of AnnounceCachePeerRequest.
|
|
message DownloadCachePeerFailedRequest {
|
|
// The description of the download failed.
|
|
optional string description = 1;
|
|
}
|
|
|
|
// AnnounceCachePeerRequest represents request of AnnounceCachePeer.
|
|
message AnnounceCachePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
|
|
oneof request {
|
|
RegisterCachePeerRequest register_cache_peer_request = 4;
|
|
DownloadCachePeerStartedRequest download_cache_peer_started_request = 5;
|
|
RescheduleCachePeerRequest reschedule_cache_peer_request = 6;
|
|
DownloadCachePeerFinishedRequest download_cache_peer_finished_request = 7;
|
|
DownloadCachePeerFailedRequest download_cache_peer_failed_request = 8;
|
|
DownloadPieceFinishedRequest download_piece_finished_request = 9;
|
|
DownloadPieceFailedRequest download_piece_failed_request = 10;
|
|
}
|
|
}
|
|
|
|
// EmptyCacheTaskResponse represents empty cache task response of AnnounceCachePeerResponse.
|
|
message EmptyCacheTaskResponse {
|
|
}
|
|
|
|
// NormalCacheTaskResponse represents normal cache task response of AnnounceCachePeerResponse.
|
|
message NormalCacheTaskResponse {
|
|
// Candidate parents.
|
|
repeated common.v2.CachePeer candidate_cache_parents = 1;
|
|
}
|
|
|
|
// AnnounceCachePeerResponse represents response of AnnounceCachePeer.
|
|
message AnnounceCachePeerResponse {
|
|
oneof response {
|
|
EmptyCacheTaskResponse empty_task_response = 1;
|
|
NormalCacheTaskResponse normal_task_response = 2;
|
|
}
|
|
}
|
|
|
|
// StatCachePeerRequest represents request of StatCachePeer.
|
|
message StatCachePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
}
|
|
|
|
// DeleteCachePeerRequest represents request of DeleteCachePeer.
|
|
message DeleteCachePeerRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
}
|
|
|
|
// UploadCacheTaskStartedRequest represents upload cache task started request of UploadCacheTaskStarted.
|
|
message UploadCacheTaskStartedRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
// Replica count of the persistent cache task.
|
|
uint64 persistent_replica_count = 4;
|
|
// Tag is used to distinguish different cache tasks.
|
|
optional string tag = 5;
|
|
// Application of task.
|
|
optional string application = 6;
|
|
// Task piece length.
|
|
uint64 piece_length = 7;
|
|
// TTL of the cache task.
|
|
google.protobuf.Duration ttl = 8;
|
|
// Upload timeout.
|
|
optional google.protobuf.Duration timeout = 9;
|
|
}
|
|
|
|
// UploadCacheTaskFinishedRequest represents upload cache task finished request of UploadCacheTaskFinished.
|
|
message UploadCacheTaskFinishedRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
}
|
|
|
|
// UploadCacheTaskFailedRequest represents upload cache task failed request of UploadCacheTaskFailed.
|
|
message UploadCacheTaskFailedRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
// Peer id.
|
|
string peer_id = 3;
|
|
// The description of the upload failed.
|
|
optional string description = 4;
|
|
}
|
|
|
|
// StatCacheTaskRequest represents request of StatCacheTask.
|
|
message StatCacheTaskRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
}
|
|
|
|
// DeleteCacheTaskRequest represents request of DeleteCacheTask.
|
|
message DeleteCacheTaskRequest {
|
|
// Host id.
|
|
string host_id = 1;
|
|
// Task id.
|
|
string task_id = 2;
|
|
}
|
|
|
|
// Scheduler RPC Service.
|
|
service Scheduler{
|
|
// AnnouncePeer announces peer to scheduler.
|
|
rpc AnnouncePeer(stream AnnouncePeerRequest) returns(stream AnnouncePeerResponse);
|
|
|
|
// Checks information of peer.
|
|
rpc StatPeer(StatPeerRequest)returns(common.v2.Peer);
|
|
|
|
// DeletePeer releases peer in scheduler.
|
|
rpc DeletePeer(DeletePeerRequest)returns(google.protobuf.Empty);
|
|
|
|
// A host announces that it has the announced peers to scheduler at startup.
|
|
rpc AnnouncePeers(stream AnnouncePeersRequest) returns(stream google.protobuf.Empty);
|
|
|
|
// Checks information of task.
|
|
rpc StatTask(StatTaskRequest)returns(common.v2.Task);
|
|
|
|
// DeleteTask releases task in scheduler.
|
|
rpc DeleteTask(DeleteTaskRequest)returns(google.protobuf.Empty);
|
|
|
|
// AnnounceHost announces host to scheduler.
|
|
rpc AnnounceHost(AnnounceHostRequest)returns(google.protobuf.Empty);
|
|
|
|
// DeleteHost releases host in scheduler.
|
|
rpc DeleteHost(DeleteHostRequest)returns(google.protobuf.Empty);
|
|
|
|
// SyncProbes sync probes of the host.
|
|
rpc SyncProbes(stream SyncProbesRequest)returns(stream SyncProbesResponse);
|
|
|
|
// AnnounceCachePeer announces cache peer to scheduler.
|
|
rpc AnnounceCachePeer(stream AnnounceCachePeerRequest) returns(stream AnnounceCachePeerResponse);
|
|
|
|
// Checks information of cache peer.
|
|
rpc StatCachePeer(StatCachePeerRequest)returns(common.v2.CachePeer);
|
|
|
|
// DeleteCachePeer releases cache peer in scheduler.
|
|
rpc DeleteCachePeer(DeleteCachePeerRequest)returns(google.protobuf.Empty);
|
|
|
|
// UploadCacheTaskStarted uploads cache task started to scheduler.
|
|
rpc UploadCacheTaskStarted(UploadCacheTaskStartedRequest)returns(google.protobuf.Empty);
|
|
|
|
// UploadCacheTaskFinished uploads cache task finished to scheduler.
|
|
rpc UploadCacheTaskFinished(UploadCacheTaskFinishedRequest)returns(common.v2.CacheTask);
|
|
|
|
// UploadCacheTaskFailed uploads cache task failed to scheduler.
|
|
rpc UploadCacheTaskFailed(UploadCacheTaskFailedRequest)returns(google.protobuf.Empty);
|
|
|
|
// Checks information of cache task.
|
|
rpc StatCacheTask(StatCacheTaskRequest)returns(common.v2.CacheTask);
|
|
|
|
// DeleteCacheTask releases cache task in scheduler.
|
|
rpc DeleteCacheTask(DeleteCacheTaskRequest)returns(google.protobuf.Empty);
|
|
}
|