github.com/kaisenlinux/docker.io@v0.0.0-20230510090727-ea55db55fac7/libnetwork/hostdiscovery/hostdiscovery_api.go (about)

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