data_store 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -2
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/data_store.gemspec +1 -1
- data/db/data_store.db +0 -0
- data/lib/data_store/base.rb +9 -4
- data/lib/data_store/configuration.rb +5 -3
- data/lib/data_store/version.rb +1 -1
- data/test/average_calculator_test.rb +2 -2
- data/test/configuration_test.rb +1 -1
- data/test/data_store_test.rb +2 -2
- data/test/integration_test.rb +2 -2
- data/test/table_test.rb +3 -3
- data/test/test_helper.rb +1 -1
- metadata +13 -21
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0bc549a10d7a06c7a3d644b3558c1d9389621f8d
|
4
|
+
data.tar.gz: a6450c7d17d1e9350ed4f998fb17f04d67a40e9c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 80a97d74d1899e36100cbaead1916b154c8cc08a27650d6459d5821bf3720122d6d22c43705937de51953791af3b81192997bd98bb04f32e834a27fac9818dd6
|
7
|
+
data.tar.gz: bba43210532999187df99db2e6945f8d4580556c6789b992cd56e8391af43b2c8001258b6401c45aa4f9578c36eec2f8b91c68a831eaf425abd04991c631622c
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
data_store
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.0.0-p247
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -43,7 +43,7 @@ For JRuby on of the following:
|
|
43
43
|
DataStore.configure do |config|
|
44
44
|
config.prefix = 'ds_'
|
45
45
|
config.database = :mysql
|
46
|
-
config.compression_schema = [6,5,3]
|
46
|
+
config.compression_schema = '[6,5,3]'
|
47
47
|
config.data_type = :double
|
48
48
|
config.frequency = 10
|
49
49
|
config.maximum_datapoints = 800
|
data/data_store.gemspec
CHANGED
data/db/data_store.db
CHANGED
Binary file
|
data/lib/data_store/base.rb
CHANGED
@@ -22,11 +22,16 @@ module DataStore
|
|
22
22
|
end
|
23
23
|
|
24
24
|
# Convert serialized compression schema as a string back into the array object itself.
|
25
|
-
# For example: "
|
26
|
-
|
25
|
+
# For example: "(5,4,3)" => [5,4,3]
|
26
|
+
def compression_schema
|
27
27
|
value = self.values[:compression_schema]
|
28
|
-
|
29
|
-
|
28
|
+
if value.nil?
|
29
|
+
value = []
|
30
|
+
else
|
31
|
+
value = value.gsub(/\[|\]|\(|\)/,'').split(',').map(&:to_i) unless value.is_a?(Array)
|
32
|
+
end
|
33
|
+
value
|
34
|
+
end
|
30
35
|
|
31
36
|
def table_names
|
32
37
|
names = [table_name]
|
@@ -9,8 +9,10 @@ module DataStore
|
|
9
9
|
# The database used for storing the data.
|
10
10
|
attr_accessor :database
|
11
11
|
|
12
|
-
# The schema
|
13
|
-
#
|
12
|
+
# The compression schema defines the compression of the data, i.e how the averages of the datapoints are calculated.
|
13
|
+
# Default: '[6,5,3,4,4,3]'
|
14
|
+
# With the default settings: from every 6 datapoints an average value is calculated. From those calculated average values
|
15
|
+
# from every five values a new average value is created (The compression is now 6 * 5 = 30).
|
14
16
|
attr_accessor :compression_schema
|
15
17
|
|
16
18
|
# The frequency tells how often data entry is done.
|
@@ -50,7 +52,7 @@ module DataStore
|
|
50
52
|
def initialize
|
51
53
|
@prefix = 'ds_'
|
52
54
|
@database = :postgres
|
53
|
-
@compression_schema = [6,5,3,4,4,3]
|
55
|
+
@compression_schema = '[6,5,3,4,4,3]'
|
54
56
|
@frequency = 10
|
55
57
|
@maximum_datapoints = 800
|
56
58
|
@data_type = :double
|
data/lib/data_store/version.rb
CHANGED
@@ -15,7 +15,7 @@ class AverageCalculatorTest < Test::Unit::TestCase
|
|
15
15
|
name: 'Electra',
|
16
16
|
frequency: 10,
|
17
17
|
description: 'Actual usage of electra in the home',
|
18
|
-
compression_schema: [2,2,2])
|
18
|
+
compression_schema: '[2,2,2]')
|
19
19
|
|
20
20
|
@table = DataStore::Table.new(1)
|
21
21
|
@calculator = DataStore::AverageCalculator.new(@table)
|
@@ -141,7 +141,7 @@ class AverageCalculatorTest < Test::Unit::TestCase
|
|
141
141
|
name: 'Electra',
|
142
142
|
frequency: 10,
|
143
143
|
description: 'Actual usage of gas in the home',
|
144
|
-
compression_schema: [2])
|
144
|
+
compression_schema: '[2]')
|
145
145
|
|
146
146
|
@table = DataStore::Table.new(1)
|
147
147
|
@calculator = DataStore::AverageCalculator.new(@table)
|
data/test/configuration_test.rb
CHANGED
@@ -7,7 +7,7 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
7
7
|
should "provide default values" do
|
8
8
|
assert_config_default :prefix, 'ds_'
|
9
9
|
assert_config_default :database, :postgres
|
10
|
-
assert_config_default :compression_schema, [6,5,3,4,4,3]
|
10
|
+
assert_config_default :compression_schema, '[6,5,3,4,4,3]'
|
11
11
|
assert_config_default :frequency, 10
|
12
12
|
assert_config_default :frequency_tolerance, 0.05
|
13
13
|
assert_config_default :maximum_datapoints, 800
|
data/test/data_store_test.rb
CHANGED
@@ -27,7 +27,7 @@ class DataStoreTest < Test::Unit::TestCase
|
|
27
27
|
type: 'gauge',
|
28
28
|
name: 'Electra',
|
29
29
|
description: 'Actual usage of electra in the home',
|
30
|
-
compression_schema: [5,4,3])
|
30
|
+
compression_schema: '[5,4,3]')
|
31
31
|
end
|
32
32
|
|
33
33
|
should 'be valid' do
|
@@ -56,7 +56,7 @@ class DataStoreTest < Test::Unit::TestCase
|
|
56
56
|
frequency: 5,
|
57
57
|
maximum_datapoints: 10,
|
58
58
|
description: 'Gas usage',
|
59
|
-
compression_schema: [2,4])
|
59
|
+
compression_schema: '[2,4]')
|
60
60
|
assert_equal [50, 100, 400], record.time_borders
|
61
61
|
end
|
62
62
|
|
data/test/integration_test.rb
CHANGED
@@ -11,7 +11,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
11
11
|
name: 'Electra',
|
12
12
|
frequency: 10,
|
13
13
|
description: 'Actual usage of gas in the home',
|
14
|
-
compression_schema: [2,2])
|
14
|
+
compression_schema: '[2,2]')
|
15
15
|
|
16
16
|
@table = DataStore::Table.new(1)
|
17
17
|
@calculator = DataStore::AverageCalculator.new(@table)
|
@@ -47,7 +47,7 @@ class IntegrationTest < Test::Unit::TestCase
|
|
47
47
|
type: 'gauge',
|
48
48
|
name: 'Electra',
|
49
49
|
description: 'Actual usage of electra in the home',
|
50
|
-
compression_schema: [2,3])
|
50
|
+
compression_schema: '[2,3]')
|
51
51
|
@table = DataStore::Table.new(1)
|
52
52
|
end
|
53
53
|
|
data/test/table_test.rb
CHANGED
@@ -10,7 +10,7 @@ class TableTest < Test::Unit::TestCase
|
|
10
10
|
type: 'gauge',
|
11
11
|
name: 'Electra',
|
12
12
|
description: 'Actual usage of electra in the home',
|
13
|
-
compression_schema: [5,6,10])
|
13
|
+
compression_schema: '[5,6,10]')
|
14
14
|
@table = DataStore::Table.new(1)
|
15
15
|
end
|
16
16
|
|
@@ -117,7 +117,7 @@ class TableTest < Test::Unit::TestCase
|
|
117
117
|
type: 'gauge',
|
118
118
|
name: 'Electra',
|
119
119
|
description: 'Actual usage of electra in the home',
|
120
|
-
compression_schema: [5,6,10])
|
120
|
+
compression_schema: '[5,6,10]')
|
121
121
|
|
122
122
|
@table = DataStore::Table.new(1, 1)
|
123
123
|
@table.stubs(:calculate_average_values)
|
@@ -142,7 +142,7 @@ class TableTest < Test::Unit::TestCase
|
|
142
142
|
type: 'counter',
|
143
143
|
name: 'Gas',
|
144
144
|
description: 'Actual usage of natural gas',
|
145
|
-
compression_schema: [])
|
145
|
+
compression_schema: '[]')
|
146
146
|
@table = DataStore::Table.new(2)
|
147
147
|
end
|
148
148
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,32 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.2.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Frank Oxener
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-11-04 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: sequel
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: 4.4.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '='
|
28
25
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
26
|
+
version: 4.4.0
|
30
27
|
description: DataStore is designed to store real time data but still manage the growth
|
31
28
|
of your dataset and still keeping historical data
|
32
29
|
email:
|
@@ -36,6 +33,8 @@ extensions: []
|
|
36
33
|
extra_rdoc_files: []
|
37
34
|
files:
|
38
35
|
- .gitignore
|
36
|
+
- .ruby-gemset
|
37
|
+
- .ruby-version
|
39
38
|
- .rvmrc
|
40
39
|
- .travis.yml
|
41
40
|
- CHANGELOG.md
|
@@ -67,33 +66,26 @@ files:
|
|
67
66
|
homepage: https://github.com/dovadi/data_store
|
68
67
|
licenses:
|
69
68
|
- MIT
|
69
|
+
metadata: {}
|
70
70
|
post_install_message:
|
71
71
|
rdoc_options: []
|
72
72
|
require_paths:
|
73
73
|
- lib
|
74
74
|
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
-
none: false
|
76
75
|
requirements:
|
77
|
-
- -
|
76
|
+
- - '>='
|
78
77
|
- !ruby/object:Gem::Version
|
79
78
|
version: '0'
|
80
|
-
segments:
|
81
|
-
- 0
|
82
|
-
hash: -2498536008263531709
|
83
79
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
80
|
requirements:
|
86
|
-
- -
|
81
|
+
- - '>='
|
87
82
|
- !ruby/object:Gem::Version
|
88
83
|
version: '0'
|
89
|
-
segments:
|
90
|
-
- 0
|
91
|
-
hash: -2498536008263531709
|
92
84
|
requirements: []
|
93
85
|
rubyforge_project:
|
94
|
-
rubygems_version: 1.
|
86
|
+
rubygems_version: 2.1.9
|
95
87
|
signing_key:
|
96
|
-
specification_version:
|
88
|
+
specification_version: 4
|
97
89
|
summary: DataStore for storing real time data
|
98
90
|
test_files:
|
99
91
|
- test/average_calculator_test.rb
|