Docker Swarm Code Analysis Note (2)--discovery

Source: Internet
Author: User
Tags docker swarm
This is a creation in Article, where the information may have evolved or changed.

DockerProvides 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 interfacenodethe callback function used to join or remove cluster the out-of-time. Initializeused for backend initialization, and Register is used to node join cluster .

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.