etcd 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/README.md +2 -2
- data/Rakefile +1 -1
- data/lib/etcd/client.rb +0 -4
- data/lib/etcd/keys.rb +1 -0
- data/lib/etcd/mod/leader.rb +1 -1
- data/lib/etcd/version.rb +1 -1
- data/spec/etcd/keys_spec.rb +5 -4
- data/spec/etcd/leader_spec.rb +2 -0
- data/spec/etcd/lock_spec.rb +2 -1
- data/spec/etcd/watch_spec.rb +15 -0
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
NTM0MzMyY2RlZWFlYjAxYTc2OGU3Mjk5YmEwOTlmYmJkN2NiZTJlNg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 608958d15011133cdba9f60d48ed79e880e0de67
|
4
|
+
data.tar.gz: 2c4ad5c83169f006a7fdd04ca4817d8ebedd8c52
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MDcwY2QyNzA1MDEwN2IwZmMwMThlN2MxNTNmOGRiNDIyNTU5ZjcyY2I2NWQ5
|
11
|
-
ODI5MWU2ZDVjZjQxMDFhNTkyY2QzMWExMDYwNjBmNDk1OTJhYmE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
YmM3ZWU4NDUzOWQwY2U2MzM0ZWI2YTM2MDMxOTJhOGE2OTJmNzUyNGM3Mzgw
|
14
|
-
OWViNGFmNDc3MjA5MWFkODQxYWI5YTQyMzlhMmFmM2RhYTIwOGI5NTI5NzI4
|
15
|
-
NDMzNjBmNmIwM2VlM2FlNWY4YjViOGY4MmRiZTI3NGYyODQ3MDI=
|
6
|
+
metadata.gz: 119aca839b983863c895be6b7ab86f73b4301a8ad816b104652b0e3a1d10f9c5c0ebb49a315b858e8cfa5be7c07fc79523a3bfd02157d67052145d0409b6a39b
|
7
|
+
data.tar.gz: d1e5bd3393d11a19eb647db761571c55597b8884f3e1eb393dd9536727da340a28a6e87b4d7c1b49af3a2711518a7878ec7ffd900c65afd3e57d3f3d14e7b259
|
data/README.md
CHANGED
@@ -27,9 +27,9 @@ client = Etcd.client(host: '127.0.0.1', port: 4003, allow_redirect: false) # won
|
|
27
27
|
```
|
28
28
|
### Set a key
|
29
29
|
```ruby
|
30
|
-
client.set('/nodes/n1', 1)
|
30
|
+
client.set('/nodes/n1', value: 1)
|
31
31
|
# with ttl
|
32
|
-
client.set('/nodes/n2', 2, 4) # sets the ttl to 4 seconds
|
32
|
+
client.set('/nodes/n2', value: 2, ttl: 4) # sets the ttl to 4 seconds
|
33
33
|
```
|
34
34
|
### Get a key
|
35
35
|
```ruby
|
data/Rakefile
CHANGED
data/lib/etcd/client.rb
CHANGED
@@ -8,8 +8,6 @@ require 'etcd/log'
|
|
8
8
|
require 'etcd/stats'
|
9
9
|
require 'etcd/keys'
|
10
10
|
require 'etcd/exceptions'
|
11
|
-
require 'etcd/mod/lock'
|
12
|
-
require 'etcd/mod/leader'
|
13
11
|
|
14
12
|
module Etcd
|
15
13
|
##
|
@@ -27,8 +25,6 @@ module Etcd
|
|
27
25
|
|
28
26
|
include Stats
|
29
27
|
include Keys
|
30
|
-
include Mod::Lock
|
31
|
-
include Mod::Leader
|
32
28
|
|
33
29
|
Config = Struct.new(:use_ssl, :verify_mode, :read_timeout, :ssl_key, :ca_file,
|
34
30
|
:user_name, :password, :allow_redirect, :ssl_cert)
|
data/lib/etcd/keys.rb
CHANGED
@@ -76,6 +76,7 @@ module Etcd
|
|
76
76
|
index = opts[:waitIndex] || opts[:index]
|
77
77
|
params[:waitIndex] = index unless index.nil?
|
78
78
|
params[:consistent] = opts[:consistent] if opts.key?(:consistent)
|
79
|
+
params[:recursive] = opts[:recursive] if opts.key?(:recursive)
|
79
80
|
|
80
81
|
response = api_execute(key_endpoint + key, :get,
|
81
82
|
timeout: timeout, params: params)
|
data/lib/etcd/mod/leader.rb
CHANGED
data/lib/etcd/version.rb
CHANGED
data/spec/etcd/keys_spec.rb
CHANGED
@@ -15,10 +15,10 @@ describe Etcd::Keys do
|
|
15
15
|
it 'should be true for existing keys' do
|
16
16
|
key = random_key
|
17
17
|
client.create(key, value: 10)
|
18
|
-
expect(client.exists?(key)).to
|
18
|
+
expect(client.exists?(key)).to be(true)
|
19
19
|
end
|
20
20
|
it 'should be true for existing keys' do
|
21
|
-
expect(client.exists?(random_key)).to
|
21
|
+
expect(client.exists?(random_key)).to be(false)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -26,13 +26,14 @@ describe Etcd::Keys do
|
|
26
26
|
it 'should be able to create a directory' do
|
27
27
|
d = random_key
|
28
28
|
client.create(d, dir: true)
|
29
|
-
expect(client.get(d)).to
|
29
|
+
expect(client.get(d)).to be_directory
|
30
30
|
end
|
31
31
|
context 'empty' do
|
32
32
|
it 'should be able to delete with dir flag' do
|
33
33
|
d = random_key
|
34
34
|
client.create(d, dir: true)
|
35
|
-
|
35
|
+
client.delete(d, dir: true)
|
36
|
+
expect(client.exist?(d)).to be(false)
|
36
37
|
end
|
37
38
|
|
38
39
|
it 'should not be able to delete without dir flag' do
|
data/spec/etcd/leader_spec.rb
CHANGED
data/spec/etcd/lock_spec.rb
CHANGED
data/spec/etcd/watch_spec.rb
CHANGED
@@ -40,4 +40,19 @@ describe 'Etcd watch' do
|
|
40
40
|
thr.join
|
41
41
|
expect(response.node.value).to eq(value)
|
42
42
|
end
|
43
|
+
|
44
|
+
|
45
|
+
it 'with recrusive, waits and return when the key is updated' do
|
46
|
+
response = nil
|
47
|
+
key = random_key
|
48
|
+
value = uuid.generate
|
49
|
+
client.set("#{key}/subkey", value:"initial_value")
|
50
|
+
thr = Thread.new do
|
51
|
+
response = client.watch(key, recursive:true, timeout:3)
|
52
|
+
end
|
53
|
+
sleep 2
|
54
|
+
client.set("#{key}/subkey", value: value)
|
55
|
+
thr.join
|
56
|
+
expect(response.node.value).to eq(value)
|
57
|
+
end
|
43
58
|
end
|
metadata
CHANGED
@@ -1,83 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: etcd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ranjib Dey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-08-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mixlib-log
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: uuid
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: Ruby client library for etcd
|
@@ -87,11 +87,11 @@ executables: []
|
|
87
87
|
extensions: []
|
88
88
|
extra_rdoc_files: []
|
89
89
|
files:
|
90
|
-
- .coco.yml
|
91
|
-
- .gitignore
|
92
|
-
- .rspec
|
93
|
-
- .rubocop.yml
|
94
|
-
- .travis.yml
|
90
|
+
- ".coco.yml"
|
91
|
+
- ".gitignore"
|
92
|
+
- ".rspec"
|
93
|
+
- ".rubocop.yml"
|
94
|
+
- ".travis.yml"
|
95
95
|
- Gemfile
|
96
96
|
- Guardfile
|
97
97
|
- LICENSE.txt
|
@@ -137,17 +137,17 @@ require_paths:
|
|
137
137
|
- lib
|
138
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
139
139
|
requirements:
|
140
|
-
- -
|
140
|
+
- - ">="
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: '0'
|
143
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - ">="
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
requirements: []
|
149
149
|
rubyforge_project:
|
150
|
-
rubygems_version: 2.
|
150
|
+
rubygems_version: 2.2.2
|
151
151
|
signing_key:
|
152
152
|
specification_version: 4
|
153
153
|
summary: Ruby client library for etcd
|