github.com/Heebron/moby@v0.0.0-20221111184709-6eab4f55faf7/libnetwork/networkdb/networkdb.proto (about) 1 syntax = "proto3"; 2 3 import "gogoproto/gogo.proto"; 4 5 package networkdb; 6 7 option (gogoproto.marshaler_all) = true; 8 option (gogoproto.unmarshaler_all) = true; 9 option (gogoproto.stringer_all) = true; 10 option (gogoproto.gostring_all) = true; 11 option (gogoproto.sizer_all) = true; 12 option (gogoproto.goproto_stringer_all) = false; 13 14 // MessageType enum defines all the core message types that networkdb 15 // uses to communicate to peers. 16 enum MessageType { 17 option (gogoproto.goproto_enum_prefix) = false; 18 option (gogoproto.enum_customname) = "MessageType"; 19 20 INVALID = 0 [(gogoproto.enumvalue_customname) = "MessageTypeInvalid"]; 21 22 // NetworkEvent message type is used to communicate network 23 // attachments on the node. 24 NETWORK_EVENT = 1 [(gogoproto.enumvalue_customname) = "MessageTypeNetworkEvent"]; 25 26 // TableEvent message type is used to communicate any table 27 // CRUD event that happened on the node. 28 TABLE_EVENT = 2 [(gogoproto.enumvalue_customname) = "MessageTypeTableEvent"]; 29 30 // PushPull message type is used to syncup all network 31 // attachments on a peer node either during startup of this 32 // node or with a random peer node periodically thereafter. 33 PUSH_PULL = 3 [(gogoproto.enumvalue_customname) = "MessageTypePushPull"]; 34 35 // BulkSync message is used to bulksync the whole networkdb 36 // state with a peer node during startup of this node or with 37 // a random peer node periodically thereafter. 38 BULK_SYNC = 4 [(gogoproto.enumvalue_customname) = "MessageTypeBulkSync"]; 39 40 // Compound message type is used to form a compound message 41 // which is a pack of many message of above types, packed into 42 // a single compound message. 43 COMPOUND = 5 [(gogoproto.enumvalue_customname) = "MessageTypeCompound"]; 44 45 // NodeEvent message type is used to communicate node 46 // join/leave events in the cluster 47 NODE_EVENT = 6 [(gogoproto.enumvalue_customname) = "MessageTypeNodeEvent"]; 48 } 49 50 // GossipMessage is a basic message header used by all messages types. 51 message GossipMessage { 52 MessageType type = 1; // type defines one of the message types defined above. 53 bytes data = 2; // Payload of the message of any type defined here. 54 } 55 56 // NodeEvent message payload definition. 57 message NodeEvent { 58 enum Type { 59 option (gogoproto.goproto_enum_prefix) = false; 60 option (gogoproto.enum_customname) = "Type"; 61 62 INVALID = 0 [(gogoproto.enumvalue_customname) = "NodeEventTypeInvalid"]; 63 // Join event is generated when this node joins the cluster. 64 JOIN = 1 [(gogoproto.enumvalue_customname) = "NodeEventTypeJoin"];; 65 // Leave event is generated when this node leaves the cluster. 66 LEAVE = 2 [(gogoproto.enumvalue_customname) = "NodeEventTypeLeave"];; 67 } 68 69 Type type = 1; 70 71 // Lamport time using a network lamport clock indicating the 72 // time this event was generated on the node where it was 73 // generated. 74 uint64 l_time = 2 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 75 // Source node name. 76 string node_name = 3; 77 } 78 79 // NetworkEvent message payload definition. 80 message NetworkEvent { 81 enum Type { 82 option (gogoproto.goproto_enum_prefix) = false; 83 option (gogoproto.enum_customname) = "Type"; 84 85 INVALID = 0 [(gogoproto.enumvalue_customname) = "NetworkEventTypeInvalid"]; 86 // Join event is generated when this node joins a network. 87 JOIN = 1 [(gogoproto.enumvalue_customname) = "NetworkEventTypeJoin"];; 88 // Leave event is generated when this node leaves a network. 89 LEAVE = 2 [(gogoproto.enumvalue_customname) = "NetworkEventTypeLeave"];; 90 } 91 92 Type type = 1; 93 94 // Lamport time using a network lamport clock indicating the 95 // time this event was generated on the node where it was 96 // generated. 97 uint64 l_time = 2 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 98 // Source node name. 99 string node_name = 3; 100 // ID of the network for which the event is generated. 101 string network_id = 4 [(gogoproto.customname) = "NetworkID"]; 102 } 103 104 // NetworkEntry for push pull of networks. 105 message NetworkEntry { 106 // ID of the network 107 string network_id = 1 [(gogoproto.customname) = "NetworkID"]; 108 // Latest lamport time of the network attachment when this 109 // network event was recorded. 110 uint64 l_time = 2 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 111 // Source node name where this network attachment happened. 112 string node_name = 3 [(gogoproto.customname) = "NodeName"]; 113 // Indicates if a leave from this network is in progress. 114 bool leaving = 4; 115 } 116 117 // NetworkPushpull message payload definition. 118 message NetworkPushPull { 119 // Lamport time when this push pull was initiated. 120 uint64 l_time = 1 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 121 repeated NetworkEntry networks = 2; 122 // Name of the node sending this push pull payload. 123 string node_name = 3 [(gogoproto.customname) = "NodeName"]; 124 } 125 126 // TableEvent message payload definition. 127 message TableEvent { 128 enum Type { 129 option (gogoproto.goproto_enum_prefix) = false; 130 option (gogoproto.enum_customname) = "Type"; 131 132 INVALID = 0 [(gogoproto.enumvalue_customname) = "TableEventTypeInvalid"]; 133 // Create signifies that this table entry was just 134 // created. 135 CREATE = 1 [(gogoproto.enumvalue_customname) = "TableEventTypeCreate"]; 136 // Update signifies that this table entry was just 137 // updated. 138 UPDATE = 2 [(gogoproto.enumvalue_customname) = "TableEventTypeUpdate"]; 139 // Delete signifies that this table entry was just 140 // updated. 141 DELETE = 3 [(gogoproto.enumvalue_customname) = "TableEventTypeDelete"]; 142 } 143 144 Type type = 1; 145 // Lamport time when this event was generated. 146 uint64 l_time = 2 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 147 // Node name where this event originated. 148 string node_name = 3; 149 // ID of the network to which this table entry belongs. 150 string network_id = 4 [(gogoproto.customname) = "NetworkID"]; 151 // Name of the table to which this table entry belongs. 152 string table_name = 5; 153 // Entry key. 154 string key = 6; 155 // Entry value. 156 bytes value = 7; 157 // Residual reap time for the entry before getting deleted in seconds 158 int32 residual_reap_time = 8 [(gogoproto.customname) = "ResidualReapTime"];; 159 } 160 161 // BulkSync message payload definition. 162 message BulkSyncMessage { 163 // Lamport time when this bulk sync was initiated. 164 uint64 l_time = 1 [(gogoproto.customtype) = "github.com/hashicorp/serf/serf.LamportTime", (gogoproto.nullable) = false]; 165 // Indicates if this bulksync is a response to a bulk sync 166 // request from a peer node. 167 bool unsolicited = 2; 168 // Name of the node which is producing this bulk sync message. 169 string node_name = 3; 170 // List of network names whose table entries are getting 171 // bulksynced as part of the bulksync. 172 repeated string networks = 4; 173 // Bulksync payload 174 bytes payload = 5; 175 } 176 177 // Compound message payload definition. 178 message CompoundMessage { 179 message SimpleMessage { 180 // Bytestring payload of a message constructed using 181 // other message type definitions. 182 bytes Payload = 1; 183 } 184 185 // A list of simple messages. 186 repeated SimpleMessage messages = 1; 187 }