bf42c028fb
This commit adds a Sync message which is sent as a reply to Connect message. This should in theory speed up convergence of a (re)connecting node. We respond to Sync message by sending a peer message back to the peer origin of the Sync message. We consequently update our routing table and peer graph with the data sent in via Sync message. We now gossip advertse to up to 3 randomly selected peers instead of sending a multicast message to the network. Equally, Solicitation i.e. full table adverts are gossipped to a randomly selected peer. If that fails we send a multicast message to the network.
111 lines
2.3 KiB
Protocol Buffer
111 lines
2.3 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package go.micro.network;
|
|
|
|
import "github.com/micro/go-micro/router/service/proto/router.proto";
|
|
|
|
// Network service is usesd to gain visibility into networks
|
|
service Network {
|
|
// Connect to the network
|
|
rpc Connect(ConnectRequest) returns (ConnectResponse) {};
|
|
// Returns the entire network graph
|
|
rpc Graph(GraphRequest) returns (GraphResponse) {};
|
|
// Returns a list of known nodes in the network
|
|
rpc Nodes(NodesRequest) returns (NodesResponse) {};
|
|
// Returns a list of known routes in the network
|
|
rpc Routes(RoutesRequest) returns (RoutesResponse) {};
|
|
// Returns a list of known services based on routes
|
|
rpc Services(ServicesRequest) returns (ServicesResponse) {};
|
|
}
|
|
|
|
// Query is passed in a LookupRequest
|
|
message Query {
|
|
string service = 1;
|
|
string address = 2;
|
|
string gateway = 3;
|
|
string router = 4;
|
|
string network = 5;
|
|
}
|
|
|
|
message ConnectRequest {
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
message ConnectResponse {}
|
|
|
|
// PeerRequest requests list of peers
|
|
message NodesRequest {
|
|
// node topology depth
|
|
uint32 depth = 1;
|
|
}
|
|
|
|
// PeerResponse is returned by ListPeers
|
|
message NodesResponse {
|
|
// return peer topology
|
|
repeated Node nodes = 1;
|
|
}
|
|
|
|
message GraphRequest {
|
|
// node topology depth
|
|
uint32 depth = 1;
|
|
}
|
|
|
|
message GraphResponse {
|
|
Peer root = 1;
|
|
}
|
|
|
|
message RoutesRequest {
|
|
// filter based on
|
|
Query query = 1;
|
|
}
|
|
|
|
message RoutesResponse {
|
|
repeated go.micro.router.Route routes = 1;
|
|
}
|
|
|
|
message ServicesRequest {}
|
|
|
|
message ServicesResponse {
|
|
repeated string services = 1;
|
|
}
|
|
|
|
// Node is network node
|
|
message Node {
|
|
// node id
|
|
string id = 1;
|
|
// node address
|
|
string address = 2;
|
|
// the network
|
|
string network = 3;
|
|
// associated metadata
|
|
map<string,string> metadata = 4;
|
|
}
|
|
|
|
// 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;
|
|
}
|
|
|
|
// Peer is used to advertise node peers
|
|
message Peer {
|
|
// network node
|
|
Node node = 1;
|
|
// node peers
|
|
repeated Peer peers = 2;
|
|
}
|
|
|
|
// Sync is network sync message
|
|
message Sync {
|
|
// peer origin
|
|
Peer peer = 1;
|
|
// node routes
|
|
repeated go.micro.router.Route routes = 2;
|
|
}
|