influxdb 0.5.0 → 0.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/CHANGELOG.md +3 -1
- data/lib/influxdb/query/retention_policy.rb +18 -4
- data/lib/influxdb/version.rb +1 -1
- data/spec/influxdb/cases/query_retention_policy_spec.rb +32 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3dbf2a3bd000d956cd08c67f935e5e9b80b7d03
|
4
|
+
data.tar.gz: 140163253ece45b18b0a1d4a371a9c7062c70285
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d769deb45adc98a3ab185606b309f887c82e160ef0c58a0090d00892b9dfdce4dbeff7c7965e31c86d45d5122f87bdc23eb7c637abc56e03763f1a6013747fe
|
7
|
+
data.tar.gz: a4f6ffa3cb9371424696df45d3a9657b67c7b226e7b585f52334cc415fa792f6f41c52700d59f80afdcfdabca06cf2f9d76264f6947c7f512cdb65887778c28d
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -4,7 +4,9 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
|
|
4
4
|
|
5
5
|
## Unreleased changes
|
6
6
|
|
7
|
-
|
7
|
+
## v0.5.1, released 2017-10-31
|
8
|
+
|
9
|
+
- Add support for `SHARD DURATION` in retention policy (#203, @ljagiello)
|
8
10
|
|
9
11
|
## v0.5.0, released 2017-10-21
|
10
12
|
|
@@ -1,10 +1,17 @@
|
|
1
1
|
module InfluxDB
|
2
2
|
module Query
|
3
3
|
module RetentionPolicy # :nodoc:
|
4
|
-
def create_retention_policy(name,
|
4
|
+
def create_retention_policy(name,
|
5
|
+
database,
|
6
|
+
duration,
|
7
|
+
replication,
|
8
|
+
default = false,
|
9
|
+
shard_duration: nil)
|
5
10
|
execute(
|
6
11
|
"CREATE RETENTION POLICY \"#{name}\" ON #{database} " \
|
7
|
-
"DURATION #{duration} REPLICATION #{replication}
|
12
|
+
"DURATION #{duration} REPLICATION #{replication}" \
|
13
|
+
"#{shard_duration ? " SHARD DURATION #{shard_duration}" : ''}" \
|
14
|
+
"#{default ? ' DEFAULT' : ''}"
|
8
15
|
)
|
9
16
|
end
|
10
17
|
|
@@ -23,10 +30,17 @@ module InfluxDB
|
|
23
30
|
execute("DROP RETENTION POLICY \"#{name}\" ON #{database}")
|
24
31
|
end
|
25
32
|
|
26
|
-
def alter_retention_policy(name,
|
33
|
+
def alter_retention_policy(name,
|
34
|
+
database,
|
35
|
+
duration,
|
36
|
+
replication,
|
37
|
+
default = false,
|
38
|
+
shard_duration: nil)
|
27
39
|
execute(
|
28
40
|
"ALTER RETENTION POLICY \"#{name}\" ON #{database} " \
|
29
|
-
"DURATION #{duration} REPLICATION #{replication}
|
41
|
+
"DURATION #{duration} REPLICATION #{replication}" \
|
42
|
+
"#{shard_duration ? " SHARD DURATION #{shard_duration}" : ''}" \
|
43
|
+
"#{default ? ' DEFAULT' : ''}"
|
30
44
|
)
|
31
45
|
end
|
32
46
|
end
|
data/lib/influxdb/version.rb
CHANGED
@@ -51,6 +51,22 @@ describe InfluxDB::Client do
|
|
51
51
|
expect(subject.create_retention_policy('1h.cpu', 'foo', '1h', 2)).to be_a(Net::HTTPOK)
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
context "default_with_shard_duration" do
|
56
|
+
let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
|
57
|
+
|
58
|
+
it "should GET to create a new database" do
|
59
|
+
expect(subject.create_retention_policy('1h.cpu', 'foo', '48h', 2, true, shard_duration: '1h')).to be_a(Net::HTTPOK)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context "non-default_with_shard_duration" do
|
64
|
+
let(:query) { "CREATE RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
|
65
|
+
|
66
|
+
it "should GET to create a new database" do
|
67
|
+
expect(subject.create_retention_policy('1h.cpu', 'foo', '48h', 2, shard_duration: '1h')).to be_a(Net::HTTPOK)
|
68
|
+
end
|
69
|
+
end
|
54
70
|
end
|
55
71
|
|
56
72
|
describe "#delete_retention_policy" do
|
@@ -77,5 +93,21 @@ describe InfluxDB::Client do
|
|
77
93
|
expect(subject.alter_retention_policy('1h.cpu', 'foo', '1h', 2)).to be_a(Net::HTTPOK)
|
78
94
|
end
|
79
95
|
end
|
96
|
+
|
97
|
+
context "default_with_shard_duration" do
|
98
|
+
let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h DEFAULT" }
|
99
|
+
|
100
|
+
it "should GET to alter a new database" do
|
101
|
+
expect(subject.alter_retention_policy('1h.cpu', 'foo', '48h', 2, true, shard_duration: '1h')).to be_a(Net::HTTPOK)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
context "non-default_with_shard_duration" do
|
106
|
+
let(:query) { "ALTER RETENTION POLICY \"1h.cpu\" ON foo DURATION 48h REPLICATION 2 SHARD DURATION 1h" }
|
107
|
+
|
108
|
+
it "should GET to alter a new database" do
|
109
|
+
expect(subject.alter_retention_policy('1h.cpu', 'foo', '48h', 2, shard_duration: '1h')).to be_a(Net::HTTPOK)
|
110
|
+
end
|
111
|
+
end
|
80
112
|
end
|
81
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|