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