16fcf1fbda
Topology accepts an argument to define the depth of the topology requested from the network. proto definitions have been modified accordingly, too.
89 lines
1.9 KiB
Protocol Buffer
89 lines
1.9 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package go.micro.network;
|
|
|
|
import "github.com/micro/go-micro/router/proto/router.proto";
|
|
|
|
// Network service is usesd to gain visibility into networks
|
|
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) {};
|
|
}
|
|
|
|
// Empty request
|
|
message ListRequest {}
|
|
|
|
// ListResponse is returned by ListNodes
|
|
message ListResponse {
|
|
// network nodes
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
// PeerRequest requests list of peers
|
|
message PeerRequest {
|
|
// node id
|
|
string id = 1;
|
|
}
|
|
|
|
// PeerResponse is returned by ListPeers
|
|
message PeerResponse {
|
|
repeated Node peers = 1;
|
|
}
|
|
|
|
// 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
|
|
message Node {
|
|
// node id
|
|
string id = 1;
|
|
// node address
|
|
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
|
|
Node node = 1;
|
|
}
|
|
|
|
// Close is sent when the node disconnects from the network
|
|
message Close {
|
|
// network node
|
|
Node node = 1;
|
|
}
|
|
|
|
// Solicit is sent when soliciting routes from the network nodes
|
|
message Solicit {
|
|
// network node
|
|
Node node = 1;
|
|
}
|
|
|
|
// Peer is used to advertise node peers
|
|
message Peer {
|
|
// network node
|
|
Node node = 1;
|
|
// node peers
|
|
repeated Peer peers = 2;
|
|
}
|