api/proto/manager.proto

327 lines
8.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 manager.v2;
import "common.proto";
import "google/protobuf/empty.proto";
// Request source type.
enum SourceType {
// Scheduler service.
SCHEDULER_SOURCE = 0;
// Peer service.
PEER_SOURCE = 1;
// SeedPeer service.
SEED_PEER_SOURCE = 2;
}
// SeedPeerCluster represents cluster of seed peer.
message SeedPeerCluster {
// Cluster id.
uint64 id = 1;
// Cluster name.
string name = 2;
// Cluster biography.
string bio = 3;
// Cluster configuration.
bytes config = 4;
}
// SeedPeer represents seed peer for network.
message SeedPeer {
// Seed peer id.
uint64 id = 1;
// Seed peer hostname.
string hostname = 2;
// Seed peer type.
string type = 3;
// Seed peer idc.
optional string idc = 4;
// Seed peer location.
optional string location = 5;
// Seed peer ip.
string ip = 6;
// Seed peer grpc port.
int32 port = 7;
// Seed peer download port.
int32 download_port = 8;
// Seed peer state.
string state = 9;
// ID of the cluster to which the seed peer belongs.
uint64 seed_peer_cluster_id = 10;
// Cluster to which the seed peer belongs.
SeedPeerCluster seed_peer_cluster = 11;
// Schedulers included in seed peer.
repeated Scheduler schedulers = 12;
}
// GetSeedPeerRequest represents request of GetSeedPeer.
message GetSeedPeerRequest {
// Request source type.
SourceType source_type = 1;
// Seed peer hostname.
string hostname = 2;
// ID of the cluster to which the seed peer belongs.
uint64 seed_peer_cluster_id = 3;
// Seed peer ip.
string ip = 4;
}
// ListSeedPeersRequest represents request of ListSeedPeers.
message ListSeedPeersRequest {
// Request source type.
SourceType source_type = 1;
// Source service hostname.
string hostname = 2;
// Source service ip.
string ip = 3;
// Dfdaemon version.
string version = 4;
// Dfdaemon commit.
string commit = 5;
}
// ListSeedPeersResponse represents response of ListSeedPeers.
message ListSeedPeersResponse {
// Seed peers to which the source service belongs.
repeated SeedPeer seed_peers = 1;
}
// UpdateSeedPeerRequest represents request of UpdateSeedPeer.
message UpdateSeedPeerRequest {
// Request source type.
SourceType source_type = 1;
// Seed peer hostname.
string hostname = 2;
// Seed peer type.
string type = 3;
// Seed peer idc.
optional string idc = 4;
// Seed peer location.
optional string location = 5;
// Seed peer ip.
string ip = 6;
// Seed peer port.
int32 port = 7;
// Seed peer download port.
int32 download_port = 8;
// ID of the cluster to which the seed peer belongs.
uint64 seed_peer_cluster_id = 9;
}
// DeleteSeedPeerRequest represents request of DeleteSeedPeer.
message DeleteSeedPeerRequest {
// Request source type.
SourceType source_type = 1;
// Seed peer hostname.
string hostname = 2;
// ID of the cluster to which the seed peer belongs.
uint64 seed_peer_cluster_id = 3;
// Seed peer ip.
string ip = 4;
}
// SeedPeerCluster represents cluster of scheduler.
message SchedulerCluster {
// Cluster id.
uint64 id = 1;
// Cluster name.
string name = 2;
// Cluster biography.
string bio = 3;
// Cluster config.
bytes config = 4;
// Cluster client config.
bytes client_config = 5;
// Cluster scopes.
bytes scopes = 6;
}
// SeedPeerCluster represents scheduler for network.
message Scheduler {
// Scheduler id.
uint64 id = 1;
// Scheduler hostname.
string hostname = 2;
// Scheduler idc.
optional string idc = 3;
// Scheduler location.
optional string location = 4;
// Scheduler ip.
string ip = 5;
// Scheduler grpc port.
int32 port = 6;
// Scheduler state.
string state = 7;
// ID of the cluster to which the scheduler belongs.
uint64 scheduler_cluster_id = 8;
// Cluster to which the scheduler belongs.
SchedulerCluster scheduler_cluster = 9;
// Seed peers to which the scheduler belongs.
repeated SeedPeer seed_peers = 10;
// Feature flags of scheduler.
bytes features = 11;
}
// GetSchedulerRequest represents request of GetScheduler.
message GetSchedulerRequest {
// Request source type.
SourceType source_type = 1;
// Scheduler hostname.
string hostname = 2;
// ID of the cluster to which the scheduler belongs.
uint64 scheduler_cluster_id = 3;
// Scheduler ip.
string ip = 4;
}
// UpdateSchedulerRequest represents request of UpdateScheduler.
message UpdateSchedulerRequest {
// Request source type.
SourceType source_type = 1;
// Scheduler hostname.
string hostname = 2;
// ID of the cluster to which the scheduler belongs.
uint64 scheduler_cluster_id = 3;
// Scheduler idc.
optional string idc = 4;
// Scheduler location.
optional string location = 5;
// Scheduler ip.
string ip = 6;
// Scheduler port.
int32 port = 7;
// Scheduler features.
repeated string features = 8;
}
// ListSchedulersRequest represents request of ListSchedulers.
message ListSchedulersRequest {
// Request source type.
SourceType source_type = 1;
// Source service hostname.
string hostname = 2;
// Source service ip.
string ip = 3;
// Source idc.
optional string idc = 4;
// Source location.
optional string location = 5;
// Dfdaemon version.
string version = 6;
// Dfdaemon commit.
string commit = 7;
}
// ListSchedulersResponse represents response of ListSchedulers.
message ListSchedulersResponse {
// Schedulers to which the source service belongs.
repeated Scheduler schedulers = 1;
}
// URLPriority represents config of url priority.
message URLPriority {
// URL regex.
string regex = 1;
// URL priority value.
common.v2.Priority value = 2;
}
// ApplicationPriority represents config of application priority.
message ApplicationPriority {
// Priority value.
common.v2.Priority value = 1;
// URL priority.
repeated URLPriority urls = 2;
}
// Application represents config of application.
message Application {
// Application id.
uint64 id = 1;
// Application name.
string name = 2;
// Application url.
string url = 3;
// Application biography.
string bio = 4;
// Application priority.
ApplicationPriority priority = 5;
}
// ListApplicationsRequest represents request of ListApplications.
message ListApplicationsRequest {
// Request source type.
SourceType source_type = 1;
// Source service hostname.
string hostname = 2;
// Source service ip.
string ip = 3;
}
// ListApplicationsResponse represents response of ListApplications.
message ListApplicationsResponse {
// Application configs.
repeated Application applications = 1;
}
// KeepAliveRequest represents request of KeepAlive.
message KeepAliveRequest {
// Request source type.
SourceType source_type = 1;
// Source service hostname.
string hostname = 2;
// ID of the cluster to which the source service belongs.
uint64 cluster_id = 3;
// Source service ip.
string ip = 4;
}
// Manager RPC Service.
service Manager {
// Get SeedPeer and SeedPeer cluster configuration.
rpc GetSeedPeer(GetSeedPeerRequest) returns(SeedPeer);
// List acitve schedulers configuration.
rpc ListSeedPeers(ListSeedPeersRequest)returns(ListSeedPeersResponse);
// Update SeedPeer configuration.
rpc UpdateSeedPeer(UpdateSeedPeerRequest) returns(SeedPeer);
// Delete SeedPeer configuration.
rpc DeleteSeedPeer(DeleteSeedPeerRequest) returns(google.protobuf.Empty);
// Get Scheduler and Scheduler cluster configuration.
rpc GetScheduler(GetSchedulerRequest)returns(Scheduler);
// Update scheduler configuration.
rpc UpdateScheduler(UpdateSchedulerRequest) returns(Scheduler);
// List acitve schedulers configuration.
rpc ListSchedulers(ListSchedulersRequest)returns(ListSchedulersResponse);
// List applications configuration.
rpc ListApplications(ListApplicationsRequest)returns(ListApplicationsResponse);
// KeepAlive with manager.
rpc KeepAlive(stream KeepAliveRequest)returns(google.protobuf.Empty);
}