throttle_machines 0.0.0 → 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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/MIT-LICENSE +20 -0
  3. data/README.md +187 -13
  4. data/Rakefile +12 -0
  5. data/lib/throttle_machines/async_limiter.rb +134 -0
  6. data/lib/throttle_machines/clock.rb +41 -0
  7. data/lib/throttle_machines/control.rb +95 -0
  8. data/lib/throttle_machines/controller_helpers.rb +79 -0
  9. data/lib/throttle_machines/dependency_error.rb +6 -0
  10. data/lib/throttle_machines/engine.rb +25 -0
  11. data/lib/throttle_machines/hedged_request.rb +137 -0
  12. data/lib/throttle_machines/instrumentation.rb +162 -0
  13. data/lib/throttle_machines/limiter.rb +167 -0
  14. data/lib/throttle_machines/middleware.rb +90 -0
  15. data/lib/throttle_machines/rack_middleware/allow2_ban.rb +62 -0
  16. data/lib/throttle_machines/rack_middleware/blocklist.rb +27 -0
  17. data/lib/throttle_machines/rack_middleware/configuration.rb +103 -0
  18. data/lib/throttle_machines/rack_middleware/fail2_ban.rb +87 -0
  19. data/lib/throttle_machines/rack_middleware/request.rb +12 -0
  20. data/lib/throttle_machines/rack_middleware/safelist.rb +27 -0
  21. data/lib/throttle_machines/rack_middleware/throttle.rb +95 -0
  22. data/lib/throttle_machines/rack_middleware/track.rb +51 -0
  23. data/lib/throttle_machines/rack_middleware.rb +87 -0
  24. data/lib/throttle_machines/storage/base.rb +93 -0
  25. data/lib/throttle_machines/storage/memory.rb +374 -0
  26. data/lib/throttle_machines/storage/null.rb +90 -0
  27. data/lib/throttle_machines/storage/redis.rb +451 -0
  28. data/lib/throttle_machines/throttled_error.rb +14 -0
  29. data/lib/throttle_machines/version.rb +5 -0
  30. data/lib/throttle_machines.rb +134 -5
  31. metadata +105 -9
  32. data/LICENSE.txt +0 -21
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: throttle_machines
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
- - seuros
7
+ - Abdelkader Boudih
8
8
  bindir: bin
9
9
  cert_chain: []
10
10
  date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
- name: rails
13
+ name: activesupport
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
16
  - - ">="
@@ -23,18 +23,113 @@ dependencies:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
25
  version: '7.0'
26
- description: ThrottleMachines provides intelligent throttling and rate limiting mechanisms
27
- for distributed systems. This is a placeholder gem - full implementation coming
28
- soon.
26
+ - !ruby/object:Gem::Dependency
27
+ name: concurrent-ruby
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1.3'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: '1.3'
40
+ - !ruby/object:Gem::Dependency
41
+ name: rack
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '3.0'
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: '3.0'
54
+ - !ruby/object:Gem::Dependency
55
+ name: zeitwerk
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: '2.7'
61
+ type: :runtime
62
+ prerelease: false
63
+ version_requirements: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '2.7'
68
+ - !ruby/object:Gem::Dependency
69
+ name: breaker_machines
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '0.4'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '0.4'
82
+ - !ruby/object:Gem::Dependency
83
+ name: chrono_machines
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0.2'
89
+ type: :runtime
90
+ prerelease: false
91
+ version_requirements: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0.2'
96
+ description: ThrottleMachines provides ultra-thin, elegant rate limiting with temporal
97
+ precision for distributed systems.
29
98
  email:
30
99
  - terminale@gmail.com
31
100
  executables: []
32
101
  extensions: []
33
102
  extra_rdoc_files: []
34
103
  files:
35
- - LICENSE.txt
104
+ - MIT-LICENSE
36
105
  - README.md
106
+ - Rakefile
37
107
  - lib/throttle_machines.rb
108
+ - lib/throttle_machines/async_limiter.rb
109
+ - lib/throttle_machines/clock.rb
110
+ - lib/throttle_machines/control.rb
111
+ - lib/throttle_machines/controller_helpers.rb
112
+ - lib/throttle_machines/dependency_error.rb
113
+ - lib/throttle_machines/engine.rb
114
+ - lib/throttle_machines/hedged_request.rb
115
+ - lib/throttle_machines/instrumentation.rb
116
+ - lib/throttle_machines/limiter.rb
117
+ - lib/throttle_machines/middleware.rb
118
+ - lib/throttle_machines/rack_middleware.rb
119
+ - lib/throttle_machines/rack_middleware/allow2_ban.rb
120
+ - lib/throttle_machines/rack_middleware/blocklist.rb
121
+ - lib/throttle_machines/rack_middleware/configuration.rb
122
+ - lib/throttle_machines/rack_middleware/fail2_ban.rb
123
+ - lib/throttle_machines/rack_middleware/request.rb
124
+ - lib/throttle_machines/rack_middleware/safelist.rb
125
+ - lib/throttle_machines/rack_middleware/throttle.rb
126
+ - lib/throttle_machines/rack_middleware/track.rb
127
+ - lib/throttle_machines/storage/base.rb
128
+ - lib/throttle_machines/storage/memory.rb
129
+ - lib/throttle_machines/storage/null.rb
130
+ - lib/throttle_machines/storage/redis.rb
131
+ - lib/throttle_machines/throttled_error.rb
132
+ - lib/throttle_machines/version.rb
38
133
  homepage: https://github.com/seuros/throttle_machines
39
134
  licenses:
40
135
  - MIT
@@ -42,6 +137,7 @@ metadata:
42
137
  homepage_uri: https://github.com/seuros/throttle_machines
43
138
  source_code_uri: https://github.com/seuros/throttle_machines
44
139
  changelog_uri: https://github.com/seuros/throttle_machines/blob/main/CHANGELOG.md
140
+ rubygems_mfa_required: 'true'
45
141
  rdoc_options: []
46
142
  require_paths:
47
143
  - lib
@@ -49,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
49
145
  requirements:
50
146
  - - ">="
51
147
  - !ruby/object:Gem::Version
52
- version: 3.0.0
148
+ version: 3.3.0
53
149
  required_rubygems_version: !ruby/object:Gem::Requirement
54
150
  requirements:
55
151
  - - ">="
@@ -58,5 +154,5 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
154
  requirements: []
59
155
  rubygems_version: 3.6.9
60
156
  specification_version: 4
61
- summary: Advanced throttling and rate limiting for distributed systems
157
+ summary: Advanced Rate limiting for Ruby applications
62
158
  test_files: []
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2025 seuros
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.