Commit Graph

141 Commits

Author SHA1 Message Date
Alexandre Beslic
814a8168ee update libkv godeps, fix zookeeper discovery list
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-07-04 18:37:13 -07:00
Alexandre Beslic
b0fe6000b7 revert to using s.heartbeat for store failover
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-06-30 17:38:51 -07:00
Alexandre Beslic
56e4dbb480 use const for failover watch time and minor comment fix in tests
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-06-30 14:04:41 -07:00
Alexandre Beslic
03a7be2919 fix issue with zookeeper and occasional SOH character return
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-06-30 14:04:05 -07:00
Alexandre Beslic
f50cd10061 migrate from pkg/store to docker/libkv
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-06-29 16:19:21 -07:00
Victor Vieux
52db3436a2 add ttl placeholder to discovery
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-06-10 17:03:48 -07:00
Andrea Luzzardi
7394be0704 Replace --addr with --advertise
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-26 17:43:14 -07:00
Andrea Luzzardi
fa2809d431 Merge pull request #841 from abronan/consul_ttl_check
Additional check for ttl < 10s and Consul
2015-05-26 15:00:22 -07:00
Victor Vieux
62e46100cb Merge pull request #851 from aluzzardi/discovery-prefix
discovery: KV Path is now an optional prefix.
2015-05-26 14:57:56 -07:00
Andrea Luzzardi
1a58a85b44 discovery: KV Path is now an optional prefix.
"consul://addr1" will store discovery entries into "docker/swarm/nodes"
"consul://addr2/foo" will store entries in "foo/docker/swarm/nodes"

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-26 14:25:23 -07:00
Alexandre Beslic
814932ccb7 Simplify check
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-26 12:32:00 -07:00
Victor Vieux
be10798096 use proper append in test
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-26 11:49:36 -07:00
Victor Vieux
41c2060ab5 use heatbeat in second, not ms
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-26 11:19:04 -07:00
Alexandre Beslic
96241c6b79 pull out the log.Fatal from pkg/store to the discovery level
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-26 11:01:17 -07:00
Victor Vieux
ad8a9724e2 Merge pull request #835 from aluzzardi/leader-election
Leader election
2015-05-26 10:11:19 -07:00
Rajdeep Dua
46390b005f Added TestCase for ContainsEntry
Signed-off-by: Rajdeep Dua <dua_rajdeep@yahoo.com>
2015-05-26 03:29:59 -07:00
Andrea Luzzardi
b4efc08dfc api: Integrate leader election.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-22 21:23:34 -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
Andrea Luzzardi
2ff9679938 store: CreateStore -> NewStore
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-19 20:13:29 -07:00
Alexandre Beslic
b8d72c291d Cleanup, fix Integration tests and use of a single global Session in Consul
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 15:27:39 -07:00
Alexandre Beslic
ec478d8ed5 Add integration tests for engines departure with node removal and ephemeral behavior
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 12:08:56 -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
Alexandre Beslic
4408a9cc8c Add Ephemeral for Consul, Zookeeper and Etcd (Etcd abd Consul are using TTLs in the background)
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-19 10:25:31 -07:00
Andrea Luzzardi
08dc3c7c7b discovery: Add the Entries.Diff helper.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:54:51 -07:00
Andrea Luzzardi
0c9e8c8803 discovery: Added kv tests using the mock Store.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-18 13:38:15 -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
9399a8835c golint fixes.
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
c77f7332a0 store: Fixes to etcd and zk WatchTree
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-15 13:37:51 -07:00
Andrea Luzzardi
7d7e4aee13 store: Watch: Use channels instead of callbacks.
This gets rid of `CancelWatch*` functions and its usage is much simpler.

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-15 13:37:51 -07:00
Andrea Luzzardi
0f61855877 store: Get rid of "discovery" log messages
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 22:35:14 -07:00
Andrea Luzzardi
a897fa04d5 store: Watch/WatchTree: Removed unused params
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 22:25:26 -07:00
Andrea Luzzardi
f87505e2e7 store: KVEntry -> KVPair
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 22:00:27 -07:00
Andrea Luzzardi
895484ec2a store: WatchRange -> WatchTree
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 21:58:02 -07:00
Andrea Luzzardi
6f41eabdae store: GetRange -> List
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 21:58:02 -07:00
Andrea Luzzardi
d4bdb10d35 store: Make KVEntry a struct rather than an interface.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 21:58:02 -07:00
Andrea Luzzardi
747a83a40a store: Cleanup initializers.
- KV is now Backend
- name (string) is now backend (Backend)
- initializers are now a static var rather than generated by init()

Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-14 21:32:10 -07:00
Kelsey Hightower
0d87489773 discovery: improve code comments.
Signed-off-by: Kelsey Hightower <kelsey.hightower@gmail.com>
2015-05-14 08:49:40 -07:00
Andrea Luzzardi
9d055d6bf8 pkg/store: Pass Options as pointer, not value.
Signed-off-by: Andrea Luzzardi <aluzzardi@gmail.com>
2015-05-13 19:00:39 -07:00
Victor Vieux
0b45fa5154 user varargs in store the watch callback
Signed-off-by: Victor Vieux <victorvieux@gmail.com>
2015-05-13 15:42:44 -07:00
Madhu Venugopal
0130c2262d GetRange and WatchRange to return {key,value,index} tuple
Signed-off-by: Madhu Venugopal <madhu@docker.com>
2015-05-13 11:24:03 -07:00
Alexandre Beslic
06f51e09b0 revert variable names
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-12 14:47:48 -07:00
Alexandre Beslic
403f95f86c Remove placeholder TLS parameter in discovery interface and New method
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-12 14:19:30 -07:00
Alexandre Beslic
6f67ca3a58 replace variadic method options for simple Config struct, correct Consul Watch method
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-12 14:00:55 -07:00
Alexandre Beslic
e039563c78 Fix zookeeper timeout value
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-11 18:23:40 -07:00
Alexandre Beslic
59e1e9b942 Change existing discovery backends to 'kv' using metatada storage backends in the store package
Signed-off-by: Alexandre Beslic <abronan@docker.com>
2015-05-11 17:23:55 -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