heavy_keeper 0.1.3 → 0.1.5

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
  SHA256:
3
- metadata.gz: f8410f712a9a520ed622ac2eb4c0daedbc815e36313d0cf3cdcaadf70d516a5d
4
- data.tar.gz: c70655d1cecfb02030c459bdf7075227c2b631abb501c5362057341e85d4adcc
3
+ metadata.gz: 2b659791c1f7e376b5756adc0943d8c017ab2071065d7458370ffa7150ff5054
4
+ data.tar.gz: 19a989e669b8304d6e76fa1bdb9933f61f7658910931e6e3f64825e650fcc30b
5
5
  SHA512:
6
- metadata.gz: 1a787943e9f72e611763605d13e26c80efdebe331d3063f735d2cb3556afe9f8d225e91a8543cc415bd05a8520765c52b03a5939657dbbb5e6276ce2c7875f7f
7
- data.tar.gz: 0fc7cd55e2a9c5414a66717088f6de542ba17eb6c5f8fbd57afc88f9cc3ebf3295c5af301e31c47a98223259e3859969c36c0a2c6960ddfbe57fd877e3443790
6
+ metadata.gz: c673d46a38adfb562a7eeac7e4a46b3d8ea6ea65a53229f27119d8be6ea430656ceacfff75b3f1a668dab3cfee1e73a772dc807a64ce59effd1c777b8d234375
7
+ data.tar.gz: 75053f5bf704153a91d9b13e544e0ec873ede5da88293bc7e64d99def05a767eb7910a16621614f49dd445903ae8bc2367da86bb4c0bb07b57202456e720baad
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [0.1.5] - 2024-06-13
2
+
3
+ - Support latest version of xx-hash
4
+
5
+ ## [0.1.4] - 2022-11-19
6
+
7
+ - Support redis-rb 5.x
8
+
1
9
  ## [0.1.3] - 2022-07-01
2
10
  - Actually fix key typos with specs
3
11
 
data/Gemfile.redis.4 ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in heavy_keeper.gemspec
6
+ gemspec
7
+
8
+ gem 'rubocop', require: false
9
+
10
+ gem 'rake', '~> 13.0'
11
+ gem 'redis', '~> 4.0'
12
+
13
+ group :test do
14
+ gem 'mock_redis'
15
+ gem 'rspec'
16
+ gem 'pry-byebug'
17
+ end
data/Gemfile.redis.5 ADDED
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in heavy_keeper.gemspec
6
+ gemspec
7
+
8
+ gem 'rubocop', require: false
9
+
10
+ gem 'rake', '~> 13.0'
11
+ gem 'redis', '~> 5.0'
12
+
13
+ group :test do
14
+ gem 'mock_redis'
15
+ gem 'rspec'
16
+ gem 'pry-byebug'
17
+ end
@@ -26,7 +26,7 @@ module HeavyKeeper
26
26
 
27
27
  def min(key)
28
28
  item = storage.zrangebyscore(sorted_set_key(key), - Float::INFINITY, Float::INFINITY, limit: [0, 1]).first
29
- count(key, item)
29
+ item ? count(key, item) : 0
30
30
  end
31
31
 
32
32
  def exist?(key, item)
@@ -38,6 +38,10 @@ module HeavyKeeper
38
38
  # @return OK on success, otherwise raise error
39
39
  def reserve(key, options)
40
40
  options = validate(options)
41
+ # We need to use Decimal when validating to accept integer
42
+ # number. However, we need to convert to float when save to Redis
43
+ # because redis-rb 5 don't support Decimal type
44
+ options[:decay] = options[:decay].to_f
41
45
 
42
46
  storage.mapped_hmset(metadata_key(key), options)
