Commit Graph

30 Commits

Author SHA1 Message Date
Victor Vieux 52db3436a2 add ttl placeholder to discovery
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-10 17:03:48 -07:00
Madhu Venugopal 23ecada9d7 Adding export Init method for the exported discovery components
Since Swarm discovery is used by libnetwork without the swarm main(), it
is forced to use annonymous import in order to force-trigger the
unexported init() methods. Using annonymous import is highly discouraged
in a Non-Main and Non-Test packages.

Introducing exported Init() methods on these files so that libnetwork
can use Discovery as a library without having a main package.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-20 20:18:13 -07:00
Alexandre Beslic f81de46ab4 Fix Consul and etcd with latest changes, use etcd v2.0.11 for integration tests, remove call to SyncCluster for now (breaks the integration tests)
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 10:25:31 -07:00
Andrea Luzzardi 2106966d54 discovery: Watch tests for file and some other tests.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:14 -07:00
Andrea Luzzardi 0c72bcaf40 discovery cleanup: heartbeat is a time.Duration.
- Use a time.Duration instead of a uint64 for hb
- Flags can accept durations: --heartbeat 25s

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:14 -07:00
Andrea Luzzardi f33c03af93 discovery: Push watch errors to a channel
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:14 -07:00
Andrea Luzzardi 97984881c3 discovery: New channel based API.
- Watch() issues updates by channel rather than by callback
- Fetch() is gone
- Watch() can be stopped at any time by closing the stop channel
- Watch() is now resilient to errors and will try over and over

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:13 -07:00
Andrea Luzzardi d492feb7cc golint: DiscoveryService -> Discovery
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-04-15 14:26:39 -07:00
Kushal Pisavadia 78dba5d623 Remove prefixes from DiscoveryService implementations
All of these structs are public. Previously when they were used, they'd
look like the following:

 - `consul.ConsulDiscoveryService`
 - `etcd.EtcdDiscoveryService`
 - `file.FileDiscoveryService`
 - `nodes.NodesDiscoveryService`
 - `token.TokenDiscoveryService`
 - `zookeeper.ZkDiscoveryService`

As a result, they stuttered when read. This commit removes the
duplication of the package names on the struct so that they read better.

See also: https://golang.org/ref/spec#Import_declarations

Signed-off-by: Kushal Pisavadia <kushi.p@gmail.com>
2015-04-15 20:58:17 +01:00
Sriram Natarajan b174aa26de Change heartbeat type to unsigned int
Check if heartbeat value is greater than zero

Signed-off-by: Sriram Natarajan <natarajan.sriram@gmail.com>
2015-04-09 00:04:50 +00:00
Matt Bajor d87c48ae4e Fix lint violations
This changeset fixes all lint violations that show up with a
min_confidence of 1

- Issue #500: Run golint on codebase

Signed-off-by: Matt Bajor <matt@notevenremotelydorky.com>
2015-03-27 21:17:44 -06:00
Victor Vieux ff22cbc2d3 fix panic in token discovery
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-18 22:08:07 -08:00
Victor Vieux 3df8bbed61 refactor createEntries
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-10 02:25:38 +00:00
Victor Vieux ba01634743 replace discovery.Node by discovery.Entry
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-02-10 01:58:43 +00:00
Pierre Wacrenier e3bf42d5be Force connection close with token discovery
Signed-off-by: Pierre Wacrenier <pierre.wacrenier@gmail.com>
2015-02-01 05:48:30 +01:00
Victor Vieux 29bfee02fe error when token is empty
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-01-30 22:42:18 +00:00
Victor Vieux 3c595e96e2 cleanup
Signed-off-by: Victor Vieux <vieux@docker.com>
2015-01-26 19:27:25 +00:00
Ankush Agarwal b3bcab711e Add error message when discovery service returns non 200
status code. Update doc for token.go/Fetch

Signed-off-by: Ankush Agarwal <ankushagarwal11@gmail.com>
2015-01-26 00:18:11 -08:00
Brian Goff a916f9cde0 Fixes panic when ports are not specified
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
2015-01-23 15:56:14 -05:00
Victor Vieux 98015c6e62 remove useless create fct
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-13 01:21:38 +00:00
Victor Vieux e2b6f00c23 WatchCallback
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-13 01:04:16 +00:00
Victor Vieux f2ca549f46 cleaner callback
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-12 22:49:20 +00:00
Victor Vieux 005b5fe288 watch take a callback 2014-12-12 22:14:11 +00:00
Victor Vieux 1f9eac7fd1 Initialize in the interface
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 23:23:10 +00:00
Victor Vieux f95f943b4a use 1.5*heartbeat as TTL in etcd
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 22:18:54 +00:00
Victor Vieux 2282fc89ef add node type
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 21:59:01 +00:00
Victor Vieux 3d39101ff7 allow custom url on token
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 01:24:19 +00:00
Victor Vieux 0aeb1771bd add watch interface 2014-12-11 01:24:19 +00:00
Victor Vieux ef9b509d07 add file
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 01:24:19 +00:00
Victor Vieux bb7f69fd9c First step toward modular discoevery services
Signed-off-by: Victor Vieux <vieux@docker.com>
2014-12-11 01:24:19 +00:00