2016-01-28 14:54:03 -05:00
|
|
|
package discoverapi
|
|
|
|
|
2016-09-18 05:57:49 -04:00
|
|
|
// Discover is an interface to be implemented by the component interested in receiving discover events
|
2016-01-28 14:54:03 -05:00
|
|
|
// like new node joining the cluster or datastore updates
|
|
|
|
type Discover interface {
|
|
|
|
// DiscoverNew is a notification for a new discovery event, Example:a new node joining a cluster
|
|
|
|
DiscoverNew(dType DiscoveryType, data interface{}) error
|
|
|
|
|
|
|
|
// DiscoverDelete is a notification for a discovery delete event, Example:a node leaving a cluster
|
|
|
|
DiscoverDelete(dType DiscoveryType, data interface{}) error
|
|
|
|
}
|
|
|
|
|
|
|
|
// DiscoveryType represents the type of discovery element the DiscoverNew function is invoked on
|
|
|
|
type DiscoveryType int
|
|
|
|
|
|
|
|
const (
|
|
|
|
// NodeDiscovery represents Node join/leave events provided by discovery
|
|
|
|
NodeDiscovery = iota + 1
|
2016-02-28 11:34:30 -05:00
|
|
|
// DatastoreConfig represents an add/remove datastore event
|
2016-01-27 19:37:47 -05:00
|
|
|
DatastoreConfig
|
2016-06-06 21:17:10 -04:00
|
|
|
// EncryptionKeysConfig represents the initial key(s) for performing datapath encryption
|
|
|
|
EncryptionKeysConfig
|
|
|
|
// EncryptionKeysUpdate represents an update to the datapath encryption key(s)
|
|
|
|
EncryptionKeysUpdate
|
2016-01-28 14:54:03 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
// NodeDiscoveryData represents the structure backing the node discovery data json string
|
|
|
|
type NodeDiscoveryData struct {
|
2016-07-19 21:17:30 -04:00
|
|
|
Address string
|
|
|
|
BindAddress string
|
|
|
|
Self bool
|
2016-01-28 14:54:03 -05:00
|
|
|
}
|
|
|
|
|
2016-01-27 19:37:47 -05:00
|
|
|
// DatastoreConfigData is the data for the datastore update event message
|
|
|
|
type DatastoreConfigData struct {
|
|
|
|
Scope string
|
2016-01-28 14:54:03 -05:00
|
|
|
Provider string
|
|
|
|
Address string
|
|
|
|
Config interface{}
|
|
|
|
}
|
2016-06-06 21:17:10 -04:00
|
|
|
|
|
|
|
// DriverEncryptionConfig contains the initial datapath encryption key(s)
|
|
|
|
// Key in first position is the primary key, the one to be used in tx.
|
|
|
|
// Original key and tag types are []byte and uint64
|
|
|
|
type DriverEncryptionConfig struct {
|
2016-06-11 07:50:25 -04:00
|
|
|
Keys [][]byte
|
|
|
|
Tags []uint64
|
2016-06-06 21:17:10 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// DriverEncryptionUpdate carries an update to the encryption key(s) as:
|
|
|
|
// a new key and/or set a primary key and/or a removal of an existing key.
|
|
|
|
// Original key and tag types are []byte and uint64
|
|
|
|
type DriverEncryptionUpdate struct {
|
2016-06-11 07:50:25 -04:00
|
|
|
Key []byte
|
|
|
|
Tag uint64
|
|
|
|
Primary []byte
|
|
|
|
PrimaryTag uint64
|
|
|
|
Prune []byte
|
|
|
|
PruneTag uint64
|
2016-06-06 21:17:10 -04:00
|
|
|
}
|