redistimeseries 0.1.0
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 +7 -0
- data/.github/workflows/gempush.yml +50 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +39 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +10 -0
- data/Gemfile.lock +65 -0
- data/LICENCE.md +20 -0
- data/README.md +59 -0
- data/Rakefile +15 -0
- data/bin/console +21 -0
- data/bin/rspec +28 -0
- data/bin/setup +8 -0
- data/lib/redistimeseries.rb +8 -0
- data/lib/redistimeseries/redis_refinement.rb +67 -0
- data/lib/redistimeseries/time_refinement.rb +7 -0
- data/lib/redistimeseries/version.rb +3 -0
- data/redistimeseries.gemspec +30 -0
- metadata +78 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4af4bf21201c52e7d9341772f9e42ef980bfbfda0e1d9e459d1ad3d6b937cc42
|
|
4
|
+
data.tar.gz: 5d452593b2532a78b6ed38a11626ddb83fa5f91b5ee821e6f7d40d0769fd8add
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: d76f55ae9b6e42ab9f5999db3aa0d1444e668583084f30fe9e4cc868d3cb7ece238cd2916c3ceaff699163ae9f9aaf574fd2472bf046d65ed8c86653440f487a
|
|
7
|
+
data.tar.gz: 231f52e8ed45b1fe36539ad3e6353541f6d3b6705563f16db2b66600b306014c7133142a81e04f6d390f35742b3eb76c2345b722aa1540dfdafa1a30de924cf5
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
name: Ruby Gem
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ master ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Build + Publish
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
services:
|
|
14
|
+
redistimeseries:
|
|
15
|
+
image: redislabs/redistimeseries:latest
|
|
16
|
+
ports:
|
|
17
|
+
- 6379/tcp
|
|
18
|
+
# options: --entrypoint redis-server
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v2
|
|
21
|
+
- name: Set up Ruby 2.6
|
|
22
|
+
uses: actions/setup-ruby@v1
|
|
23
|
+
with:
|
|
24
|
+
version: 2.6.x
|
|
25
|
+
- name: Debug Info
|
|
26
|
+
env:
|
|
27
|
+
REDIS_PORT: ${{ job.services.redistimeseries.ports[6379] }}
|
|
28
|
+
run: |
|
|
29
|
+
sudo apt-get install redis-tools
|
|
30
|
+
redis-cli -p ${REDIS_PORT} info
|
|
31
|
+
redis-cli -p ${REDIS_PORT} TS.CREATE mytestkey
|
|
32
|
+
- name: Bundle install
|
|
33
|
+
run: |
|
|
34
|
+
gem install bundler:2.1.2
|
|
35
|
+
bundle install
|
|
36
|
+
- name: Run specs
|
|
37
|
+
env:
|
|
38
|
+
REDIS_URL: redis://localhost:${{ job.services.redistimeseries.ports[6379] }}
|
|
39
|
+
run: |
|
|
40
|
+
./bin/rspec
|
|
41
|
+
- name: Publish to RubyGems
|
|
42
|
+
run: |
|
|
43
|
+
mkdir -p $HOME/.gem
|
|
44
|
+
touch $HOME/.gem/credentials
|
|
45
|
+
chmod 0600 $HOME/.gem/credentials
|
|
46
|
+
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
|
|
47
|
+
gem build *.gemspec
|
|
48
|
+
gem push *.gem
|
|
49
|
+
env:
|
|
50
|
+
GEM_HOST_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Layout/SpaceAroundMethodCallOperator:
|
|
2
|
+
Enabled: true
|
|
3
|
+
|
|
4
|
+
Lint/RaiseException:
|
|
5
|
+
Enabled: true
|
|
6
|
+
|
|
7
|
+
Lint/StructNewOverride:
|
|
8
|
+
Enabled: true
|
|
9
|
+
|
|
10
|
+
Style/ExponentialNotation:
|
|
11
|
+
Enabled: true
|
|
12
|
+
|
|
13
|
+
Style/HashEachMethods:
|
|
14
|
+
Enabled: true
|
|
15
|
+
|
|
16
|
+
Style/StringLiterals:
|
|
17
|
+
Enabled: false
|
|
18
|
+
|
|
19
|
+
Style/ExpandPathArguments:
|
|
20
|
+
Enabled: false
|
|
21
|
+
|
|
22
|
+
Style/FrozenStringLiteralComment:
|
|
23
|
+
Enabled: false
|
|
24
|
+
|
|
25
|
+
Style/HashTransformKeys:
|
|
26
|
+
Enabled: true
|
|
27
|
+
|
|
28
|
+
Style/HashTransformValues:
|
|
29
|
+
Enabled: true
|
|
30
|
+
|
|
31
|
+
AllCops:
|
|
32
|
+
Exclude:
|
|
33
|
+
- vendor/**/*
|
|
34
|
+
- wall-middleware/**/*
|
|
35
|
+
- node_modules/**/*
|
|
36
|
+
|
|
37
|
+
Style/BlockDelimiters:
|
|
38
|
+
Exclude:
|
|
39
|
+
- spec/**/*
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at mail@eaden.net. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: https://contributor-covenant.org
|
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
source "https://rubygems.org"
|
|
2
|
+
|
|
3
|
+
# Specify your gem's dependencies in redistimeseries.gemspec
|
|
4
|
+
gemspec
|
|
5
|
+
|
|
6
|
+
gem "rake", "~> 12.0"
|
|
7
|
+
gem "redis", "~> 4.1.4"
|
|
8
|
+
gem "rspec", "~> 3.0"
|
|
9
|
+
gem "rubocop", "~> 0.82.0"
|
|
10
|
+
gem 'sdoc', git: 'https://github.com/p8/sdoc.git', branch: 'without-frames'
|
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
GIT
|
|
2
|
+
remote: https://github.com/p8/sdoc.git
|
|
3
|
+
revision: 4c5d4a0863ef1c44a41e828ce621c23a6a2e2712
|
|
4
|
+
branch: without-frames
|
|
5
|
+
specs:
|
|
6
|
+
sdoc (1.1.0)
|
|
7
|
+
rdoc (>= 5.0)
|
|
8
|
+
|
|
9
|
+
PATH
|
|
10
|
+
remote: .
|
|
11
|
+
specs:
|
|
12
|
+
redistimeseries (0.1.0)
|
|
13
|
+
redis (>= 4)
|
|
14
|
+
|
|
15
|
+
GEM
|
|
16
|
+
remote: https://rubygems.org/
|
|
17
|
+
specs:
|
|
18
|
+
ast (2.4.0)
|
|
19
|
+
diff-lcs (1.3)
|
|
20
|
+
jaro_winkler (1.5.4)
|
|
21
|
+
parallel (1.19.1)
|
|
22
|
+
parser (2.7.1.2)
|
|
23
|
+
ast (~> 2.4.0)
|
|
24
|
+
rainbow (3.0.0)
|
|
25
|
+
rake (12.3.3)
|
|
26
|
+
rdoc (6.2.1)
|
|
27
|
+
redis (4.1.4)
|
|
28
|
+
rexml (3.2.4)
|
|
29
|
+
rspec (3.9.0)
|
|
30
|
+
rspec-core (~> 3.9.0)
|
|
31
|
+
rspec-expectations (~> 3.9.0)
|
|
32
|
+
rspec-mocks (~> 3.9.0)
|
|
33
|
+
rspec-core (3.9.2)
|
|
34
|
+
rspec-support (~> 3.9.3)
|
|
35
|
+
rspec-expectations (3.9.2)
|
|
36
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
37
|
+
rspec-support (~> 3.9.0)
|
|
38
|
+
rspec-mocks (3.9.1)
|
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
40
|
+
rspec-support (~> 3.9.0)
|
|
41
|
+
rspec-support (3.9.3)
|
|
42
|
+
rubocop (0.82.0)
|
|
43
|
+
jaro_winkler (~> 1.5.1)
|
|
44
|
+
parallel (~> 1.10)
|
|
45
|
+
parser (>= 2.7.0.1)
|
|
46
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
47
|
+
rexml
|
|
48
|
+
ruby-progressbar (~> 1.7)
|
|
49
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
|
50
|
+
ruby-progressbar (1.10.1)
|
|
51
|
+
unicode-display_width (1.7.0)
|
|
52
|
+
|
|
53
|
+
PLATFORMS
|
|
54
|
+
ruby
|
|
55
|
+
|
|
56
|
+
DEPENDENCIES
|
|
57
|
+
rake (~> 12.0)
|
|
58
|
+
redis (~> 4.1.4)
|
|
59
|
+
redistimeseries!
|
|
60
|
+
rspec (~> 3.0)
|
|
61
|
+
rubocop (~> 0.82.0)
|
|
62
|
+
sdoc!
|
|
63
|
+
|
|
64
|
+
BUNDLED WITH
|
|
65
|
+
2.1.2
|
data/LICENCE.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
Copyright (c) 2020 Eaden McKee
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
4
|
+
a copy of this software and associated documentation files (the
|
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
+
the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be
|
|
12
|
+
included in all copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Redistimeseries
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'redistimeseries'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle install
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install redistimeseries
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
RedisTimeSeries gem uses Ruby's refinement to add timeseries methods to the Redis gem.
|
|
24
|
+
|
|
25
|
+
You need to include the line
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
using Redistimeseries::RedisRefinement
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
in files which use the redis timeseries functions.
|
|
32
|
+
|
|
33
|
+
### done
|
|
34
|
+
|
|
35
|
+
```ruby
|
|
36
|
+
ts_create(key:, retention: nil, uncompressed: false, labels: [])
|
|
37
|
+
ts_add(key:, timestamp: "*", value:, retention: nil, labels: [])
|
|
38
|
+
ts_madd(key:, timestamp: "*", value:)
|
|
39
|
+
ts_range(key:, from: 0, to: nil, count: nil, aggtype: nil, timebucket: nil)
|
|
40
|
+
ts_info(key:)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### todo
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
50
|
+
|
|
51
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
52
|
+
|
|
53
|
+
## Contributing
|
|
54
|
+
|
|
55
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eadz/redistimeseries.
|
|
56
|
+
|
|
57
|
+
## Code of Conduct
|
|
58
|
+
|
|
59
|
+
Everyone interacting in the Redistimeseries project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/eadz/redistimeseries/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
require "bundler/gem_tasks"
|
|
2
|
+
require "rspec/core/rake_task"
|
|
3
|
+
|
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
5
|
+
|
|
6
|
+
task default: :spec
|
|
7
|
+
|
|
8
|
+
require 'sdoc' # and use your RDoc task the same way you used it before
|
|
9
|
+
require 'rdoc/task' # ensure this file is also required in order to use `RDoc::Task`
|
|
10
|
+
|
|
11
|
+
RDoc::Task.new do |rdoc|
|
|
12
|
+
rdoc.rdoc_dir = 'doc/rdoc' # name of output directory
|
|
13
|
+
rdoc.options << '--format=sdoc' # explictly set the sdoc generator
|
|
14
|
+
rdoc.template = 'rails' # template used on api.rubyonrails.org
|
|
15
|
+
end
|
data/bin/console
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "redistimeseries"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
|
|
15
|
+
require "redis"
|
|
16
|
+
|
|
17
|
+
using Redistimeseries::RedisRefinement
|
|
18
|
+
|
|
19
|
+
@redis = Redis.new(host: "recmon.red")
|
|
20
|
+
|
|
21
|
+
IRB.start(__FILE__)
|
data/bin/rspec
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# frozen_string_literal: true
|
|
3
|
+
|
|
4
|
+
#
|
|
5
|
+
# This file was generated by Bundler.
|
|
6
|
+
#
|
|
7
|
+
# The application 'rspec' is installed as part of a gem, and
|
|
8
|
+
# this file is here to facilitate running it.
|
|
9
|
+
#
|
|
10
|
+
|
|
11
|
+
require "pathname"
|
|
12
|
+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", Pathname.new(__FILE__).realpath)
|
|
13
|
+
|
|
14
|
+
bundle_binstub = File.expand_path("../bundle", __FILE__)
|
|
15
|
+
|
|
16
|
+
if File.file?(bundle_binstub)
|
|
17
|
+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
|
|
18
|
+
load(bundle_binstub)
|
|
19
|
+
else
|
|
20
|
+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
|
|
21
|
+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
require "rubygems"
|
|
26
|
+
require "bundler/setup"
|
|
27
|
+
|
|
28
|
+
load Gem.bin_path("rspec-core", "rspec")
|
data/bin/setup
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Redis Timeseries functions for the Redis gem
|
|
2
|
+
module Redistimeseries
|
|
3
|
+
# refine the Redis class to add ts_* methods
|
|
4
|
+
module RedisRefinement
|
|
5
|
+
refine Redis do
|
|
6
|
+
def ts_create(key:, retention: nil, uncompressed: false, labels: [])
|
|
7
|
+
cmd = ['TS.CREATE', key]
|
|
8
|
+
cmd += ['RETENTION', retention] if retention
|
|
9
|
+
cmd += ['UNCOMPRESSED'] if uncompressed
|
|
10
|
+
cmd += ['LABELS'] if labels.any?
|
|
11
|
+
cmd += labels if labels.any?
|
|
12
|
+
_ts_call(cmd)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def ts_add(key:, timestamp: "*", value:, retention: nil, labels: [])
|
|
16
|
+
cmd = ['TS.ADD', key, timestamp, value]
|
|
17
|
+
cmd += ['RETENTION', retention] if retention
|
|
18
|
+
cmd += ['LABELS'] if labels.any?
|
|
19
|
+
cmd += labels if labels.any?
|
|
20
|
+
_ts_call(cmd)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def ts_madd(key:, timestamp: "*", value:) # TODO make multi
|
|
24
|
+
cmd = ['TS.MADD', key, timestamp, value]
|
|
25
|
+
_ts_call(cmd)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def ts_incrby; end
|
|
29
|
+
|
|
30
|
+
def ts_decrby; end
|
|
31
|
+
|
|
32
|
+
def ts_createrule; end
|
|
33
|
+
|
|
34
|
+
def ts_deleterule; end
|
|
35
|
+
|
|
36
|
+
def ts_range(key:, from: 0, to: nil, count: nil, aggtype: nil, timebucket: nil)
|
|
37
|
+
to_time = to || (Time.now.to_f * 1000.0).to_i
|
|
38
|
+
cmd = ['TS.RANGE', key, from, to_time]
|
|
39
|
+
if count
|
|
40
|
+
cmd += ['COUNT', count]
|
|
41
|
+
else
|
|
42
|
+
cmd += ['AGGREGATION', aggtype, timebucket]
|
|
43
|
+
end
|
|
44
|
+
_ts_call(cmd)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def ts_mrange; end
|
|
48
|
+
def ts_get; end
|
|
49
|
+
def ts_mget; end
|
|
50
|
+
|
|
51
|
+
def ts_info(key:)
|
|
52
|
+
cmd = ["TS.INFO", key]
|
|
53
|
+
_ts_call(cmd)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def ts_queryindex(filter:)
|
|
57
|
+
cmd = ["TS.QUERYINDEX", filter]
|
|
58
|
+
_ts_call(cmd)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def _ts_call(cmd)
|
|
62
|
+
# puts "CMD #{cmd.join(' ')}"
|
|
63
|
+
call cmd
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
require_relative 'lib/redistimeseries/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = "redistimeseries"
|
|
5
|
+
spec.version = Redistimeseries::VERSION
|
|
6
|
+
spec.authors = ["Eaden McKee (eadz)"]
|
|
7
|
+
spec.email = ["mail@eaden.net"]
|
|
8
|
+
|
|
9
|
+
spec.summary = %q{Ruby client for Redis Timeseries.}
|
|
10
|
+
spec.description = %q{Ruby client for Redis Timeseries, a redis add-on module.}
|
|
11
|
+
spec.homepage = "https://github.com/eadz/redistimeseries"
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
|
13
|
+
|
|
14
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org/"
|
|
15
|
+
|
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/eadz/redistimeseries"
|
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/eadz/redistimeseries"
|
|
19
|
+
|
|
20
|
+
spec.add_dependency 'redis', '>= 4'
|
|
21
|
+
|
|
22
|
+
# Specify which files should be added to the gem when it is released.
|
|
23
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
24
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
25
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
26
|
+
end
|
|
27
|
+
spec.bindir = "exe"
|
|
28
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
29
|
+
spec.require_paths = ["lib"]
|
|
30
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: redistimeseries
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Eaden McKee (eadz)
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-06-17 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: redis
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - ">="
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '4'
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - ">="
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '4'
|
|
27
|
+
description: Ruby client for Redis Timeseries, a redis add-on module.
|
|
28
|
+
email:
|
|
29
|
+
- mail@eaden.net
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- ".github/workflows/gempush.yml"
|
|
35
|
+
- ".gitignore"
|
|
36
|
+
- ".rspec"
|
|
37
|
+
- ".rubocop.yml"
|
|
38
|
+
- CODE_OF_CONDUCT.md
|
|
39
|
+
- Gemfile
|
|
40
|
+
- Gemfile.lock
|
|
41
|
+
- LICENCE.md
|
|
42
|
+
- README.md
|
|
43
|
+
- Rakefile
|
|
44
|
+
- bin/console
|
|
45
|
+
- bin/rspec
|
|
46
|
+
- bin/setup
|
|
47
|
+
- lib/redistimeseries.rb
|
|
48
|
+
- lib/redistimeseries/redis_refinement.rb
|
|
49
|
+
- lib/redistimeseries/time_refinement.rb
|
|
50
|
+
- lib/redistimeseries/version.rb
|
|
51
|
+
- redistimeseries.gemspec
|
|
52
|
+
homepage: https://github.com/eadz/redistimeseries
|
|
53
|
+
licenses: []
|
|
54
|
+
metadata:
|
|
55
|
+
allowed_push_host: https://rubygems.org/
|
|
56
|
+
homepage_uri: https://github.com/eadz/redistimeseries
|
|
57
|
+
source_code_uri: https://github.com/eadz/redistimeseries
|
|
58
|
+
changelog_uri: https://github.com/eadz/redistimeseries
|
|
59
|
+
post_install_message:
|
|
60
|
+
rdoc_options: []
|
|
61
|
+
require_paths:
|
|
62
|
+
- lib
|
|
63
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
66
|
+
- !ruby/object:Gem::Version
|
|
67
|
+
version: 2.3.0
|
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
|
+
requirements:
|
|
70
|
+
- - ">="
|
|
71
|
+
- !ruby/object:Gem::Version
|
|
72
|
+
version: '0'
|
|
73
|
+
requirements: []
|
|
74
|
+
rubygems_version: 3.0.3
|
|
75
|
+
signing_key:
|
|
76
|
+
specification_version: 4
|
|
77
|
+
summary: Ruby client for Redis Timeseries.
|
|
78
|
+
test_files: []
|