consul-ruby-client 0.0.7 → 0.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/lib/consul/client/version.rb +1 -1
- data/lib/consul/extensions/uid.rb +5 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjkwMjNjYTIwMzU3M2I4N2U0MDJjZjI3MmFiODg0ZmQwY2RkOWUzMQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NjEyMWQ3NzdjZmNjMTViYjUyODFiYzQxOTY1MjE2MmNmZDBkNjk2MA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZjViNTUzNmNmYzJlZTI0NDlmYzFiMjQwYjM2YjA5ZTJlNDZkMDI3ZWFjY2Ez
|
10
|
+
ZDAyYTBiOThmYThiNTFkZmQwOTYwOTIwOTM3MmU2NjdmOTBmM2EyZTFmYjQw
|
11
|
+
OTJjNzUwZGUwMzJjM2RmYWI3ZDhlZDE0ODZjZjU0ZDdhOGQyOTg=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YzIxNzQ2Njc4ZTA0YzM0MzBjMjlkMmQ0ZjdjMGU3NmUxMmUzNzlkNDJlY2Y1
|
14
|
+
ZjQwOTJlOTRkNTA5NzIwY2QwMzJkOTBhYmRjMjc1MjE4NGU4NmJjOTc3M2Q5
|
15
|
+
MWRjMzk2ZDAyN2EwZGE5ZDg5YjFmZGQ3MThmNTY5Njc5NDEwODM=
|
@@ -53,17 +53,17 @@ module Consul
|
|
53
53
|
|
54
54
|
# Public: Generate a global unique id synchronously with other
|
55
55
|
def get
|
56
|
-
# TODO Generation implementation
|
57
|
-
# Create a Consul Session the the underlying namespace
|
58
|
-
cur_session = session.create(Session.for_name(namespace))
|
59
|
-
raise 'Unable to create session to generate UID.' if cur_session.nil?
|
60
|
-
|
61
56
|
# Check if there is already an UID associated with this client_id.
|
62
57
|
existing_uid = key_value_store.get(client_uid_path)
|
63
58
|
unless existing_uid.nil? or (existing_uid.respond_to?(:empty?) and existing_uid.empty?)
|
64
59
|
return existing_uid[0].value.to_i
|
65
60
|
end
|
66
61
|
|
62
|
+
# No existing UID so we need to provision our own.
|
63
|
+
# Create a Consul Session the the underlying namespace
|
64
|
+
cur_session = session.create(Session.for_name(namespace))
|
65
|
+
raise 'Unable to create session to generate UID.' if cur_session.nil?
|
66
|
+
|
67
67
|
# No existing UID so let provision one for this node.
|
68
68
|
for i in 1..MAX_ATTEMPTS
|
69
69
|
session.renew cur_session # Renew the current session so we can obtain a lock
|