redistimeseries 0.1.1 → 0.1.2
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/.github/workflows/build.yml +48 -0
- data/.github/workflows/gempush.yml +13 -11
- data/Gemfile.lock +1 -1
- data/README.md +1 -0
- data/lib/redistimeseries/redis_refinement.rb +49 -18
- data/lib/redistimeseries/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a72e1a9e50a89524c4e4b7678b629d120fd41d918cd7c7e6d19fe90ad3d8f41e
|
4
|
+
data.tar.gz: 75fa47de22b1351321ddbb93b46ee7d51804fea64479c31ff84ad5f1b35b45b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ad9e23e76fd204a3231c650faf74faee510f12809e705106919c85f970cb627181a98be94d018566d337c5e18f99069de03636c5117cead6156db4486b1024e
|
7
|
+
data.tar.gz: f660b37032c113a8dabfd1f9730c2390483dfe56828b6644fc1168ead9ad8d7bf9803f49d5359012e45e1b53b376d8cc81bc1c719694177f5e6c0d7580a3b88f
|
@@ -0,0 +1,48 @@
|
|
1
|
+
name: Publish Gem
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
branches: [ gem ]
|
6
|
+
|
7
|
+
jobs:
|
8
|
+
build:
|
9
|
+
name: Build + Publish
|
10
|
+
runs-on: ubuntu-latest
|
11
|
+
services:
|
12
|
+
redistimeseries:
|
13
|
+
image: redislabs/redistimeseries:latest
|
14
|
+
ports:
|
15
|
+
- 6379/tcp
|
16
|
+
# options: --entrypoint redis-server
|
17
|
+
steps:
|
18
|
+
- uses: actions/checkout@v2
|
19
|
+
- name: Set up Ruby 2.6
|
20
|
+
uses: actions/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
version: 2.6.x
|
23
|
+
- name: Debug Info
|
24
|
+
env:
|
25
|
+
REDIS_PORT: ${{ job.services.redistimeseries.ports[6379] }}
|
26
|
+
run: |
|
27
|
+
sudo apt-get install redis-tools
|
28
|
+
redis-cli -p ${REDIS_PORT} info
|
29
|
+
redis-cli -p ${REDIS_PORT} TS.CREATE mytestkey
|
30
|
+
- name: Bundle install
|
31
|
+
run: |
|
32
|
+
gem install bundler:2.1.2
|
33
|
+
bundle install
|
34
|
+
- name: Run specs
|
35
|
+
env:
|
36
|
+
REDIS_URL: redis://localhost:${{ job.services.redistimeseries.ports[6379] }}
|
37
|
+
run: |
|
38
|
+
./bin/rspec
|
39
|
+
- name: Publish to RubyGems
|
40
|
+
run: |
|
41
|
+
mkdir -p $HOME/.gem
|
42
|
+
touch $HOME/.gem/credentials
|
43
|
+
chmod 0600 $HOME/.gem/credentials
|
44
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
45
|
+
gem build *.gemspec
|
46
|
+
gem push *.gem
|
47
|
+
env:
|
48
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
@@ -1,10 +1,12 @@
|
|
1
|
-
name:
|
1
|
+
name: CI Build
|
2
2
|
|
3
3
|
on:
|
4
4
|
push:
|
5
5
|
branches: [ master ]
|
6
6
|
pull_request:
|
7
7
|
branches: [ master ]
|
8
|
+
schedule:
|
9
|
+
- cron: '0 0 * * *' # Nightly to cover cases where the server might breaks the client
|
8
10
|
|
9
11
|
jobs:
|
10
12
|
build:
|
@@ -38,13 +40,13 @@ jobs:
|
|
38
40
|
REDIS_URL: redis://localhost:${{ job.services.redistimeseries.ports[6379] }}
|
39
41
|
run: |
|
40
42
|
./bin/rspec
|
41
|
-
- name: Publish to RubyGems
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
43
|
+
# - name: Publish to RubyGems
|
44
|
+
# run: |
|
45
|
+
# mkdir -p $HOME/.gem
|
46
|
+
# touch $HOME/.gem/credentials
|
47
|
+
# chmod 0600 $HOME/.gem/credentials
|
48
|
+
# printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
49
|
+
# gem build *.gemspec
|
50
|
+
# gem push *.gem
|
51
|
+
# env:
|
52
|
+
# GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,8 +20,11 @@ module Redistimeseries
|
|
20
20
|
_ts_call(cmd)
|
21
21
|
end
|
22
22
|
|
23
|
-
|
24
|
-
|
23
|
+
# Usage:
|
24
|
+
# ts_madd([key, timestamp, value, key, timestamp, value])
|
25
|
+
# or ts_madd([[key, timestamp, value], [key, timestamp, value]])
|
26
|
+
def ts_madd(key_timestamp_values)
|
27
|
+
cmd = ['TS.MADD', *key_timestamp_values.flatten]
|
25
28
|
_ts_call(cmd)
|
26
29
|
end
|
27
30
|
|
@@ -29,40 +32,68 @@ module Redistimeseries
|
|
29
32
|
|
30
33
|
def ts_decrby; end
|
31
34
|
|
32
|
-
def ts_createrule
|
35
|
+
def ts_createrule(source_key:, dest_key:, aggregation_type:, timebucket:)
|
36
|
+
cmd = ["TS.CREATERULE", source_key, dest_key]
|
37
|
+
cmd += ["AGGREGATION", aggregation_type, timebucket]
|
38
|
+
_ts_call(cmd)
|
39
|
+
end
|
33
40
|
|
34
41
|
def ts_deleterule; end
|
35
42
|
|
36
|
-
def ts_range(key:, from:
|
37
|
-
|
38
|
-
cmd
|
39
|
-
if
|
40
|
-
cmd += ['COUNT', count]
|
41
|
-
else
|
42
|
-
cmd += ['AGGREGATION', aggtype, timebucket]
|
43
|
-
end
|
43
|
+
def ts_range(key:, from: '-', to: '+', count: nil, aggtype: nil, timebucket: nil)
|
44
|
+
cmd = ['TS.RANGE', key, from, to]
|
45
|
+
cmd += ['COUNT', count] if count
|
46
|
+
cmd += ['AGGREGATION', aggtype, timebucket] if aggtype && timebucket
|
44
47
|
_ts_call(cmd)
|
45
48
|
end
|
46
49
|
|
47
|
-
def ts_mrange
|
50
|
+
def ts_mrange(from_timestamp:, to_timestamp:,
|
51
|
+
aggregation_type: nil, time_bucket: nil,
|
52
|
+
count: nil, with_labels: false, filters: [])
|
53
|
+
|
54
|
+
cmd = ["TS.MRANGE", from_timestamp, to_timestamp]
|
55
|
+
cmd += ["COUNT", count] if count
|
56
|
+
|
57
|
+
if aggregation_type && time_bucket
|
58
|
+
cmd += ["AGGREGATION", aggregation_type, time_bucket]
|
59
|
+
end
|
60
|
+
|
61
|
+
cmd += ["WITHLABELS"] if with_labels
|
62
|
+
cmd += ["FILTER", *filters] if filters.length.positive?
|
63
|
+
|
64
|
+
_ts_call(cmd)
|
65
|
+
end
|
48
66
|
|
49
|
-
def ts_get
|
67
|
+
def ts_get(key)
|
68
|
+
cmd = ["TS.GET", key]
|
69
|
+
_ts_call(cmd)
|
70
|
+
end
|
50
71
|
|
51
|
-
def ts_mget
|
72
|
+
def ts_mget(filters:, withlabels: false)
|
73
|
+
cmd = []
|
74
|
+
cmd += ["WITHLABELS"] if withlabels
|
75
|
+
cmd += ["FILTER", *filters]
|
76
|
+
_ts_call(cmd)
|
77
|
+
end
|
52
78
|
|
53
79
|
def ts_info(key:)
|
54
80
|
cmd = ["TS.INFO", key]
|
55
81
|
_ts_call(cmd)
|
56
82
|
end
|
57
83
|
|
58
|
-
def ts_queryindex(
|
59
|
-
cmd = ["TS.QUERYINDEX",
|
84
|
+
def ts_queryindex(filters:)
|
85
|
+
cmd = ["TS.QUERYINDEX", *filters]
|
60
86
|
_ts_call(cmd)
|
61
87
|
end
|
62
88
|
|
63
|
-
def _ts_call(
|
89
|
+
def _ts_call(args)
|
64
90
|
# puts "CMD #{cmd.join(' ')}"
|
65
|
-
|
91
|
+
synchronize do |client|
|
92
|
+
res = client.call(args)
|
93
|
+
raise res.first if res.is_a?(Array) && res.first.is_a?(Redis::CommandError)
|
94
|
+
|
95
|
+
res
|
96
|
+
end
|
66
97
|
end
|
67
98
|
end
|
68
99
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redistimeseries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eaden McKee (eadz)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-06-
|
11
|
+
date: 2020-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|
@@ -31,6 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
+
- ".github/workflows/build.yml"
|
34
35
|
- ".github/workflows/gempush.yml"
|
35
36
|
- ".gitignore"
|
36
37
|
- ".rspec"
|