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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 170699d0f9146ed26b14a22529a83d4be2df7978
4
- data.tar.gz: 1ec1e335f75c706b36e1f6a65ac5828d4fdf5f19
3
+ metadata.gz: b3dbf2a3bd000d956cd08c67f935e5e9b80b7d03
4
+ data.tar.gz: 140163253ece45b18b0a1d4a371a9c7062c70285
5
5
  SHA512:
6
- metadata.gz: d58bfb635ef085fc5e395f83539f0076ba68d77b919fba914c0000abe7c88447513b13f5298a213c5d32af20e0afb78ffa98a936f26bff8cc5d9d5fd89a4e99c
7
- data.tar.gz: b560584b6c9722b4d5729715cdaa3b87a0485296d787383847b18be0b7b5761417e746cfb7f8fb223fa6722e3735fca2ab2ec1d776611db8a050bf48886b85aa
6
+ metadata.gz: 3d769deb45adc98a3ab185606b309f887c82e160ef0c58a0090d00892b9dfdce4dbeff7c7965e31c86d45d5122f87bdc23eb7c637abc56e03763f1a6013747fe
7
+ data.tar.gz: a4f6ffa3cb9371424696df45d3a9657b67c7b226e7b585f52334cc415fa792f6f41c52700d59f80afdcfdabca06cf2f9d76264f6947c7f512cdb65887778c28d
@@ -40,6 +40,9 @@ Metrics/ModuleLength:
40
40
  CountComments: false # count full line comments?
41
41
  Max: 120
42
42
 
43
+ Metrics/ParameterLists:
44
+ Max: 6
45
+
43
46
  Style/TrailingCommaInLiteral:
44
47
  EnforcedStyleForMultiline: comma
45
48
  Exclude:
@@ -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
- - None yet.
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, database, duration, replication, default = false)
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}#{default ? ' DEFAULT' : ''}"
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, database, duration, replication, default = false)
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}#{default ? ' DEFAULT' : ''}"
41
+ "DURATION #{duration} REPLICATION #{replication}" \
42
+ "#{shard_duration ? " SHARD DURATION #{shard_duration}" : ''}" \
43
+ "#{default ? ' DEFAULT' : ''}"
30
44
  )
31
45
  end
32
46
  end
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.5.0".freeze
2
+ VERSION = "0.5.1".freeze
3
3
  end
@@ -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.0
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-21 00:00:00.000000000 Z
11
+ date: 2017-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler