Nodes, Peers and Topology methods for node
Topology accepts an argument to define the depth of the topology requested from the network. proto definitions have been modified accordingly, too.
This commit is contained in:
		| @@ -8,6 +8,7 @@ import "github.com/micro/go-micro/router/proto/router.proto"; | ||||
| service Network { | ||||
|         rpc ListNodes(ListRequest) returns (ListResponse) {}; | ||||
|         rpc ListPeers(PeerRequest) returns (PeerResponse) {}; | ||||
|         rpc Topology(TopologyRequest) returns (TopologyResponse) {}; | ||||
|         rpc ListRoutes(go.micro.router.Request) returns (go.micro.router.ListResponse) {}; | ||||
| } | ||||
|  | ||||
| @@ -28,15 +29,20 @@ message PeerRequest { | ||||
|  | ||||
| // PeerResponse is returned by ListPeers | ||||
| message PeerResponse { | ||||
|         Peers peers = 1; | ||||
|         repeated Node peers = 1; | ||||
| } | ||||
|  | ||||
| // Peers are node peers | ||||
| message Peers { | ||||
|         // network node | ||||
|         Node node = 1; | ||||
|         // node peers | ||||
|         repeated Node peers = 2; | ||||
| // TopologyRequest list node topology | ||||
| message TopologyRequest { | ||||
|         // node id | ||||
|         string id = 1; | ||||
|         // topology depth | ||||
|         uint64 depth = 2; | ||||
| } | ||||
|  | ||||
| // TopologyResponse is returned by Topology | ||||
| message TopologyResponse { | ||||
|         Topology topology = 1; | ||||
| } | ||||
|  | ||||
| // Node is network node | ||||
| @@ -47,6 +53,14 @@ message Node { | ||||
|         string address = 2; | ||||
| } | ||||
|  | ||||
| // Topology is used to nnounce node neighbourhood | ||||
| message Topology { | ||||
|         // network node | ||||
|         Node node = 1; | ||||
|         // neighbours | ||||
|         repeated Node nodes = 2; | ||||
| } | ||||
|  | ||||
| // Connect is sent when the node connects to the network | ||||
| message Connect { | ||||
|         // network mode | ||||
|   | ||||
		Reference in New Issue
	
	Block a user