43
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HeavyKeeper
4
- VERSION = '0.1.3'
4
+ VERSION = '0.1.5'
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heavy_keeper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hieu Nguyen
8
8
  - Kenneth Teh
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-07-01 00:00:00.000000000 Z
12
+ date: 2024-06-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-configurable
@@ -43,32 +43,32 @@ dependencies:
43
43
  name: redis
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '4'
48
+ version: '0'
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '4'
55
+ version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: xxhash
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - "~>"
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
- version: 0.4.0
62
+ version: '0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: 0.4.0
70
- description:
71
- email:
69
+ version: '0'
70
+ description:
71
+ email:
72
72
  executables: []
73
73
  extensions: []
74
74
  extra_rdoc_files: []
@@ -77,12 +77,12 @@ files:
77
77
  - ".rubocop.yml"
78
78
  - CHANGELOG.md
79
79
  - Gemfile
80
- - Gemfile.lock
80
+ - Gemfile.redis.4
81
+ - Gemfile.redis.5
81
82
  - README.md
82
83
  - Rakefile
83
84
  - bin/console
84
85
  - bin/setup
85
- - heavy_keeper.gemspec
86
86
  - lib/heavy_keeper.rb
87
87
  - lib/heavy_keeper/bucket.rb
88
88
  - lib/heavy_keeper/min_heap.rb
@@ -96,7 +96,7 @@ metadata:
96
96
  source_code_uri: https://github.com/Kaligo/heavy_keeper
97
97
  changelog_uri: https://github.com/Kaligo/heavy_keeper/blob/master/CHANGELOG.md
98
98
  rubygems_mfa_required: 'true'
99
- post_install_message:
99
+ post_install_message:
100
100
  rdoc_options: []
101
101
  require_paths:
102
102
  - lib
@@ -111,8 +111,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
111
111
  - !ruby/object:Gem::Version
112
112
  version: '0'
113
113
  requirements: []
114
- rubygems_version: 3.2.28
115
- signing_key:
114
+ rubygems_version: 3.0.3.1
115
+ signing_key:
116
116
  specification_version: 4
117
117
  summary: Gem which implements HeavyKeeper algorithm
118
118
  test_files: []
