mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-24 10:07:04 +02:00
148 lines
3.2 KiB
Protocol Buffer
148 lines
3.2 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package go.micro.router;
|
|
|
|
// Router service is used by the proxy to lookup routes
|
|
service Router {
|
|
rpc Lookup(LookupRequest) returns (LookupResponse) {};
|
|
rpc Watch(WatchRequest) returns (stream Event) {};
|
|
rpc Advertise(Request) returns (stream Advert) {};
|
|
rpc Solicit(Request) returns (Response) {};
|
|
rpc Process(Advert) returns (ProcessResponse) {};
|
|
rpc Status(Request) returns (StatusResponse) {};
|
|
}
|
|
|
|
service Table {
|
|
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) {};
|
|
}
|
|
|
|
// Empty request
|
|
message Request {}
|
|
|
|
// Empty response
|
|
message Response {}
|
|
|
|
// ListResponse is returned by List
|
|
message ListResponse {
|
|
repeated Route routes = 1;
|
|
}
|
|
|
|
// LookupRequest is made to Lookup
|
|
message LookupRequest {
|
|
Query query = 1;
|
|
}
|
|
|
|
// LookupResponse is returned by Lookup
|
|
message LookupResponse {
|
|
repeated Route routes = 1;
|
|
}
|
|
|
|
// QueryRequest queries Table for Routes
|
|
message QueryRequest{
|
|
Query query = 1;
|
|
}
|
|
|
|
// QueryResponse is returned by Query
|
|
message QueryResponse {
|
|
repeated Route routes = 1;
|
|
}
|
|
|
|
// WatchRequest is made to Watch Router
|
|
message WatchRequest {}
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Solicit solicits routes
|
|
message Solicit {
|
|
// id of the soliciting router
|
|
string id = 1;
|
|
}
|
|
|
|
// ProcessResponse is returned by Process
|
|
message ProcessResponse {}
|
|
|
|
// CreateResponse is returned by Create
|
|
message CreateResponse {}
|
|
|
|
// DeleteResponse is returned by Delete
|
|
message DeleteResponse {}
|
|
|
|
// UpdateResponse is returned by Update
|
|
message UpdateResponse {}
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Query is passed in a LookupRequest
|
|
message Query {
|
|
// service to lookup
|
|
string service = 1;
|
|
// gateway to lookup
|
|
string gateway = 2;
|
|
// network to lookup
|
|
string network = 3;
|
|
}
|
|
|
|
// 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;
|
|
}
|
|
|
|
message Status {
|
|
string code = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
message StatusResponse {
|
|
Status status = 1;
|
|
}
|