github.com/tickoalcantara12/micro/v3@v3.0.0-20221007104245-9d75b9bcbab9/proto/router/router.proto (about)

     1  syntax = "proto3";
     2  
     3  package router;
     4  
     5  option go_package = "github.com/tickoalcantara12/micro/v3/proto/router;router";
     6  
     7  // Router service is used by the proxy to lookup routes
     8  service Router {
     9    rpc Lookup(LookupRequest) returns (LookupResponse) {};
    10    rpc Watch(WatchRequest) returns (stream Event) {};
    11  }
    12  
    13  service Table {
    14    rpc Create(Route) returns (CreateResponse) {};
    15    rpc Delete(Route) returns (DeleteResponse) {};
    16    rpc Update(Route) returns (UpdateResponse) {};
    17    rpc Read(ReadRequest) returns (ReadResponse) {};
    18  }
    19  
    20  // Empty request
    21  message ReadRequest {
    22  	string service = 1;
    23  }
    24  
    25  // Empty response
    26  message ReadResponse {
    27  	repeated Route routes = 1;
    28  }
    29  
    30  // LookupRequest is made to Lookup
    31  message LookupRequest {
    32    string service = 1;
    33    LookupOptions options = 2;
    34  }
    35  
    36  // LookupResponse is returned by Lookup
    37  message LookupResponse {
    38    repeated Route routes = 1;
    39  }
    40  
    41  // WatchRequest is made to Watch Router
    42  message WatchRequest {}
    43  
    44  // CreateResponse is returned by Create
    45  message CreateResponse {}
    46  
    47  // DeleteResponse is returned by Delete
    48  message DeleteResponse {}
    49  
    50  // UpdateResponse is returned by Update
    51  message UpdateResponse {}
    52  
    53  // EventType defines the type of event
    54  enum EventType {
    55    Create = 0;
    56    Delete = 1;
    57    Update = 2;
    58  }
    59  
    60  // Event is routing table event
    61  message Event {
    62    // the unique event id
    63    string id = 1;
    64    // type of event
    65    EventType type = 2;
    66    // unix timestamp of event
    67    int64 timestamp = 3;
    68    // service route
    69    Route route = 4;
    70  }
    71  
    72  // LookupOptions are passed in a LookupRequest
    73  message LookupOptions {
    74    string address = 1;
    75    string gateway = 2;
    76    string network = 3;
    77    string router = 4;
    78    string link = 5;
    79  }
    80  
    81  // Route is a service route
    82  message Route {
    83    // service for the route
    84    string service = 1;
    85    // the address that advertise this route
    86    string address = 2;
    87    // gateway as the next hop
    88    string gateway = 3;
    89    // the network for this destination
    90    string network = 4;
    91    // router if the router id
    92    string router = 5;
    93    // the network link
    94    string link = 6;
    95    // the metric / score of this route
    96    int64 metric = 7;
    97    // metadata for the route
    98    map<string,string> metadata = 8;
    99  }