consul-client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/consul-client.gemspec +1 -1
- data/lib/consul/client.rb +1 -1
- data/lib/consul/client/http.rb +1 -1
- data/lib/consul/client/local_service.rb +2 -2
- data/lib/consul/client/service.rb +3 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e6ef0af86e0e5beeb6d9e18927c6a9ca8dfd9f7
|
4
|
+
data.tar.gz: 74d5718e0bddd2d18a4db0897eb22c6db92790d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 60032387daf1ec10aa55e1e968075daa651caf230bf4507097a47bd5bb12f97d1f14bfd221ce51c9148cef62714817c49ce2657cc97c7d12853c4251899e90ea
|
7
|
+
data.tar.gz: 44f794044862c1112c954c22b8d25704ac714cbae00f732b3e1747ad73993074e07023787d6f87c867b2b55b6e7c7f5716975d9b95ef81151b5e5e4fb00eda4c
|
data/consul-client.gemspec
CHANGED
data/lib/consul/client.rb
CHANGED
@@ -31,7 +31,7 @@ module Consul
|
|
31
31
|
# @example
|
32
32
|
# local = Consul::Client.v1.local_service('web')
|
33
33
|
# local.coordinated_shutdown! { $healthy = false }
|
34
|
-
def local_service(name, http:
|
34
|
+
def local_service(name, http:Consul::Client.v1.http(), logger:http.logger)
|
35
35
|
LocalService.new(name, http: http, logger: logger)
|
36
36
|
end
|
37
37
|
|
data/lib/consul/client/http.rb
CHANGED
@@ -9,8 +9,8 @@ module Consul
|
|
9
9
|
# @api private
|
10
10
|
def initialize(name, http:, logger:)
|
11
11
|
@name = name
|
12
|
-
@consul =
|
13
|
-
consul.logger = logger
|
12
|
+
@consul = http
|
13
|
+
@consul.logger = logger
|
14
14
|
end
|
15
15
|
|
16
16
|
# Coordinate the shutdown of this node with the rest of the cluster so
|
@@ -6,7 +6,7 @@ module Consul
|
|
6
6
|
# @see Consul::Client::V1#service
|
7
7
|
class Service
|
8
8
|
# @api private
|
9
|
-
def initialize(name, consul: Consul::Client.v1)
|
9
|
+
def initialize(name, consul: Consul::Client.v1.http)
|
10
10
|
@name = name
|
11
11
|
@consul = consul
|
12
12
|
end
|
@@ -20,10 +20,10 @@ module Consul
|
|
20
20
|
# so make sure it does not conflict with other names. For
|
21
21
|
# instance, the leader lock for the +web+ service would be
|
22
22
|
# stored at +/kv/web/leader+.
|
23
|
-
def lock(key, &block)
|
23
|
+
def lock(key, checks: ["service:#{name}"], &block)
|
24
24
|
session = consul.put("/session/create",
|
25
25
|
LockDelay: '3s',
|
26
|
-
Checks: ["
|
26
|
+
Checks: ["serfHealth"] + checks
|
27
27
|
)["ID"]
|
28
28
|
loop do
|
29
29
|
locked = consul.put("/kv/#{name}/#{key}?acquire=#{session}")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: consul-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Xavier Shay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-07-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby client library for Consul HTTP API.
|
14
14
|
email:
|
@@ -43,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
43
43
|
version: '0'
|
44
44
|
requirements: []
|
45
45
|
rubyforge_project:
|
46
|
-
rubygems_version: 2.
|
46
|
+
rubygems_version: 2.4.5
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
49
|
summary: Ruby client library for Consul HTTP API, providing both a thin wrapper around
|