micro/network/router/proto/router.proto
Milos Gajdos 9ad5ae6644
Adds new RPC methods to router service interface
We have added Advertise() and Process() RPCs in this commit.
2019-07-24 21:07:04 +01:00

98 lines
2.2 KiB
Protocol Buffer

syntax = "proto3";
// Router service is used by the proxy to lookup routes
service Router {
rpc Watch(WatchRequest) returns (stream Event) {};
rpc Lookup(LookupRequest) returns (LookupResponse) {};
rpc List(ListRequest) returns (ListResponse) {};
rpc Advertise(AdvertiseRequest) returns (stream Advert) {};
rpc Process(Advert) returns (ProcessResponse) {};
}
// LookupRequest is made to Lookup
message LookupRequest {
Query query = 1;
}
// LookupResponse is returned by Lookup
message LookupResponse {
repeated Route routes = 1;
}
// WatchRequest is made to Watch Router
message WatchRequest {}
// AdvertiseRequest request a stream of Adverts
message AdvertiseRequest {}
// 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;
}
// ProcessResponse is returned by Process
message ProcessResponse {}
// EventType defines the type of event
enum EventType {
Create = 0;
Delete = 1;
Update = 2;
}
// Event is routing table event
message Event {
// type of event
EventType type = 1;
// unix timestamp of event
int64 timestamp = 2;
// service route
Route route = 3;
}
// ListRequest is made to List routes
message ListRequest {}
// ListResponse is returned by List
message ListResponse {
repeated Route routes = 1;
}
// Query is passed in a LookupRequest
message Query {
// service to lookup
string service = 1;
}
// 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;
// the network link
string link = 5;
// the metric / score of this route
int64 metric = 6;
}