2015-06-04 07:51:16 -04:00
|
|
|
package hostdiscovery
|
|
|
|
|
2015-09-18 15:54:08 -04:00
|
|
|
import "net"
|
2015-06-04 07:51:16 -04:00
|
|
|
|
|
|
|
// JoinCallback provides a callback event for new node joining the cluster
|
|
|
|
type JoinCallback func(entries []net.IP)
|
|
|
|
|
2015-10-22 00:31:43 -04:00
|
|
|
// ActiveCallback provides a callback event for active discovery event
|
|
|
|
type ActiveCallback func()
|
|
|
|
|
2015-06-04 07:51:16 -04:00
|
|
|
// LeaveCallback provides a callback event for node leaving the cluster
|
|
|
|
type LeaveCallback func(entries []net.IP)
|
|
|
|
|
|
|
|
// HostDiscovery primary interface
|
|
|
|
type HostDiscovery interface {
|
2015-09-18 15:54:08 -04:00
|
|
|
//Watch Node join and leave cluster events
|
2015-10-22 00:31:43 -04:00
|
|
|
Watch(activeCallback ActiveCallback, joinCallback JoinCallback, leaveCallback LeaveCallback) error
|
2015-06-04 07:51:16 -04:00
|
|
|
// StopDiscovery stops the discovery perocess
|
|
|
|
StopDiscovery() error
|
|
|
|
// Fetch returns a list of host IPs that are currently discovered
|
2015-09-18 15:54:08 -04:00
|
|
|
Fetch() []net.IP
|
2015-06-04 07:51:16 -04:00
|
|
|
}
|