consul-ruby-client 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmZhMWVkY2NmYTI1ODQyZGQ5ZTY5MjJiYTYyNzJjZDVlYTFkMDFkYw==
4
+ ZjkwMjNjYTIwMzU3M2I4N2U0MDJjZjI3MmFiODg0ZmQwY2RkOWUzMQ==
5
5
  data.tar.gz: !binary |-
6
- NThlOWFmYTBhZTUzMGM3YTIwY2QwYTkyODU0MjkzMTEyYWIyNDFlYQ==
6
+ NjEyMWQ3NzdjZmNjMTViYjUyODFiYzQxOTY1MjE2MmNmZDBkNjk2MA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ZmI5ZGIzMGY1YmVlYjZlNjkyOGZlMzc5ZTJjMzM5Y2I4N2UwNDVjMWNkMTBi
10
- ZjdmZjYzMWZjMzY2Zjc2ZjE2YzQ1OTgxMGY5YjEwMjliNTEzZmQ2MTdmNzBi
11
- OWZiMTU4MDJlMTg1MjhkOWQ2ZTkxMTYwODM4MDFlMzdhNmY0OTc=
9
+ ZjViNTUzNmNmYzJlZTI0NDlmYzFiMjQwYjM2YjA5ZTJlNDZkMDI3ZWFjY2Ez
10
+ ZDAyYTBiOThmYThiNTFkZmQwOTYwOTIwOTM3MmU2NjdmOTBmM2EyZTFmYjQw
11
+ OTJjNzUwZGUwMzJjM2RmYWI3ZDhlZDE0ODZjZjU0ZDdhOGQyOTg=
12
12
  data.tar.gz: !binary |-
13
- YTAzYjhjZThiNDhmNzcwNzdkMWExYmMxMjQwMjBhMDU3OWVlMGY4YjI5ODRl
14
- ZDFmNTM5MGMzOWQ0M2JjZDg0YjlkZjI0MDY2ODAzMjJmYTlkZmE1YzBlNmZi
15
- NDViNGQyYmM0ZjM2NDg1YjA1NmI0MzQ2ZTFlZTFmMTg2ZmI4MGI=
13
+ YzIxNzQ2Njc4ZTA0YzM0MzBjMjlkMmQ0ZjdjMGU3NmUxMmUzNzlkNDJlY2Y1
14
+ ZjQwOTJlOTRkNTA5NzIwY2QwMzJkOTBhYmRjMjc1MjE4NGU4NmJjOTc3M2Q5
15
+ MWRjMzk2ZDAyN2EwZGE5ZDg5YjFmZGQ3MThmNTY5Njc5NDEwODM=
@@ -1,5 +1,5 @@
1
1
  module Consul
2
2
  module Client
3
- VERSION = '0.0.7'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
@@ -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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: consul-ruby-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Hotan