hostdiscovery_api.go 734 B

12345678910111213141516171819202122
  1. package hostdiscovery
  2. import "net"
  3. // JoinCallback provides a callback event for new node joining the cluster
  4. type JoinCallback func(entries []net.IP)
  5. // ActiveCallback provides a callback event for active discovery event
  6. type ActiveCallback func()
  7. // LeaveCallback provides a callback event for node leaving the cluster
  8. type LeaveCallback func(entries []net.IP)
  9. // HostDiscovery primary interface
  10. type HostDiscovery interface {
  11. //Watch Node join and leave cluster events
  12. Watch(activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) error
  13. // StopDiscovery stops the discovery process
  14. StopDiscovery() error
  15. // Fetch returns a list of host IPs that are currently discovered
  16. Fetch() []net.IP
  17. }