This is a creation in Article, where the information may have evolved or changed.
Docker
Provides the implementation of the discovery package
new backend
definition interface
( discovey.go
):
Package Discoveryimport ("Errors" "Time") var (//Errnotsupported was returned when a discovery service was not Su Pported. errnotsupported = errors. New ("Discovery Service not supported")//Errnotimplemented was returned when Discovery feature was not implemented// By Discovery Backend. errnotimplemented = errors. New ("Not implemented in this discovery service")//Watcher provides watching over a cluster for nodes joining and leaving . Type Watcher Interface {//Watch the discovery for entry changes. Returns a channel that would receive changes or an error. Providing a non-nil stopch can is used to stop watching. Watch (stopch <-chan struct{}) (<-chan Entries, <-chan error)}//backend is implemented by Discovery Backends whic H Manage cluster Entries.type backend interface {//Watcher must is provided by every backend. Watcher//Initialize The discovery with URIs, a heartbeat, a TTL and optional settings. Initialize (String, time. DUration, time. Duration, map[string]string) error/Register to the discovery. Register (String) Error}
Watcher interface
node
the callback function used to join or remove cluster
the out-of-time. Initialize
used for backend
initialization, and Register
is used to node
join cluster
.