etcdv3 0.3.0 → 0.3.1
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 +4 -4
- data/README.md +4 -4
- data/lib/etcdv3/version.rb +1 -1
- data/lib/etcdv3.rb +6 -1
- data/spec/etcdv3_spec.rb +16 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 79843ce217e4f7209283fe46c64022d31e491586
|
4
|
+
data.tar.gz: 48d9410cc3f1e104b30807476156d65ee09c610b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c3f62df6f498ae227744f16eccd24de9939a6e4604dbcbb800b9befabdb45110ca6ae37777bafeb93e09237d29082a6f38a029f6b74e7b525b14bbc58919195
|
7
|
+
data.tar.gz: 1098a189e5b130f365090c1eea96869e2f735c77f6129f821c101077036fe95ce4e25d6f627bf5857ca28efad66a0288e62dcf79d812b79d8a8bbd45eb5ff42d
|
data/README.md
CHANGED
@@ -20,13 +20,13 @@ gem install etcdv3
|
|
20
20
|
require 'etcdv3'
|
21
21
|
|
22
22
|
# Insecure connection
|
23
|
-
conn =
|
23
|
+
conn = Etcdv3.new(url: 'http://127.0.0.1:2379')
|
24
24
|
|
25
25
|
# Secure connection using default certificates
|
26
|
-
conn =
|
26
|
+
conn = Etcdv3.new(url: 'https://hostname:port')
|
27
27
|
|
28
28
|
# Secure connection with Auth
|
29
|
-
conn =
|
29
|
+
conn = Etcdv3.new(url: 'https://hostname:port', user: "gary", password: "secret")
|
30
30
|
|
31
31
|
# Secure connection specifying own certificates
|
32
32
|
# Coming soon...
|
@@ -104,7 +104,7 @@ conn.disable_auth
|
|
104
104
|
conn.grant_lease(100)
|
105
105
|
|
106
106
|
# Attach key to lease
|
107
|
-
conn.put("testkey", "testvalue",
|
107
|
+
conn.put("testkey", "testvalue", lease_id: 1234566789)
|
108
108
|
|
109
109
|
# Get information about lease and its attached keys
|
110
110
|
conn.lease_ttl(1234566789)
|
data/lib/etcdv3/version.rb
CHANGED
data/lib/etcdv3.rb
CHANGED
@@ -97,7 +97,12 @@ class Etcdv3
|
|
97
97
|
request.handle(:kv, 'get', [key, opts])
|
98
98
|
end
|
99
99
|
|
100
|
-
#
|
100
|
+
# Deletes a specified key
|
101
|
+
def del(key, range_end: '')
|
102
|
+
request.handle(:kv, 'del', [key, range_end])
|
103
|
+
end
|
104
|
+
|
105
|
+
# Grant a lease with a specified TTL
|
101
106
|
def grant_lease(ttl)
|
102
107
|
request.handle(:lease, 'grant_lease', [ttl])
|
103
108
|
end
|
data/spec/etcdv3_spec.rb
CHANGED
@@ -77,6 +77,22 @@ describe Etcdv3 do
|
|
77
77
|
it { is_expected.to_not be_nil }
|
78
78
|
end
|
79
79
|
|
80
|
+
describe '#del' do
|
81
|
+
context 'no range' do
|
82
|
+
before { conn.put('test', 'value') }
|
83
|
+
subject { conn.del('test') }
|
84
|
+
it { is_expected.to_not be_nil }
|
85
|
+
end
|
86
|
+
context 'ranged del' do
|
87
|
+
before do
|
88
|
+
conn.put('test', 'value')
|
89
|
+
conn.put('testt', 'value')
|
90
|
+
end
|
91
|
+
subject { conn.del('test', range_end: 'testtt') }
|
92
|
+
it { is_expected.to_not be_nil }
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
80
96
|
describe '#grant_lease' do
|
81
97
|
subject { conn.grant_lease(2) }
|
82
98
|
it { is_expected.to_not be_nil }
|