data/Gemfile.lock DELETED
@@ -1,103 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- heavy_keeper (0.1.3)
5
- dry-configurable (>= 0.13.0)
6
- dry-schema (~> 1)
7
- redis (~> 4)
8
- xxhash (~> 0.4.0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- ast (2.4.2)
14
- byebug (11.1.3)
15
- coderay (1.1.3)
16
- concurrent-ruby (1.1.10)
17
- diff-lcs (1.5.0)
18
- dry-configurable (0.15.0)
19
- concurrent-ruby (~> 1.0)
20
- dry-core (~> 0.6)
21
- dry-container (0.9.0)
22
- concurrent-ruby (~> 1.0)
23
- dry-configurable (~> 0.13, >= 0.13.0)
24
- dry-core (0.7.1)
25
- concurrent-ruby (~> 1.0)
26
- dry-inflector (0.2.1)
27
- dry-initializer (3.1.1)
28
- dry-logic (1.2.0)
29
- concurrent-ruby (~> 1.0)
30
- dry-core (~> 0.5, >= 0.5)
31
- dry-schema (1.9.1)
32
- concurrent-ruby (~> 1.0)
33
- dry-configurable (~> 0.13, >= 0.13.0)
34
- dry-core (~> 0.5, >= 0.5)
35
- dry-initializer (~> 3.0)
36
- dry-logic (~> 1.0)
37
- dry-types (~> 1.5)
38
- dry-types (1.5.1)
39
- concurrent-ruby (~> 1.0)
40
- dry-container (~> 0.3)
41
- dry-core (~> 0.5, >= 0.5)
42
- dry-inflector (~> 0.1, >= 0.1.2)
43
- dry-logic (~> 1.0, >= 1.0.2)
44
- method_source (1.0.0)
45
- mock_redis (0.31.0)
46
- ruby2_keywords
47
- parallel (1.22.1)
48
- parser (3.1.2.0)
49
- ast (~> 2.4.1)
50
- pry (0.13.1)
51
- coderay (~> 1.1)
52
- method_source (~> 1.0)
53
- pry-byebug (3.9.0)
54
- byebug (~> 11.0)
55
- pry (~> 0.13.0)
56
- rainbow (3.1.1)
57
- rake (13.0.6)
58
- redis (4.7.0)
59
- regexp_parser (2.4.0)
60
- rexml (3.2.5)
61
- rspec (3.11.0)
62
- rspec-core (~> 3.11.0)
63
- rspec-expectations (~> 3.11.0)
64
- rspec-mocks (~> 3.11.0)
65
- rspec-core (3.11.0)
66
- rspec-support (~> 3.11.0)
67
- rspec-expectations (3.11.0)
68
- diff-lcs (>= 1.2.0, < 2.0)
69
- rspec-support (~> 3.11.0)
70
- rspec-mocks (3.11.1)
71
- diff-lcs (>= 1.2.0, < 2.0)
72
- rspec-support (~> 3.11.0)
73
- rspec-support (3.11.0)
74
- rubocop (1.29.1)
75
- parallel (~> 1.10)
76
- parser (>= 3.1.0.0)
77
- rainbow (>= 2.2.2, < 4.0)
78
- regexp_parser (>= 1.8, < 3.0)
79
- rexml (>= 3.2.5, < 4.0)
80
- rubocop-ast (>= 1.17.0, < 2.0)
81
- ruby-progressbar (~> 1.7)
82
- unicode-display_width (>= 1.4.0, < 3.0)
83
- rubocop-ast (1.18.0)
84
- parser (>= 3.1.1.0)
85
- ruby-progressbar (1.11.0)
86
- ruby2_keywords (0.0.5)
87
- unicode-display_width (2.1.0)
88
- xxhash (0.4.0)
89
-
90
- PLATFORMS
91
- x86_64-darwin-19
92
- x86_64-linux
93
-
94
- DEPENDENCIES
95
- heavy_keeper!
96
- mock_redis
97
- pry-byebug
98
- rake (~> 13.0)
99
- rspec
100
- rubocop
101
-
102
- BUNDLED WITH
103
- 2.2.32
data/heavy_keeper.gemspec DELETED
@@ -1,35 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'lib/heavy_keeper/version'
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = 'heavy_keeper'
7
- spec.version = HeavyKeeper::VERSION
8
- spec.authors = ['Hieu Nguyen', 'Kenneth Teh']
9
-
10
- spec.summary = 'Gem which implements HeavyKeeper algorithm'
11
- spec.homepage = 'https://github.com/Kaligo/heavy_keeper'
12
- spec.required_ruby_version = '>= 2.7.0'
13
-
14
- spec.metadata['homepage_uri'] = spec.homepage
15
- spec.metadata['source_code_uri'] = 'https://github.com/Kaligo/heavy_keeper'
16
- spec.metadata['changelog_uri'] = 'https://github.com/Kaligo/heavy_keeper/blob/master/CHANGELOG.md'
17
-
18
- # Specify which files should be added to the gem when it is released.
19
- # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
20
- spec.files = Dir.chdir(File.expand_path(__dir__)) do
21
- `git ls-files -z`.split("\x0").reject do |f|
22
- (f == __FILE__) || f.match(%r{\A(?:(?:test|spec|features)/|\.(?:git|travis|circleci)|appveyor)})
23
- end
24
- end
25
- spec.bindir = 'exe'
26
- spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
- spec.require_paths = ['lib']
28
-
29
- spec.add_dependency 'dry-configurable', '>= 0.13.0'
30
- spec.add_dependency 'dry-schema', '~> 1'
31
- spec.add_dependency 'redis', '~> 4'
32
- spec.add_dependency 'xxhash', '~> 0.4.0'
33
-
34
- spec.metadata['rubygems_mfa_required'] = 'true'
35
- end