import "github.com/docker/docker/vendor/github.com/docker/libnetwork/networkdb"
Package networkdb is a generated protocol buffer package.
It is generated from these files:
networkdb/networkdb.proto
It has these top-level messages:
GossipMessage NodeEvent NetworkEvent NetworkEntry NetworkPushPull TableEvent BulkSyncMessage CompoundMessage
broadcast.go cluster.go delegate.go event_delegate.go message.go networkdb.go networkdb.pb.go networkdbdiagnostic.go nodemgmt.go watch.go
const NodeTable = "NodeTable"
NodeTable represents table event for node join and leave
var ( ErrInvalidLengthNetworkdb = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowNetworkdb = fmt.Errorf("proto: integer overflow") )
var MessageType_name = map[int32]string{ 0: "INVALID", 1: "NETWORK_EVENT", 2: "TABLE_EVENT", 3: "PUSH_PULL", 4: "BULK_SYNC", 5: "COMPOUND", 6: "NODE_EVENT", }
var MessageType_value = map[string]int32{ "INVALID": 0, "NETWORK_EVENT": 1, "TABLE_EVENT": 2, "PUSH_PULL": 3, "BULK_SYNC": 4, "COMPOUND": 5, "NODE_EVENT": 6, }
var NetDbPaths2Func = map[string]diagnostic.HTTPHandlerFunc{ "/join": dbJoin, "/networkpeers": dbPeers, "/clusterpeers": dbClusterPeers, "/joinnetwork": dbJoinNetwork, "/leavenetwork": dbLeaveNetwork, "/createentry": dbCreateEntry, "/updateentry": dbUpdateEntry, "/deleteentry": dbDeleteEntry, "/getentry": dbGetEntry, "/gettable": dbGetTable, "/networkstats": dbNetworkStats, }
NetDbPaths2Func TODO
var TableEvent_Type_name = map[int32]string{ 0: "INVALID", 1: "CREATE", 2: "UPDATE", 3: "DELETE", }
var TableEvent_Type_value = map[string]int32{ "INVALID": 0, "CREATE": 1, "UPDATE": 2, "DELETE": 3, }
type BulkSyncMessage struct { // Lamport time when this bulk sync was initiated. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,1,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` // Indicates if this bulksync is a response to a bulk sync // request from a peer node. Unsolicited bool `protobuf:"varint,2,opt,name=unsolicited,proto3" json:"unsolicited,omitempty"` // Name of the node which is producing this bulk sync message. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` // List of network names whose table entries are getting // bulksynced as part of the bulksync. Networks []string `protobuf:"bytes,4,rep,name=networks" json:"networks,omitempty"` // Bulksync payload Payload []byte `protobuf:"bytes,5,opt,name=payload,proto3" json:"payload,omitempty"` }
BulkSync message payload definition.
func (*BulkSyncMessage) Descriptor() ([]byte, []int)
func (m *BulkSyncMessage) GetNetworks() []string
func (m *BulkSyncMessage) GetNodeName() string
func (m *BulkSyncMessage) GetPayload() []byte
func (m *BulkSyncMessage) GetUnsolicited() bool
func (this *BulkSyncMessage) GoString() string
func (m *BulkSyncMessage) Marshal() (dAtA []byte, err error)
func (m *BulkSyncMessage) MarshalTo(dAtA []byte) (int, error)
func (*BulkSyncMessage) ProtoMessage()
func (m *BulkSyncMessage) Reset()
func (m *BulkSyncMessage) Size() (n int)
func (this *BulkSyncMessage) String() string
func (m *BulkSyncMessage) Unmarshal(dAtA []byte) error
type CompoundMessage struct { // A list of simple messages. Messages []*CompoundMessage_SimpleMessage `protobuf:"bytes,1,rep,name=messages" json:"messages,omitempty"` }
Compound message payload definition.
func (*CompoundMessage) Descriptor() ([]byte, []int)
func (m *CompoundMessage) GetMessages() []*CompoundMessage_SimpleMessage
func (this *CompoundMessage) GoString() string
func (m *CompoundMessage) Marshal() (dAtA []byte, err error)
func (m *CompoundMessage) MarshalTo(dAtA []byte) (int, error)
func (*CompoundMessage) ProtoMessage()
func (m *CompoundMessage) Reset()
func (m *CompoundMessage) Size() (n int)
func (this *CompoundMessage) String() string
func (m *CompoundMessage) Unmarshal(dAtA []byte) error
type CompoundMessage_SimpleMessage struct { // Bytestring payload of a message constructed using // other message type definitions. Payload []byte `protobuf:"bytes,1,opt,name=Payload,proto3" json:"Payload,omitempty"` }
func (*CompoundMessage_SimpleMessage) Descriptor() ([]byte, []int)
func (m *CompoundMessage_SimpleMessage) GetPayload() []byte
func (this *CompoundMessage_SimpleMessage) GoString() string
func (m *CompoundMessage_SimpleMessage) Marshal() (dAtA []byte, err error)
func (m *CompoundMessage_SimpleMessage) MarshalTo(dAtA []byte) (int, error)
func (*CompoundMessage_SimpleMessage) ProtoMessage()
func (m *CompoundMessage_SimpleMessage) Reset()
func (m *CompoundMessage_SimpleMessage) Size() (n int)
func (this *CompoundMessage_SimpleMessage) String() string
func (m *CompoundMessage_SimpleMessage) Unmarshal(dAtA []byte) error
type Config struct { // NodeID is the node unique identifier of the node when is part of the cluster NodeID string // Hostname is the node hostname. Hostname string // BindAddr is the IP on which networkdb listens. It can be // 0.0.0.0 to listen on all addresses on the host. BindAddr string // AdvertiseAddr is the node's IP address that we advertise for // cluster communication. AdvertiseAddr string // BindPort is the local node's port to which we bind to for // cluster communication. BindPort int // Keys to be added to the Keyring of the memberlist. Key at index // 0 is the primary key Keys [][]byte // PacketBufferSize is the maximum number of bytes that memberlist will // put in a packet (this will be for UDP packets by default with a NetTransport). // A safe value for this is typically 1400 bytes (which is the default). However, // depending on your network's MTU (Maximum Transmission Unit) you may // be able to increase this to get more content into each gossip packet. PacketBufferSize int // StatsPrintPeriod the period to use to print queue stats // Default is 5min StatsPrintPeriod time.Duration // HealthPrintPeriod the period to use to print the health score // Default is 1min HealthPrintPeriod time.Duration // contains filtered or unexported fields }
Config represents the configuration of the networkdb instance and can be passed by the caller.
DefaultConfig returns a NetworkDB config with default values
type CreateEvent event
CreateEvent generates a table entry create event to the watchers
type DeleteEvent event
DeleteEvent generates a table entry delete event to the watchers
type GossipMessage struct { Type MessageType `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.MessageType" json:"type,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` }
GossipMessage is a basic message header used by all messages types.
func (*GossipMessage) Descriptor() ([]byte, []int)
func (m *GossipMessage) GetData() []byte
func (m *GossipMessage) GetType() MessageType
func (this *GossipMessage) GoString() string
func (m *GossipMessage) Marshal() (dAtA []byte, err error)
func (m *GossipMessage) MarshalTo(dAtA []byte) (int, error)
func (*GossipMessage) ProtoMessage()
func (m *GossipMessage) Reset()
func (m *GossipMessage) Size() (n int)
func (this *GossipMessage) String() string
func (m *GossipMessage) Unmarshal(dAtA []byte) error
MessageType enum defines all the core message types that networkdb uses to communicate to peers.
const ( MessageTypeInvalid MessageType = 0 // NetworkEvent message type is used to communicate network // attachments on the node. MessageTypeNetworkEvent MessageType = 1 // TableEvent message type is used to communicate any table // CRUD event that happened on the node. MessageTypeTableEvent MessageType = 2 // PushPull message type is used to syncup all network // attachments on a peer node either during startup of this // node or with a random peer node periodically thereafter. MessageTypePushPull MessageType = 3 // BulkSync message is used to bulksync the whole networkdb // state with a peer node during startup of this node or with // a random peer node periodically thereafter. MessageTypeBulkSync MessageType = 4 // Compound message type is used to form a compound message // which is a pack of many message of above types, packed into // a single compound message. MessageTypeCompound MessageType = 5 // NodeEvent message type is used to communicate node // join/leave events in the cluster MessageTypeNodeEvent MessageType = 6 )
func (MessageType) EnumDescriptor() ([]byte, []int)
func (x MessageType) String() string
NetworkDB instance drives the networkdb cluster and acts the broker for cluster-scoped and network-scoped gossip and watches.
New creates a new instance of NetworkDB using the Config passed by the caller.
Close destroys this NetworkDB instance by leave the cluster, stopping timers, canceling goroutines etc.
ClusterPeers returns all the gossip cluster peers.
CreateEntry creates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster. It is an error to create an entry for the same tuple for which there is already an existing entry unless the current entry is deleting state.
DeleteEntry deletes a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster.
GetEntry retrieves the value of a table entry in a given (network, table, key) tuple
GetTableByNetwork walks the networkdb by the give table and network id and returns a map of keys and values
Join joins this NetworkDB instance with a list of peer NetworkDB instances passed by the caller in the form of addr:port
JoinNetwork joins this node to a given network and propagates this event across the cluster. This triggers this node joining the sub-cluster of this network and participates in the network-scoped gossip and bulk sync for this network.
LeaveNetwork leaves this node from a given network and propagates this event across the cluster. This triggers this node leaving the sub-cluster of this network and as a result will no longer participate in the network-scoped gossip and bulk sync for this network. Also remove all the table entries for this network from networkdb
Peers returns the gossip peers for a given network.
RemoveKey removes a key from the key ring. The key being removed can't be the primary key
SetKey adds a new key to the key ring
SetPrimaryKey sets the given key as the primary key. This should have been added apriori through SetKey
UpdateEntry updates a table entry in NetworkDB for given (network, table, key) tuple and if the NetworkDB is part of the cluster propagates this event to the cluster. It is an error to update a non-existent entry.
WalkTable walks a single table in NetworkDB and invokes the passed function for each entry in the table passing the network, key, value. The walk stops if the passed function returns a true.
Watch creates a watcher with filters for a particular table or network or key or any combination of the tuple. If any of the filter is an empty string it acts as a wildcard for that field. Watch returns a channel of events, where the events will be sent.
type NetworkEntry struct { // ID of the network NetworkID string `protobuf:"bytes,1,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` // Latest lamport time of the network attachment when this // network event was recorded. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` // Source node name where this network attachment happened. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` // Indicates if a leave from this network is in progress. Leaving bool `protobuf:"varint,4,opt,name=leaving,proto3" json:"leaving,omitempty"` }
NetworkEntry for push pull of networks.
func (*NetworkEntry) Descriptor() ([]byte, []int)
func (m *NetworkEntry) GetLeaving() bool
func (m *NetworkEntry) GetNetworkID() string
func (m *NetworkEntry) GetNodeName() string
func (this *NetworkEntry) GoString() string
func (m *NetworkEntry) Marshal() (dAtA []byte, err error)
func (m *NetworkEntry) MarshalTo(dAtA []byte) (int, error)
func (*NetworkEntry) ProtoMessage()
func (m *NetworkEntry) Reset()
func (m *NetworkEntry) Size() (n int)
func (this *NetworkEntry) String() string
func (m *NetworkEntry) Unmarshal(dAtA []byte) error
type NetworkEvent struct { Type NetworkEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.NetworkEvent_Type" json:"type,omitempty"` // Lamport time using a network lamport clock indicating the // time this event was generated on the node where it was // generated. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` // Source node name. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` // ID of the network for which the event is generated. NetworkID string `protobuf:"bytes,4,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` }
NetworkEvent message payload definition.
func (*NetworkEvent) Descriptor() ([]byte, []int)
func (m *NetworkEvent) GetNetworkID() string
func (m *NetworkEvent) GetNodeName() string
func (m *NetworkEvent) GetType() NetworkEvent_Type
func (this *NetworkEvent) GoString() string
func (m *NetworkEvent) Marshal() (dAtA []byte, err error)
func (m *NetworkEvent) MarshalTo(dAtA []byte) (int, error)
func (*NetworkEvent) ProtoMessage()
func (m *NetworkEvent) Reset()
func (m *NetworkEvent) Size() (n int)
func (this *NetworkEvent) String() string
func (m *NetworkEvent) Unmarshal(dAtA []byte) error
const ( NetworkEventTypeInvalid NetworkEvent_Type = 0 // Join event is generated when this node joins a network. NetworkEventTypeJoin NetworkEvent_Type = 1 // Leave event is generated when this node leaves a network. NetworkEventTypeLeave NetworkEvent_Type = 2 )
func (NetworkEvent_Type) EnumDescriptor() ([]byte, []int)
func (x NetworkEvent_Type) String() string
type NetworkPushPull struct { // Lamport time when this push pull was initiated. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,1,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` Networks []*NetworkEntry `protobuf:"bytes,2,rep,name=networks" json:"networks,omitempty"` // Name of the node sending this push pull payload. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` }
NetworkPushpull message payload definition.
func (*NetworkPushPull) Descriptor() ([]byte, []int)
func (m *NetworkPushPull) GetNetworks() []*NetworkEntry
func (m *NetworkPushPull) GetNodeName() string
func (this *NetworkPushPull) GoString() string
func (m *NetworkPushPull) Marshal() (dAtA []byte, err error)
func (m *NetworkPushPull) MarshalTo(dAtA []byte) (int, error)
func (*NetworkPushPull) ProtoMessage()
func (m *NetworkPushPull) Reset()
func (m *NetworkPushPull) Size() (n int)
func (this *NetworkPushPull) String() string
func (m *NetworkPushPull) Unmarshal(dAtA []byte) error
NodeAddr represents the value carried for node event in NodeTable
type NodeEvent struct { Type NodeEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.NodeEvent_Type" json:"type,omitempty"` // Lamport time using a network lamport clock indicating the // time this event was generated on the node where it was // generated. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` // Source node name. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` }
NodeEvent message payload definition.
func (m *NodeEvent) GetType() NodeEvent_Type
const ( NodeEventTypeInvalid NodeEvent_Type = 0 // Join event is generated when this node joins the cluster. NodeEventTypeJoin NodeEvent_Type = 1 // Leave event is generated when this node leaves the cluster. NodeEventTypeLeave NodeEvent_Type = 2 )
func (NodeEvent_Type) EnumDescriptor() ([]byte, []int)
func (x NodeEvent_Type) String() string
PeerClusterInfo represents the peer (gossip cluster) nodes
PeerInfo represents the peer (gossip cluster) nodes of a network
TableElem elem
type TableEvent struct { Type TableEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=networkdb.TableEvent_Type" json:"type,omitempty"` // Lamport time when this event was generated. LTime github_com_hashicorp_serf_serf.LamportTime `protobuf:"varint,2,opt,name=l_time,json=lTime,proto3,customtype=github.com/hashicorp/serf/serf.LamportTime" json:"l_time"` // Node name where this event originated. NodeName string `protobuf:"bytes,3,opt,name=node_name,json=nodeName,proto3" json:"node_name,omitempty"` // ID of the network to which this table entry belongs. NetworkID string `protobuf:"bytes,4,opt,name=network_id,json=networkId,proto3" json:"network_id,omitempty"` // Name of the table to which this table entry belongs. TableName string `protobuf:"bytes,5,opt,name=table_name,json=tableName,proto3" json:"table_name,omitempty"` // Entry key. Key string `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"` // Entry value. Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"` // Residual reap time for the entry before getting deleted in seconds ResidualReapTime int32 `protobuf:"varint,8,opt,name=residual_reap_time,json=residualReapTime,proto3" json:"residual_reap_time,omitempty"` }
TableEvent message payload definition.
func (*TableEvent) Descriptor() ([]byte, []int)
func (m *TableEvent) GetKey() string
func (m *TableEvent) GetNetworkID() string
func (m *TableEvent) GetNodeName() string
func (m *TableEvent) GetResidualReapTime() int32
func (m *TableEvent) GetTableName() string
func (m *TableEvent) GetType() TableEvent_Type
func (m *TableEvent) GetValue() []byte
func (this *TableEvent) GoString() string
func (m *TableEvent) Marshal() (dAtA []byte, err error)
func (m *TableEvent) MarshalTo(dAtA []byte) (int, error)
func (*TableEvent) ProtoMessage()
func (m *TableEvent) Reset()
func (m *TableEvent) Size() (n int)
func (this *TableEvent) String() string
func (m *TableEvent) Unmarshal(dAtA []byte) error
const ( TableEventTypeInvalid TableEvent_Type = 0 // Create signifies that this table entry was just // created. TableEventTypeCreate TableEvent_Type = 1 // Update signifies that this table entry was just // updated. TableEventTypeUpdate TableEvent_Type = 2 // Delete signifies that this table entry was just // updated. TableEventTypeDelete TableEvent_Type = 3 )
func (TableEvent_Type) EnumDescriptor() ([]byte, []int)
func (x TableEvent_Type) String() string
type UpdateEvent event
UpdateEvent generates a table entry update event to the watchers
Package networkdb imports 31 packages (graph). Updated 2020-05-01. Refresh now. Tools for package owners.