mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-06 08:16:03 +02:00
187 lines
3.9 KiB
Protocol Buffer
187 lines
3.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package go.micro.network;
|
|
|
|
// Network service is usesd to gain visibility into networks
|
|
service Network {
|
|
// Connect to the network
|
|
rpc Connect(ConnectRequest) returns (ConnectResponse) {};
|
|
// Returns the entire network graph
|
|
rpc Graph(GraphRequest) returns (GraphResponse) {};
|
|
// Returns a list of known nodes in the network
|
|
rpc Nodes(NodesRequest) returns (NodesResponse) {};
|
|
// Returns a list of known routes in the network
|
|
rpc Routes(RoutesRequest) returns (RoutesResponse) {};
|
|
// Returns a list of known services based on routes
|
|
rpc Services(ServicesRequest) returns (ServicesResponse) {};
|
|
// Status returns network status
|
|
rpc Status(StatusRequest) returns (StatusResponse) {};
|
|
}
|
|
|
|
// Route is a service route
|
|
message Route {
|
|
// service for the route
|
|
string service = 1;
|
|
// the address that advertise this route
|
|
string address = 2;
|
|
// gateway as the next hop
|
|
string gateway = 3;
|
|
// the network for this destination
|
|
string network = 4;
|
|
// router if the router id
|
|
string router = 5;
|
|
// the network link
|
|
string link = 6;
|
|
// the metric / score of this route
|
|
int64 metric = 7;
|
|
}
|
|
|
|
// AdvertType defines the type of advert
|
|
enum AdvertType {
|
|
AdvertAnnounce = 0;
|
|
AdvertUpdate = 1;
|
|
}
|
|
|
|
// Advert is router advertsement streamed by Watch
|
|
message Advert {
|
|
// id of the advertising router
|
|
string id = 1;
|
|
// type of advertisement
|
|
AdvertType type = 2;
|
|
// unix timestamp of the advertisement
|
|
int64 timestamp = 3;
|
|
// TTL of the Advert
|
|
int64 ttl = 4;
|
|
// events is a list of advertised events
|
|
repeated Event events = 5;
|
|
}
|
|
|
|
// EventType defines the type of event
|
|
enum EventType {
|
|
Create = 0;
|
|
Delete = 1;
|
|
Update = 2;
|
|
}
|
|
|
|
// Event is routing table event
|
|
message Event {
|
|
// the unique event id
|
|
string id = 1;
|
|
// type of event
|
|
EventType type = 2;
|
|
// unix timestamp of event
|
|
int64 timestamp = 3;
|
|
// service route
|
|
Route route = 4;
|
|
}
|
|
|
|
// Query is passed in a LookupRequest
|
|
message Query {
|
|
string service = 1;
|
|
string address = 2;
|
|
string gateway = 3;
|
|
string router = 4;
|
|
string network = 5;
|
|
}
|
|
|
|
message ConnectRequest {
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
message ConnectResponse {}
|
|
|
|
// PeerRequest requests list of peers
|
|
message NodesRequest {
|
|
// node topology depth
|
|
uint32 depth = 1;
|
|
}
|
|
|
|
// PeerResponse is returned by ListPeers
|
|
message NodesResponse {
|
|
// return peer topology
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
message GraphRequest {
|
|
// node topology depth
|
|
uint32 depth = 1;
|
|
}
|
|
|
|
message GraphResponse {
|
|
Peer root = 1;
|
|
}
|
|
|
|
message RoutesRequest {
|
|
// filter based on
|
|
Query query = 1;
|
|
}
|
|
|
|
message RoutesResponse {
|
|
repeated Route routes = 1;
|
|
}
|
|
|
|
message ServicesRequest {}
|
|
|
|
message ServicesResponse {
|
|
repeated string services = 1;
|
|
}
|
|
|
|
message StatusRequest {}
|
|
|
|
message StatusResponse {
|
|
Status status = 1;
|
|
}
|
|
|
|
// Error tracks network errors
|
|
message Error {
|
|
uint32 count = 1;
|
|
string msg = 2;
|
|
}
|
|
|
|
// Status is node status
|
|
message Status {
|
|
Error error = 1;
|
|
}
|
|
|
|
// Node is network node
|
|
message Node {
|
|
// node id
|
|
string id = 1;
|
|
// node address
|
|
string address = 2;
|
|
// the network
|
|
string network = 3;
|
|
// associated metadata
|
|
map<string,string> metadata = 4;
|
|
// node status
|
|
Status status = 5;
|
|
}
|
|
|
|
// Connect is sent when the node connects to the network
|
|
message Connect {
|
|
// network mode
|
|
Node node = 1;
|
|
}
|
|
|
|
// Close is sent when the node disconnects from the network
|
|
message Close {
|
|
// network node
|
|
Node node = 1;
|
|
}
|
|
|
|
// Peer is used to advertise node peers
|
|
message Peer {
|
|
// network node
|
|
Node node = 1;
|
|
// node peers
|
|
repeated Peer peers = 2;
|
|
}
|
|
|
|
// Sync is network sync message
|
|
message Sync {
|
|
// peer origin
|
|
Peer peer = 1;
|
|
// node routes
|
|
repeated Route routes = 2;
|
|
}
|