github.com/Prakhar-Agarwal-byte/moby@v0.0.0-20231027092010-a14e3e8ab87e/libnetwork/discoverapi/discoverapi.go (about) 1 package discoverapi 2 3 // Discover is an interface to be implemented by the component interested in receiving discover events 4 // like new node joining the cluster or datastore updates 5 type Discover interface { 6 // DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster 7 DiscoverNew(dType DiscoveryType, data interface{}) error 8 9 // DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster 10 DiscoverDelete(dType DiscoveryType, data interface{}) error 11 } 12 13 // DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on 14 type DiscoveryType int 15 16 const ( 17 // NodeDiscovery represents Node join/leave events provided by discovery 18 NodeDiscovery = iota + 1 19 // EncryptionKeysConfig represents the initial key(s) for performing datapath encryption 20 EncryptionKeysConfig 21 // EncryptionKeysUpdate represents an update to the datapath encryption key(s) 22 EncryptionKeysUpdate 23 ) 24 25 // NodeDiscoveryData represents the structure backing the node discovery data json string 26 type NodeDiscoveryData struct { 27 Address string 28 BindAddress string 29 Self bool 30 } 31 32 // DatastoreConfigData is the data for the datastore update event message 33 type DatastoreConfigData struct { 34 Scope string 35 Provider string 36 Address string 37 Config interface{} 38 } 39 40 // DriverEncryptionConfig contains the initial datapath encryption key(s) 41 // Key in first position is the primary key, the one to be used in tx. 42 // Original key and tag types are []byte and uint64 43 type DriverEncryptionConfig struct { 44 Keys [][]byte 45 Tags []uint64 46 } 47 48 // DriverEncryptionUpdate carries an update to the encryption key(s) as: 49 // a new key and/or set a primary key and/or a removal of an existing key. 50 // Original key and tag types are []byte and uint64 51 type DriverEncryptionUpdate struct { 52 Key []byte 53 Tag uint64 54 Primary []byte 55 PrimaryTag uint64 56 Prune []byte 57 PruneTag uint64 58 }