discoverapi.go 2.0 KB

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