package discovery
import "github.com/docker/cli/components/engine/pkg/discovery"
Index ¶
- Variables
- func Generate(pattern string) []string
- func ParseAdvertise(advertise string) (string, error)
- func Register(scheme string, d Backend) error
- type Backend
- type Entries
- func CreateEntries(addrs []string) (Entries, error)
- func (e Entries) Contains(entry *Entry) bool
- func (e Entries) Diff(cmp Entries) (Entries, Entries)
- func (e Entries) Equals(cmp Entries) bool
- type Entry
- func NewEntry(url string) (*Entry, error)
- func (e *Entry) Equals(cmp *Entry) bool
- func (e *Entry) String() string
- type Watcher
Variables ¶
var ( // ErrNotSupported is returned when a discovery service is not supported. ErrNotSupported = errors.New("discovery service not supported") // ErrNotImplemented is returned when discovery feature is not implemented // by discovery backend. ErrNotImplemented = errors.New("not implemented in this discovery service") )
Functions ¶
func Generate ¶
Generate takes care of IP generation
func ParseAdvertise ¶
ParseAdvertise parses the --cluster-advertise daemon config which accepts <ip-address>:<port> or <interface-name>:<port>
func Register ¶
Register makes a discovery backend available by the provided scheme. If Register is called twice with the same scheme an error is returned.
Types ¶
type Backend ¶
type Backend interface { // Watcher must be 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 }
Backend is implemented by discovery backends which manage cluster entries.
func New ¶
func New(rawurl string, heartbeat time.Duration, ttl time.Duration, clusterOpts map[string]string) (Backend, error)
New returns a new Discovery given a URL, heartbeat and ttl settings. Returns an error if the URL scheme is not supported.
type Entries ¶
type Entries []*Entry
Entries is a list of *Entry with some helpers.
func CreateEntries ¶
CreateEntries returns an array of entries based on the given addresses.
func (Entries) Contains ¶
Contains returns true if the Entries contain a given Entry.
func (Entries) Diff ¶
Diff compares two entries and returns the added and removed entries.
func (Entries) Equals ¶
Equals returns true if cmp contains the same data.
type Entry ¶
An Entry represents a host.
func NewEntry ¶
NewEntry creates a new entry.
func (*Entry) Equals ¶
Equals returns true if cmp contains the same data.
func (*Entry) String ¶
String returns the string form of an entry.
type Watcher ¶
type Watcher interface { // Watch the discovery for entry changes. // Returns a channel that will receive changes or an error. // Providing a non-nil stopCh can be used to stop watching. Watch(stopCh <-chan struct{}) (<-chan Entries, <-chan error) }
Watcher provides watching over a cluster for nodes joining and leaving.
Source Files ¶
backends.go discovery.go entry.go generator.go
Directories ¶
Path | Synopsis |
---|---|
components/engine/pkg/discovery/file | |
components/engine/pkg/discovery/kv | |
components/engine/pkg/discovery/memory | |
components/engine/pkg/discovery/nodes |
- Version
- v17.12.0-ce-rc3+incompatible
- Published
- Dec 14, 2017
- Platform
- js/wasm
- Imports
- 8 packages
- Last checked
- 5 hours ago –
Tools for package owners.