2019-06-26 18:23:10 +03:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2019-07-27 04:07:14 +03:00
|
|
|
package go.micro.router;
|
|
|
|
|
2019-06-26 18:23:10 +03:00
|
|
|
// Router service is used by the proxy to lookup routes
|
|
|
|
service Router {
|
2019-07-26 01:24:46 +03:00
|
|
|
rpc Lookup(LookupRequest) returns (LookupResponse) {};
|
|
|
|
rpc Watch(WatchRequest) returns (stream Event) {};
|
2019-07-29 20:57:40 +03:00
|
|
|
rpc Advertise(Request) returns (stream Advert) {};
|
2019-07-24 23:07:04 +03:00
|
|
|
rpc Process(Advert) returns (ProcessResponse) {};
|
2019-07-29 20:57:40 +03:00
|
|
|
}
|
|
|
|
|
2019-08-01 15:32:55 +03:00
|
|
|
service Table {
|
2019-07-29 20:57:40 +03:00
|
|
|
rpc Create(Route) returns (CreateResponse) {};
|
2019-07-26 01:24:46 +03:00
|
|
|
rpc Delete(Route) returns (DeleteResponse) {};
|
|
|
|
rpc Update(Route) returns (UpdateResponse) {};
|
2019-07-29 20:57:40 +03:00
|
|
|
rpc List(Request) returns (ListResponse) {};
|
|
|
|
rpc Query(QueryRequest) returns (QueryResponse) {};
|
2019-07-26 01:24:46 +03:00
|
|
|
}
|
|
|
|
|
2019-07-29 20:57:40 +03:00
|
|
|
// Empty request
|
|
|
|
message Request {}
|
2019-07-26 01:24:46 +03:00
|
|
|
|
2019-09-05 18:04:44 +03:00
|
|
|
// Empty response
|
|
|
|
message Response {}
|
|
|
|
|
2019-07-26 01:24:46 +03:00
|
|
|
// ListResponse is returned by List
|
|
|
|
message ListResponse {
|
|
|
|
repeated Route routes = 1;
|
2019-06-26 18:23:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// LookupRequest is made to Lookup
|
|
|
|
message LookupRequest {
|
|
|
|
Query query = 1;
|
|
|
|
}
|
|
|
|
|
2019-07-10 19:21:55 +03:00
|
|
|
// LookupResponse is returned by Lookup
|
2019-06-26 18:23:10 +03:00
|
|
|
message LookupResponse {
|
|
|
|
repeated Route routes = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-06 17:05:58 +03:00
|
|
|
// QueryRequest queries Table for Routes
|
2019-07-29 20:57:40 +03:00
|
|
|
message QueryRequest{
|
|
|
|
Query query = 1;
|
|
|
|
}
|
|
|
|
|
2019-09-06 17:05:58 +03:00
|
|
|
// QueryResponse is returned by Query
|
2019-07-29 20:57:40 +03:00
|
|
|
message QueryResponse {
|
|
|
|
repeated Route routes = 1;
|
|
|
|
}
|
|
|
|
|
2019-07-10 19:21:55 +03:00
|
|
|
// WatchRequest is made to Watch Router
|
|
|
|
message WatchRequest {}
|
|
|
|
|
2019-07-11 23:14:34 +03:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2019-07-24 23:07:04 +03:00
|
|
|
// ProcessResponse is returned by Process
|
|
|
|
message ProcessResponse {}
|
|
|
|
|
2019-07-26 01:24:46 +03:00
|
|
|
// CreateResponse is returned by Create
|
|
|
|
message CreateResponse {}
|
|
|
|
|
|
|
|
// DeleteResponse is returned by Delete
|
|
|
|
message DeleteResponse {}
|
|
|
|
|
|
|
|
// UpdateResponse is returned by Update
|
|
|
|
message UpdateResponse {}
|
|
|
|
|
2019-07-11 23:14:34 +03:00
|
|
|
// EventType defines the type of event
|
2019-07-10 19:21:55 +03:00
|
|
|
enum EventType {
|
2019-07-10 20:37:46 +03:00
|
|
|
Create = 0;
|
2019-07-10 19:21:55 +03:00
|
|
|
Delete = 1;
|
|
|
|
Update = 2;
|
|
|
|
}
|
|
|
|
|
2019-07-11 23:14:34 +03:00
|
|
|
// Event is routing table event
|
|
|
|
message Event {
|
|
|
|
// type of event
|
2019-07-10 19:21:55 +03:00
|
|
|
EventType type = 1;
|
|
|
|
// unix timestamp of event
|
|
|
|
int64 timestamp = 2;
|
|
|
|
// service route
|
|
|
|
Route route = 3;
|
|
|
|
}
|
|
|
|
|
2019-06-26 18:23:10 +03:00
|
|
|
// Query is passed in a LookupRequest
|
|
|
|
message Query {
|
2019-07-09 18:45:31 +03:00
|
|
|
// service to lookup
|
|
|
|
string service = 1;
|
2019-07-26 14:43:17 +03:00
|
|
|
// gateway to lookup
|
|
|
|
string gateway = 2;
|
|
|
|
// network to lookup
|
|
|
|
string network = 3;
|
2019-06-26 18:23:10 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
// Route is a service route
|
|
|
|
message Route {
|
|
|
|
// service for the route
|
2019-07-09 18:45:31 +03:00
|
|
|
string service = 1;
|
|
|
|
// the address that advertise this route
|
|
|
|
string address = 2;
|
2019-06-26 18:23:10 +03:00
|
|
|
// gateway as the next hop
|
2019-07-09 18:45:31 +03:00
|
|
|
string gateway = 3;
|
2019-06-26 18:23:10 +03:00
|
|
|
// the network for this destination
|
|
|
|
string network = 4;
|
2019-08-28 10:41:19 +03:00
|
|
|
// router if the router id
|
|
|
|
string router = 5;
|
2019-07-09 18:45:31 +03:00
|
|
|
// the network link
|
2019-08-28 10:41:19 +03:00
|
|
|
string link = 6;
|
2019-06-26 18:23:10 +03:00
|
|
|
// the metric / score of this route
|
2019-08-28 10:41:19 +03:00
|
|
|
int64 metric = 7;
|
2019-06-26 18:23:10 +03:00
|
|
|
}
|