github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/gossip/gossip.proto (about) 1 // Copyright 2015 The Cockroach Authors. 2 // 3 // Use of this software is governed by the Business Source License 4 // included in the file licenses/BSL.txt. 5 // 6 // As of the Change Date specified in that file, in accordance with 7 // the Business Source License, use of this software will be governed 8 // by the Apache License, Version 2.0, included in the file 9 // licenses/APL.txt. 10 11 syntax = "proto3"; 12 package cockroach.gossip; 13 option go_package = "gossip"; 14 15 import "roachpb/data.proto"; 16 import "util/hlc/timestamp.proto"; 17 import "util/unresolved_addr.proto"; 18 import "gogoproto/gogo.proto"; 19 20 // BootstrapInfo contains information necessary to bootstrap the 21 // gossip network from a cold start. 22 message BootstrapInfo { 23 // Addresses of other nodes in the cluster. 24 repeated util.UnresolvedAddr addresses = 1 [(gogoproto.nullable) = false]; 25 // Timestamp at which the bootstrap info was written. 26 util.hlc.Timestamp timestamp = 2 [(gogoproto.nullable) = false]; 27 } 28 29 // Request is the request struct passed with the Gossip RPC. 30 message Request { 31 // Requesting node's ID. 32 int32 node_id = 1 [(gogoproto.customname) = "NodeID", 33 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 34 // Address of the requesting client. 35 util.UnresolvedAddr addr = 2 [(gogoproto.nullable) = false]; 36 // Map of high water timestamps from infos originating at other 37 // nodes, as seen by the requester. 38 map<int32, int64> high_water_stamps = 3 [(gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", (gogoproto.nullable) = false]; 39 // Delta of Infos originating at sender. 40 map<string, Info> delta = 4; 41 // Cluster ID to prevent illegal connections. 42 bytes cluster_id = 5 [(gogoproto.nullable) = false, 43 (gogoproto.customname) = "ClusterID", 44 (gogoproto.customtype) = "github.com/cockroachdb/cockroach/pkg/util/uuid.UUID"]; 45 } 46 47 // Response is returned from the Gossip.Gossip RPC. 48 // Delta will be nil in the event that Alternate is set. 49 message Response { 50 // Responding Node's ID. 51 int32 node_id = 1 [(gogoproto.customname) = "NodeID", 52 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 53 // Address of the responding client. 54 util.UnresolvedAddr addr = 2 [(gogoproto.nullable) = false]; 55 // Non-nil means client should retry with this address. 56 util.UnresolvedAddr alternate_addr = 3; 57 // Node ID of the alternate address, if alternate_addr is not nil. 58 int32 alternate_node_id = 4 [(gogoproto.customname) = "AlternateNodeID", 59 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 60 // Delta of Infos which are fresh according to the map of Node info messages 61 // passed with the request. 62 map<string, Info> delta = 5; 63 // Map of high water timestamps from infos originating at other 64 // nodes, as seen by the responder. 65 map<int32, int64> high_water_stamps = 6 [(gogoproto.castkey) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID", (gogoproto.nullable) = false]; 66 } 67 68 message ConnStatus { 69 option (gogoproto.goproto_stringer) = false; 70 71 int32 node_id = 1 [(gogoproto.customname) = "NodeID", 72 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 73 string address = 2; 74 int64 age_nanos = 3; 75 } 76 77 message MetricSnap { 78 option (gogoproto.goproto_stringer) = false; 79 80 int64 bytes_received = 2; 81 int64 bytes_sent = 3; 82 int64 infos_received = 4; 83 int64 infos_sent = 5; 84 int64 conns_refused = 6; 85 } 86 87 message OutgoingConnStatus { 88 option (gogoproto.goproto_stringer) = false; 89 90 ConnStatus conn_status = 1 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; 91 MetricSnap metrics = 2 [(gogoproto.embed) = true, (gogoproto.nullable) = false]; 92 } 93 94 message ClientStatus { 95 option (gogoproto.goproto_stringer) = false; 96 97 repeated OutgoingConnStatus conn_status = 1 [(gogoproto.nullable) = false]; 98 int32 max_conns = 2; 99 } 100 101 message ServerStatus { 102 // TODO(peter): Report per connection sent/received statistics. The 103 // structure of server.Gossip and server.gossipReceiver makes this 104 // irritating to track. 105 106 option (gogoproto.goproto_stringer) = false; 107 108 repeated ConnStatus conn_status = 1 [(gogoproto.nullable) = false]; 109 int32 max_conns = 2; 110 MetricSnap metrics = 3 [(gogoproto.nullable) = false, (gogoproto.embed) = true]; 111 } 112 113 message Connectivity { 114 option (gogoproto.goproto_stringer) = false; 115 116 message Conn { 117 int32 source_id = 1 [(gogoproto.customname) = "SourceID", 118 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 119 int32 target_id = 2 [(gogoproto.customname) = "TargetID", 120 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 121 } 122 123 int32 sentinel_node_id = 1 [(gogoproto.customname) = "SentinelNodeID", 124 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 125 repeated Conn client_conns = 2 [(gogoproto.nullable) = false]; 126 } 127 128 // InfoStatus contains information about the current status of the infoStore. 129 message InfoStatus { 130 map<string, Info> infos = 1 [(gogoproto.nullable) = false]; 131 ClientStatus client = 2 [(gogoproto.nullable) = false]; 132 ServerStatus server = 3 [(gogoproto.nullable) = false]; 133 Connectivity connectivity = 4 [(gogoproto.nullable) = false]; 134 } 135 136 // Info is the basic unit of information traded over the 137 // gossip network. 138 message Info { 139 roachpb.Value value = 1 [(gogoproto.nullable) = false]; 140 // Wall time of info when generated by originating node (Unix-nanos). 141 int64 orig_stamp = 2; 142 // Wall time when info is to be discarded (Unix-nanos). 143 int64 ttl_stamp = 3 [(gogoproto.customname) = "TTLStamp"]; 144 // Number of hops from originator. 145 uint32 hops = 4; 146 // Originating node's ID. 147 int32 node_id = 5 [(gogoproto.customname) = "NodeID", 148 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 149 // Peer node ID which passed this info. 150 int32 peer_id = 6 [(gogoproto.customname) = "PeerID", 151 (gogoproto.casttype) = "github.com/cockroachdb/cockroach/pkg/roachpb.NodeID"]; 152 } 153 154 service Gossip { 155 rpc Gossip (stream Request) returns (stream Response) {} 156 }