gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/registry/service/proto/registry.proto (about)

     1  syntax = "proto3";
     2  
     3  package go.micro.registry;
     4  
     5  service Registry {
     6  	rpc GetService(GetRequest) returns (GetResponse) {};
     7  	rpc Register(Service) returns (EmptyResponse) {};
     8  	rpc Deregister(Service) returns (EmptyResponse) {};
     9  	rpc ListServices(ListRequest) returns (ListResponse) {};
    10  	rpc Watch(WatchRequest) returns (stream Result) {};
    11  }
    12  
    13  // Service represents a go-micro service
    14  message Service {
    15          string name = 1;
    16          string version = 2;
    17          map<string,string> metadata = 3;
    18          repeated Endpoint endpoints = 4;
    19          repeated Node nodes = 5;
    20          Options options = 6;
    21  }
    22  
    23  // Node represents the node the service is on
    24  message Node {
    25  	string id = 1;
    26  	string address = 2;
    27  	int64 port = 3;
    28  	map<string,string> metadata = 4;
    29  }
    30  
    31  // Endpoint is a endpoint provided by a service
    32  message Endpoint {
    33  	string name = 1;
    34  	Value request = 2;
    35  	Value response = 3;
    36  	map<string, string> metadata = 4;
    37  }
    38  
    39  // Value is an opaque value for a request or response
    40  message Value {
    41  	string name = 1;
    42  	string type = 2;
    43  	repeated Value values = 3;
    44  }
    45  
    46  // Options are registry options
    47  message Options {
    48          int64 ttl = 1;
    49  }
    50  
    51  // Result is returns by the watcher
    52  message Result {
    53  	string action = 1; // create, update, delete
    54  	Service service = 2;
    55  	int64 timestamp = 3; // unix timestamp
    56  }
    57  
    58  message EmptyResponse {}
    59  
    60  message GetRequest {
    61  	string service = 1;
    62  }
    63  
    64  message GetResponse {
    65  	repeated Service services = 1;
    66  }
    67  
    68  message ListRequest {
    69  	// TODO: filtering
    70  }
    71  
    72  message ListResponse {
    73  	repeated Service services = 1;
    74  }
    75  
    76  message WatchRequest {
    77  	// service is optional
    78  	string service = 1;
    79  }
    80  
    81  // EventType defines the type of event
    82  enum EventType {
    83          Create = 0;
    84          Delete = 1;
    85          Update = 2;
    86  }
    87  
    88  // Event is registry event
    89  message Event {
    90          // Event Id
    91          string id = 1;
    92          // type of event
    93          EventType type = 2;
    94          // unix timestamp of event
    95          int64 timestamp = 3;
    96          // service entry
    97          Service service = 4;
    98  }