2019-06-26 16:23:10 +01:00
|
|
|
syntax = "proto3";
|
|
|
|
|
2019-07-26 18:07:14 -07:00
|
|
|
package go.micro.router;
|
|
|
|
|
2020-03-30 23:58:32 +03:00
|
|
|
option go_package = "github.com/micro/go-micro/v2/router/service/proto;router";
|
2019-06-26 16:23:10 +01:00
|
|
|
// Router service is used by the proxy to lookup routes
|
|
|
|
service Router {
|
2020-03-30 23:58:32 +03:00
|
|
|
rpc Lookup(LookupRequest) returns (LookupResponse) {};
|
|
|
|
rpc Watch(WatchRequest) returns (stream Event) {};
|
|
|
|
rpc Advertise(Request) returns (stream Advert) {};
|
|
|
|
rpc Process(Advert) returns (ProcessResponse) {};
|
2019-07-29 18:57:40 +01:00
|
|
|
}
|
|
|
|
|
2019-08-01 13:32:55 +01:00
|
|
|
service Table {
|
2020-03-30 23:58:32 +03:00
|
|
|
rpc Create(Route) returns (CreateResponse) {};
|
|
|
|
rpc Delete(Route) returns (DeleteResponse) {};
|
|
|
|
rpc Update(Route) returns (UpdateResponse) {};
|
|
|
|
rpc List(Request) returns (ListResponse) {};
|
|
|
|
rpc Query(QueryRequest) returns (QueryResponse) {};
|
2019-07-25 23:24:46 +01:00
|
|
|
}
|
|
|
|
|
2019-07-29 18:57:40 +01:00
|
|
|
// Empty request
|
|
|
|
message Request {}
|
2019-07-25 23:24:46 +01:00
|
|
|
|
2019-09-05 16:04:44 +01:00
|
|
|
// Empty response
|
|
|
|
message Response {}
|
|
|
|
|
2019-07-25 23:24:46 +01:00
|
|
|
// ListResponse is returned by List
|
|
|
|
message ListResponse {
|
2020-03-30 23:58:32 +03:00
|
|
|
repeated Route routes = 1;
|
2019-06-26 16:23:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// LookupRequest is made to Lookup
|
|
|
|
message LookupRequest {
|
2020-03-30 23:58:32 +03:00
|
|
|
Query query = 1;
|
2019-06-26 16:23:10 +01:00
|
|
|
}
|
|
|
|
|
2019-07-10 17:21:55 +01:00
|
|
|
// LookupResponse is returned by Lookup
|
2019-06-26 16:23:10 +01:00
|
|
|
message LookupResponse {
|
2020-03-30 23:58:32 +03:00
|
|
|
repeated Route routes = 1;
|
2019-06-26 16:23:10 +01:00
|
|
|
}
|
|
|
|
|
2019-09-06 15:05:58 +01:00
|
|
|
// QueryRequest queries Table for Routes
|
2019-07-29 18:57:40 +01:00
|
|
|
message QueryRequest{
|
2020-03-30 23:58:32 +03:00
|
|
|
Query query = 1;
|
2019-07-29 18:57:40 +01:00
|
|
|
}
|
|
|
|
|
2019-09-06 15:05:58 +01:00
|
|
|
// QueryResponse is returned by Query
|
2019-07-29 18:57:40 +01:00
|
|
|
message QueryResponse {
|
2020-03-30 23:58:32 +03:00
|
|
|
repeated Route routes = 1;
|
2019-07-29 18:57:40 +01:00
|
|
|
}
|
|
|
|
|
2019-07-10 17:21:55 +01:00
|
|
|
// WatchRequest is made to Watch Router
|
|
|
|
message WatchRequest {}
|
|
|
|
|
2019-07-11 21:14:34 +01:00
|
|
|
// AdvertType defines the type of advert
|
|
|
|
enum AdvertType {
|
2020-03-30 23:58:32 +03:00
|
|
|
AdvertAnnounce = 0;
|
|
|
|
AdvertUpdate = 1;
|
2019-07-11 21:14:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Advert is router advertsement streamed by Watch
|
|
|
|
message Advert {
|
2020-03-30 23:58:32 +03:00
|
|
|
// 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-11 21:14:34 +01:00
|
|
|
}
|
|
|
|
|
2019-07-24 21:07:04 +01:00
|
|
|
// ProcessResponse is returned by Process
|
|
|
|
message ProcessResponse {}
|
|
|
|
|
2019-07-25 23:24:46 +01: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 21:14:34 +01:00
|
|
|
// EventType defines the type of event
|
2019-07-10 17:21:55 +01:00
|
|
|
enum EventType {
|
2020-03-30 23:58:32 +03:00
|
|
|
Create = 0;
|
|
|
|
Delete = 1;
|
|
|
|
Update = 2;
|
2019-07-10 17:21:55 +01:00
|
|
|
}
|
|
|
|
|
2019-07-11 21:14:34 +01:00
|
|
|
// Event is routing table event
|
|
|
|
message Event {
|
2020-03-30 23:58:32 +03:00
|
|
|
// 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;
|
2019-07-10 17:21:55 +01:00
|
|
|
}
|
|
|
|
|
2019-06-26 16:23:10 +01:00
|
|
|
// Query is passed in a LookupRequest
|
|
|
|
message Query {
|
2020-03-30 23:58:32 +03:00
|
|
|
// service to lookup
|
|
|
|
string service = 1;
|
|
|
|
// gateway to lookup
|
|
|
|
string gateway = 2;
|
|
|
|
// network to lookup
|
|
|
|
string network = 3;
|
2019-06-26 16:23:10 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Route is a service route
|
|
|
|
message Route {
|
2020-03-30 23:58:32 +03:00
|
|
|
// 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;
|
2020-06-30 14:10:13 +01:00
|
|
|
// metadata for the route
|
|
|
|
map<string,string> metadata = 8;
|
2019-06-26 16:23:10 +01:00
|
|
|
}
|