throttle_machines 0.4.2 → 0.5.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 +4 -4
- data/CHANGELOG.md +231 -0
- data/Cargo.lock +307 -0
- data/Cargo.toml +31 -0
- data/README.md +89 -14
- data/ext/throttle_machines_native/core/CHANGELOG.md +77 -0
- data/ext/throttle_machines_native/core/Cargo.toml +25 -0
- data/ext/throttle_machines_native/core/README.md +100 -0
- data/ext/throttle_machines_native/core/src/fixed_window.rs +172 -0
- data/ext/throttle_machines_native/core/src/gate.rs +82 -0
- data/ext/throttle_machines_native/core/src/gcra.rs +219 -0
- data/ext/throttle_machines_native/core/src/keyed.rs +325 -0
- data/ext/throttle_machines_native/core/src/lib.rs +50 -0
- data/ext/throttle_machines_native/core/src/refusal.rs +30 -0
- data/ext/throttle_machines_native/core/src/token_bucket.rs +191 -0
- data/ext/throttle_machines_native/extconf.rb +2 -0
- data/ext/throttle_machines_native/ffi/CHANGELOG.md +59 -0
- data/ext/throttle_machines_native/ffi/Cargo.toml +22 -0
- data/ext/throttle_machines_native/ffi/extconf.rb +14 -0
- data/ext/throttle_machines_native/ffi/src/init.rs +63 -0
- data/ext/throttle_machines_native/ffi/src/lib.rs +255 -0
- data/ext/throttle_machines_native/ffi/src/values.rs +194 -0
- data/lib/throttle_machines/async_breaker.rb +5 -0
- data/lib/throttle_machines/async_support.rb +16 -21
- data/lib/throttle_machines/breakers.rb +46 -0
- data/lib/throttle_machines/control.rb +25 -46
- data/lib/throttle_machines/controller_helpers.rb +11 -10
- data/lib/throttle_machines/hedged_breaker.rb +4 -6
- data/lib/throttle_machines/hedged_request.rb +29 -42
- data/lib/throttle_machines/instrumentation.rb +10 -75
- data/lib/throttle_machines/limiter.rb +71 -136
- data/lib/throttle_machines/middleware.rb +6 -6
- data/lib/throttle_machines/rack_middleware/allow2_ban.rb +1 -8
- data/lib/throttle_machines/rack_middleware/ban_filter.rb +3 -2
- data/lib/throttle_machines/rack_middleware/configuration.rb +4 -2
- data/lib/throttle_machines/rack_middleware/fail2_ban.rb +5 -21
- data/lib/throttle_machines/rack_middleware/throttle.rb +2 -1
- data/lib/throttle_machines/rack_middleware.rb +3 -1
- data/lib/throttle_machines/storage/base.rb +49 -48
- data/lib/throttle_machines/storage/cache.rb +12 -6
- data/lib/throttle_machines/storage/memory.rb +68 -96
- data/lib/throttle_machines/storage/null.rb +18 -28
- data/lib/throttle_machines/storage/redis/gcra.lua +21 -20
- data/lib/throttle_machines/storage/redis/increment_counter.lua +4 -4
- data/lib/throttle_machines/storage/redis/peek_gcra.lua +16 -16
- data/lib/throttle_machines/storage/redis/peek_token_bucket.lua +22 -18
- data/lib/throttle_machines/storage/redis/token_bucket.lua +31 -19
- data/lib/throttle_machines/storage/redis.rb +63 -69
- data/lib/throttle_machines/throttled_error.rb +4 -1
- data/lib/throttle_machines/version.rb +1 -1
- data/lib/throttle_machines.rb +130 -87
- data/sig/throttle_machines.rbs +555 -0
- metadata +55 -71
- data/lib/throttle_machines/async_limiter.rb +0 -24
- data/lib/throttle_machines/dependency_error.rb +0 -6
- data/lib/throttle_machines/native_speedup.rb +0 -110
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 52f81ff86ea3f215e36065831a425f7634c0265414e6140cde4981232c2cd806
|
|
4
|
+
data.tar.gz: 2f6f56df2855d2a139b16b9dacf353559703cadcf24a706e659bdeeb9c3f9b0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a3d62ba072872876452b1213a1d4ae81fab0098930588a944a8ba2bb24a386c66a59b21a4690da86aaa6e4f4e025c80745f6d292cf005f666ca266f41b7d6a69
|
|
7
|
+
data.tar.gz: 00b4854c7a98561b1e31afedb1ad6927b25cd14fd50703409958447c972be40d3def9be75fe105d57b9eab30d02787aff2b9f24f3ab3504a680871a3118b3533
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.5.0](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.4.3...throttle_machines/v0.5.0) (2026-11-16)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* rebuild throttle on the fleet conventions with exact gate counts
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* rebuild throttle on the fleet conventions with exact gate counts ([94d19f3](https://github.com/seuros/throttle_machines/commit/94d19f3abbcbe8c8b05563561e9a68d06ca8d079))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* keep test modules out of the packaged crate ([7f28c6e](https://github.com/seuros/throttle_machines/commit/7f28c6e2a72a9d4a30ec809be8f8a9c9462fa20e))
|
|
23
|
+
|
|
24
|
+
## [0.4.3](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.4.2...throttle_machines/v0.4.3) (2026-11-02)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
* refund a keyed admission ([d3c1aa0](https://github.com/seuros/throttle_machines/commit/d3c1aa0b95797e0574253b767e43c229ddb5de40))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
### Bug Fixes
|
|
33
|
+
|
|
34
|
+
* sweep a keyed shard once an eighth of it could have recovered ([48b6ad9](https://github.com/seuros/throttle_machines/commit/48b6ad996b6ecdcf4b9b7c543d7970d0ffd8291a))
|
|
35
|
+
|
|
36
|
+
## [0.4.2](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.4.1...throttle_machines/v0.4.2) (2026-11-01)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
### Bug Fixes
|
|
40
|
+
|
|
41
|
+
* give the GC time instead of assuming it ran ([2ab097f](https://github.com/seuros/throttle_machines/commit/2ab097f4f5160da18d760cd0ba6a807071cd866e))
|
|
42
|
+
|
|
43
|
+
## [0.4.1](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.4.0...throttle_machines/v0.4.1) (2026-11-01)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Features
|
|
47
|
+
|
|
48
|
+
* gems:push_all fetches the release itself ([0d161ce](https://github.com/seuros/throttle_machines/commit/0d161cedd7983e6ac10b787d072ee9a82b858333))
|
|
49
|
+
* pass a rubygems OTP through GEM_OTP ([6ee50b0](https://github.com/seuros/throttle_machines/commit/6ee50b07703bd123fb902780a2aeae30601c74a5))
|
|
50
|
+
* verify release gem checksums before pushing ([409258c](https://github.com/seuros/throttle_machines/commit/409258cedd8844272eb4fb16f301b141b4c087c7))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
### Bug Fixes
|
|
54
|
+
|
|
55
|
+
* enable the rb-sys compiled fallback so new Rubies can build ([9f1f1b6](https://github.com/seuros/throttle_machines/commit/9f1f1b6289d697ff2f3894820e7826a9ddbd1244))
|
|
56
|
+
* raise the breaker_machines floor to 0.24.0 ([897ff41](https://github.com/seuros/throttle_machines/commit/897ff41e49b0b15fc96b067ceb38ab5f254a514d))
|
|
57
|
+
* raise the chrono_machines floor to 0.12.1 ([e6bfcbe](https://github.com/seuros/throttle_machines/commit/e6bfcbebf222e0b553ef445e4b8bf80de7d7be74))
|
|
58
|
+
|
|
59
|
+
## [0.4.0](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.3.4...throttle_machines/v0.4.0) (2026-11-01)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
### ⚠ BREAKING CHANGES
|
|
63
|
+
|
|
64
|
+
* a Storage::Base subclass implementing gcra or token_bucket must also implement reset_gcra and reset_token_bucket, or supports? reports the algorithm unavailable.
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
* bound the throttle wait by the caller's deadline ([37a7784](https://github.com/seuros/throttle_machines/commit/37a7784ca6b5eed976d5b61ca4b6d0a51502a407))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
### Bug Fixes
|
|
72
|
+
|
|
73
|
+
* a failed gem push fails the release ([6c51c25](https://github.com/seuros/throttle_machines/commit/6c51c25a5f2a424c8d165df9fa04d69960808ef3))
|
|
74
|
+
* a lone checkout can bundle ([5cc6824](https://github.com/seuros/throttle_machines/commit/5cc68244e7f7f3ce3a3dfc665a7e6c907648d667))
|
|
75
|
+
* a reset deletes its own limiter's keys, not a pattern ([b9f93af](https://github.com/seuros/throttle_machines/commit/b9f93af050b3790f881dd7fe15882ec7f6a53f4a))
|
|
76
|
+
* a spent budget raised nothing and ran unbounded ([d58240e](https://github.com/seuros/throttle_machines/commit/d58240ebb675e7ec55b4eac0886d223807eabc51))
|
|
77
|
+
* backoff: selected jitter, never the backoff strategy ([f2f6a2d](https://github.com/seuros/throttle_machines/commit/f2f6a2dcdf776839bc6c1fbbeed18a4384e2fc4a))
|
|
78
|
+
* both backends report a wait as a Float ([525c9a6](https://github.com/seuros/throttle_machines/commit/525c9a6e3791fbe3e93b5c35ac09f77d470c65a5))
|
|
79
|
+
* bound the storage timeout by the caller's budget ([1bef8b1](https://github.com/seuros/throttle_machines/commit/1bef8b1d191a421a0f0bdcb9d4d818851e1360b8))
|
|
80
|
+
* break_circuit shares one circuit, limiters reject a zero rate ([acf5bd8](https://github.com/seuros/throttle_machines/commit/acf5bd8d46b2a655af9b970889e8e47fb5bbf188))
|
|
81
|
+
* **storage:** let a memory store be garbage collected ([e173f89](https://github.com/seuros/throttle_machines/commit/e173f89bf056dbf75a0d514fd7a857bdeddcc50a))
|
|
82
|
+
|
|
83
|
+
## [0.3.4](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.3.3...throttle_machines/v0.3.4) (2026-10-30)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
### Features
|
|
87
|
+
|
|
88
|
+
* **storage:** add ActiveSupport::Cache storage ([176c366](https://github.com/seuros/throttle_machines/commit/176c366dc159ff4493482913ddc4110462590344))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
### Bug Fixes
|
|
92
|
+
|
|
93
|
+
* **deps:** require breaker_machines 0.22.1 ([8bbcdda](https://github.com/seuros/throttle_machines/commit/8bbcddaf6459d6905e47401af6b5de73001f6537))
|
|
94
|
+
* **storage:** reject algorithms a storage cannot run when the limiter is built ([a024d23](https://github.com/seuros/throttle_machines/commit/a024d23ab9b24fb93d4f9fa5aa16bf7b56bee253))
|
|
95
|
+
|
|
96
|
+
## [0.3.3](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.3.2...throttle_machines/v0.3.3) (2026-10-27)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
### Bug Fixes
|
|
100
|
+
|
|
101
|
+
* Zeitwerk ignores native_speedup.rb, so apps that eager load (production, CI) boot instead of raising NameError for ThrottleMachines::NativeSpeedup ([#20](https://github.com/seuros/throttle_machines/issues/20)) ([a333434](https://github.com/seuros/throttle_machines/commit/a3334348b9f328d60767bccf317842fde1c27b6e))
|
|
102
|
+
|
|
103
|
+
## [0.3.2](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.3.1...throttle_machines/v0.3.2) (2026-10-20)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
### Bug Fixes
|
|
107
|
+
|
|
108
|
+
* cap in-memory storage across Ruby and native backends ([284387a](https://github.com/seuros/throttle_machines/commit/284387a091383fbbe5e9b02536084fbb7b81838d))
|
|
109
|
+
* **core:** cap keyed GCRA storage under identity sprays ([fb8030a](https://github.com/seuros/throttle_machines/commit/fb8030a73b4dfe03497fd7550f8ee391cca41538))
|
|
110
|
+
|
|
111
|
+
## [0.3.1](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.3.0...throttle_machines/v0.3.1) (2026-10-14)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
### Features
|
|
115
|
+
|
|
116
|
+
* **core:** add KeyedGcra per-key store and GcraParams::from_rate ([b7fa7a5](https://github.com/seuros/throttle_machines/commit/b7fa7a59bcc3dfb276e4fb9be3a95e38c08fe84c))
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
### Bug Fixes
|
|
120
|
+
|
|
121
|
+
* admit on-schedule GCRA requests in Ruby and Redis storage ([110b5e3](https://github.com/seuros/throttle_machines/commit/110b5e3d6103180a324e7edeca585958970208f0))
|
|
122
|
+
* **core:** admit a token due now despite float rounding ([c46bd54](https://github.com/seuros/throttle_machines/commit/c46bd54e2d913ecc25c3a9fe8098a8116c1747d6))
|
|
123
|
+
* **core:** admit on-schedule GCRA requests despite float rounding ([5aa090e](https://github.com/seuros/throttle_machines/commit/5aa090e1562325e5d9474f3ec35cf1d22d5ccafb))
|
|
124
|
+
* token bucket rounding and truncated Redis replies ([eae0a9e](https://github.com/seuros/throttle_machines/commit/eae0a9e4a5a42b4f6fc2cc61810471d596df08b5))
|
|
125
|
+
|
|
126
|
+
## [0.3.0](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.2.4...throttle_machines/v0.3.0) (2026-10-12)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
### ⚠ BREAKING CHANGES
|
|
130
|
+
|
|
131
|
+
* Rails 8.0 is no longer supported; activesupport >= 8.1 is required.
|
|
132
|
+
|
|
133
|
+
### Bug Fixes
|
|
134
|
+
|
|
135
|
+
* retain loaded Redis script SHAs ([#16](https://github.com/seuros/throttle_machines/issues/16)) ([75f2ef1](https://github.com/seuros/throttle_machines/commit/75f2ef1a48f8c5e20fec6a96bb61105b96e23d4f))
|
|
136
|
+
* run Redis scripts by SHA with a single EVAL fallback ([6e586e6](https://github.com/seuros/throttle_machines/commit/6e586e6d32782eb95a6b136763b870f36f8da309))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Build System
|
|
140
|
+
|
|
141
|
+
* require Rails 8.1 and run tests with padded_cell ([f131d15](https://github.com/seuros/throttle_machines/commit/f131d15e0445db0758b8cdb96fb3a23573eafa7f))
|
|
142
|
+
|
|
143
|
+
## [0.2.4](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.2.3...throttle_machines/v0.2.4) (2026-10-10)
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
### Bug Fixes
|
|
147
|
+
|
|
148
|
+
* **ci:** attach release gems with gh release upload ([dd3ece4](https://github.com/seuros/throttle_machines/commit/dd3ece4a402e8b088b25648c6c786cce03832593))
|
|
149
|
+
* **ci:** use upload-artifact@v7; v8 does not exist ([e535e25](https://github.com/seuros/throttle_machines/commit/e535e255424179a13b7639db82cc691afdf9faf1))
|
|
150
|
+
* **deps:** pin breaker_machines ~> 0.19 ([7621b67](https://github.com/seuros/throttle_machines/commit/7621b6718d9a93696a748464255e3f44d9a50738))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### Performance Improvements
|
|
154
|
+
|
|
155
|
+
* **ffi:** build Decision/Outcome without a kwargs hash; adopt clippy pedantic and nursery ([23c263d](https://github.com/seuros/throttle_machines/commit/23c263da35829a9375397abaae807659ca96a1ac))
|
|
156
|
+
|
|
157
|
+
## [0.2.3](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.2.2...throttle_machines/v0.2.3) (2026-10-06)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
### Features
|
|
161
|
+
|
|
162
|
+
* require Ruby 4.0, magnus 0.9, Ractor-safe ext with Data results ([448ecd6](https://github.com/seuros/throttle_machines/commit/448ecd6674c5be744cc92b44d368a46552d48161))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
### Bug Fixes
|
|
166
|
+
|
|
167
|
+
* **build:** skip host compile when packaging a cross gem ([2becc31](https://github.com/seuros/throttle_machines/commit/2becc317c51e2f047ee3053a0a179db78c93225e))
|
|
168
|
+
* **ci:** build Rust crates against Ruby 4.0 ([3a69957](https://github.com/seuros/throttle_machines/commit/3a699577ec16ef6655bf6e382012b91bd22a914a))
|
|
169
|
+
* **deps:** pin breaker_machines ~> 0.18, chrono_machines ~> 0.9 ([17e1d60](https://github.com/seuros/throttle_machines/commit/17e1d60a4b19cdf5622093accf2290615f2aaed7))
|
|
170
|
+
|
|
171
|
+
## [0.2.2](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.2.1...throttle_machines/v0.2.2) (2026-06-24)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
### Features
|
|
175
|
+
|
|
176
|
+
* add native circuit breaker on shared Gate contract ([dee0b57](https://github.com/seuros/throttle_machines/commit/dee0b57b20c7c887c2e7f7e7d7d2e6a5696be118))
|
|
177
|
+
|
|
178
|
+
## [0.2.1](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.2.0...throttle_machines/v0.2.1) (2026-06-24)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
### Bug Fixes
|
|
182
|
+
|
|
183
|
+
* add storage-backed async throttling ([09c8125](https://github.com/seuros/throttle_machines/commit/09c8125312dd21fb7a61c469b99faf09764cd75d))
|
|
184
|
+
* add storage-backed async throttling ([12fe6b5](https://github.com/seuros/throttle_machines/commit/12fe6b51631d149f849aeb818f8d6252b5f8eb04))
|
|
185
|
+
|
|
186
|
+
## [0.2.0](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.1.3...throttle_machines/v0.2.0) (2026-05-25)
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
### Bug Fixes
|
|
190
|
+
|
|
191
|
+
* build native extension with current rb_sys ([0960f00](https://github.com/seuros/throttle_machines/commit/0960f00ecbb3f55fd888984f7474c591fc0459ed))
|
|
192
|
+
* ship pure ruby fallback gem ([3a54ac3](https://github.com/seuros/throttle_machines/commit/3a54ac3dffb073ece85a10c4c35ed3c426d658f6))
|
|
193
|
+
|
|
194
|
+
## [0.1.3](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.1.2...throttle_machines/v0.1.3) (2026-03-22)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
### Features
|
|
198
|
+
|
|
199
|
+
* add matryoshka pattern with Rust native extension ([97d41a6](https://github.com/seuros/throttle_machines/commit/97d41a6ddf71e042f437c44315c40e3d30c9efe1))
|
|
200
|
+
* add matryoshka pattern with Rust native extension ([3f614cb](https://github.com/seuros/throttle_machines/commit/3f614cbefe8b489f6627b35b635ed954e9e84d4d))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
### Bug Fixes
|
|
204
|
+
|
|
205
|
+
* bump breaker_machines to ~> 0.10 and upgrade magnus to 0.8.2 ([62b1c20](https://github.com/seuros/throttle_machines/commit/62b1c2007879775eed1d8412caba641c7ef345bd))
|
|
206
|
+
* lower Ruby requirement to 3.3.0 for TruffleRuby compatibility ([2067cc7](https://github.com/seuros/throttle_machines/commit/2067cc775362cb268d2e601aeb8c396449ca1be2))
|
|
207
|
+
* upgrade magnus to 0.8.2 and refresh lock file ([01c6924](https://github.com/seuros/throttle_machines/commit/01c692477c05bd927501b595a4cfb162de968087))
|
|
208
|
+
|
|
209
|
+
## [0.1.2](https://github.com/seuros/throttle_machines/compare/throttle_machines/v0.1.1...throttle_machines/v0.1.2) (2025-11-11)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
### Features
|
|
213
|
+
|
|
214
|
+
* Add Rails 8.1 support and remove ActiveSupport::Configurable deprecation ([#4](https://github.com/seuros/throttle_machines/issues/4)) ([684fe6f](https://github.com/seuros/throttle_machines/commit/684fe6fc0b5a0dd150cc4b08d872c37f46bffdff))
|
|
215
|
+
|
|
216
|
+
## [0.1.1](https://github.com/seuros/throttle_machines/compare/throttle_machines-v0.1.0...throttle_machines/v0.1.1) (2025-08-08)
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
### Bug Fixes
|
|
220
|
+
|
|
221
|
+
* extract lua code ([d4821aa](https://github.com/seuros/throttle_machines/commit/d4821aaa411919ef63a6fdc681e977e9b4eec8e4))
|
|
222
|
+
* extract lua code ([aa87d14](https://github.com/seuros/throttle_machines/commit/aa87d146911b760cfef1b76f6d2dd87ad6870458))
|
|
223
|
+
* versioning ([df0a3f8](https://github.com/seuros/throttle_machines/commit/df0a3f89ba027639f99fa6a49cdc10b9ba9dcdea))
|
|
224
|
+
|
|
225
|
+
## [Unreleased]
|
|
226
|
+
|
|
227
|
+
### Added
|
|
228
|
+
- Initial implementation of ThrottleMachines
|
|
229
|
+
- Core rate limiting engine with temporal precision
|
|
230
|
+
- Support for multiple storage backends
|
|
231
|
+
- Elegant API design for Rails integration
|
data/Cargo.lock
ADDED
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
|
2
|
+
# It is not intended for manual editing.
|
|
3
|
+
version = 4
|
|
4
|
+
|
|
5
|
+
[[package]]
|
|
6
|
+
name = "aho-corasick"
|
|
7
|
+
version = "1.1.4"
|
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
9
|
+
checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"
|
|
10
|
+
dependencies = [
|
|
11
|
+
"memchr",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[[package]]
|
|
15
|
+
name = "bindgen"
|
|
16
|
+
version = "0.72.1"
|
|
17
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
18
|
+
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
|
19
|
+
dependencies = [
|
|
20
|
+
"bitflags",
|
|
21
|
+
"cexpr",
|
|
22
|
+
"clang-sys",
|
|
23
|
+
"itertools",
|
|
24
|
+
"proc-macro2",
|
|
25
|
+
"quote",
|
|
26
|
+
"regex",
|
|
27
|
+
"rustc-hash",
|
|
28
|
+
"shlex",
|
|
29
|
+
"syn",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[[package]]
|
|
33
|
+
name = "bitflags"
|
|
34
|
+
version = "2.11.1"
|
|
35
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
36
|
+
checksum = "c4512299f36f043ab09a583e57bceb5a5aab7a73db1805848e8fef3c9e8c78b3"
|
|
37
|
+
|
|
38
|
+
[[package]]
|
|
39
|
+
name = "bytes"
|
|
40
|
+
version = "1.12.1"
|
|
41
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
42
|
+
checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
|
43
|
+
|
|
44
|
+
[[package]]
|
|
45
|
+
name = "cexpr"
|
|
46
|
+
version = "0.6.0"
|
|
47
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
48
|
+
checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766"
|
|
49
|
+
dependencies = [
|
|
50
|
+
"nom",
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
[[package]]
|
|
54
|
+
name = "cfg-if"
|
|
55
|
+
version = "1.0.4"
|
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
57
|
+
checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"
|
|
58
|
+
|
|
59
|
+
[[package]]
|
|
60
|
+
name = "clang-sys"
|
|
61
|
+
version = "1.8.1"
|
|
62
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
63
|
+
checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4"
|
|
64
|
+
dependencies = [
|
|
65
|
+
"glob",
|
|
66
|
+
"libc",
|
|
67
|
+
"libloading",
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
[[package]]
|
|
71
|
+
name = "either"
|
|
72
|
+
version = "1.16.0"
|
|
73
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
74
|
+
checksum = "91622ff5e7162018101f2fea40d6ebf4a78bbe5a49736a2020649edf9693679e"
|
|
75
|
+
|
|
76
|
+
[[package]]
|
|
77
|
+
name = "glob"
|
|
78
|
+
version = "0.3.3"
|
|
79
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
80
|
+
checksum = "0cc23270f6e1808e30a928bdc84dea0b9b4136a8bc82338574f23baf47bbd280"
|
|
81
|
+
|
|
82
|
+
[[package]]
|
|
83
|
+
name = "itertools"
|
|
84
|
+
version = "0.13.0"
|
|
85
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
86
|
+
checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
|
|
87
|
+
dependencies = [
|
|
88
|
+
"either",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
[[package]]
|
|
92
|
+
name = "lazy_static"
|
|
93
|
+
version = "1.5.0"
|
|
94
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
95
|
+
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
|
|
96
|
+
|
|
97
|
+
[[package]]
|
|
98
|
+
name = "libc"
|
|
99
|
+
version = "0.2.186"
|
|
100
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
101
|
+
checksum = "68ab91017fe16c622486840e4c83c9a37afeff978bd239b5293d61ece587de66"
|
|
102
|
+
|
|
103
|
+
[[package]]
|
|
104
|
+
name = "libloading"
|
|
105
|
+
version = "0.8.9"
|
|
106
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
107
|
+
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
|
108
|
+
dependencies = [
|
|
109
|
+
"cfg-if",
|
|
110
|
+
"windows-link",
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[[package]]
|
|
114
|
+
name = "magnus"
|
|
115
|
+
version = "0.9.3"
|
|
116
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
117
|
+
checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
|
|
118
|
+
dependencies = [
|
|
119
|
+
"bytes",
|
|
120
|
+
"magnus-macros",
|
|
121
|
+
"rb-sys",
|
|
122
|
+
"rb-sys-env",
|
|
123
|
+
"seq-macro",
|
|
124
|
+
]
|
|
125
|
+
|
|
126
|
+
[[package]]
|
|
127
|
+
name = "magnus-macros"
|
|
128
|
+
version = "0.9.1"
|
|
129
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
130
|
+
checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
|
|
131
|
+
dependencies = [
|
|
132
|
+
"proc-macro2",
|
|
133
|
+
"quote",
|
|
134
|
+
"syn",
|
|
135
|
+
]
|
|
136
|
+
|
|
137
|
+
[[package]]
|
|
138
|
+
name = "matryona-machines"
|
|
139
|
+
version = "0.6.0"
|
|
140
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
141
|
+
checksum = "cf8a06ab02efd767270815a1f515a40bbf3bfc77038e9360676ebe8d47833b07"
|
|
142
|
+
dependencies = [
|
|
143
|
+
"magnus",
|
|
144
|
+
]
|
|
145
|
+
|
|
146
|
+
[[package]]
|
|
147
|
+
name = "memchr"
|
|
148
|
+
version = "2.8.0"
|
|
149
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
150
|
+
checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"
|
|
151
|
+
|
|
152
|
+
[[package]]
|
|
153
|
+
name = "minimal-lexical"
|
|
154
|
+
version = "0.2.1"
|
|
155
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
156
|
+
checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
157
|
+
|
|
158
|
+
[[package]]
|
|
159
|
+
name = "nom"
|
|
160
|
+
version = "7.1.3"
|
|
161
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
162
|
+
checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
|
|
163
|
+
dependencies = [
|
|
164
|
+
"memchr",
|
|
165
|
+
"minimal-lexical",
|
|
166
|
+
]
|
|
167
|
+
|
|
168
|
+
[[package]]
|
|
169
|
+
name = "proc-macro2"
|
|
170
|
+
version = "1.0.106"
|
|
171
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
172
|
+
checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"
|
|
173
|
+
dependencies = [
|
|
174
|
+
"unicode-ident",
|
|
175
|
+
]
|
|
176
|
+
|
|
177
|
+
[[package]]
|
|
178
|
+
name = "quote"
|
|
179
|
+
version = "1.0.45"
|
|
180
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
181
|
+
checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924"
|
|
182
|
+
dependencies = [
|
|
183
|
+
"proc-macro2",
|
|
184
|
+
]
|
|
185
|
+
|
|
186
|
+
[[package]]
|
|
187
|
+
name = "rb-sys"
|
|
188
|
+
version = "0.9.130"
|
|
189
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
190
|
+
checksum = "02faf625bb10ba893e3ae620f19c9fb1b5f8fcae0fe4eb86bb3f2230fad75edb"
|
|
191
|
+
dependencies = [
|
|
192
|
+
"rb-sys-build",
|
|
193
|
+
]
|
|
194
|
+
|
|
195
|
+
[[package]]
|
|
196
|
+
name = "rb-sys-build"
|
|
197
|
+
version = "0.9.130"
|
|
198
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
199
|
+
checksum = "05be6f9c86fe5482808162826f6c047d093b3670582296c770de1d94f8066694"
|
|
200
|
+
dependencies = [
|
|
201
|
+
"bindgen",
|
|
202
|
+
"lazy_static",
|
|
203
|
+
"proc-macro2",
|
|
204
|
+
"quote",
|
|
205
|
+
"regex",
|
|
206
|
+
"shell-words",
|
|
207
|
+
"syn",
|
|
208
|
+
]
|
|
209
|
+
|
|
210
|
+
[[package]]
|
|
211
|
+
name = "rb-sys-env"
|
|
212
|
+
version = "0.2.3"
|
|
213
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
214
|
+
checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
215
|
+
|
|
216
|
+
[[package]]
|
|
217
|
+
name = "regex"
|
|
218
|
+
version = "1.12.3"
|
|
219
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
220
|
+
checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"
|
|
221
|
+
dependencies = [
|
|
222
|
+
"aho-corasick",
|
|
223
|
+
"memchr",
|
|
224
|
+
"regex-automata",
|
|
225
|
+
"regex-syntax",
|
|
226
|
+
]
|
|
227
|
+
|
|
228
|
+
[[package]]
|
|
229
|
+
name = "regex-automata"
|
|
230
|
+
version = "0.4.14"
|
|
231
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
232
|
+
checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"
|
|
233
|
+
dependencies = [
|
|
234
|
+
"aho-corasick",
|
|
235
|
+
"memchr",
|
|
236
|
+
"regex-syntax",
|
|
237
|
+
]
|
|
238
|
+
|
|
239
|
+
[[package]]
|
|
240
|
+
name = "regex-syntax"
|
|
241
|
+
version = "0.8.10"
|
|
242
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
243
|
+
checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a"
|
|
244
|
+
|
|
245
|
+
[[package]]
|
|
246
|
+
name = "rustc-hash"
|
|
247
|
+
version = "2.1.2"
|
|
248
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
249
|
+
checksum = "94300abf3f1ae2e2b8ffb7b58043de3d399c73fa6f4b73826402a5c457614dbe"
|
|
250
|
+
|
|
251
|
+
[[package]]
|
|
252
|
+
name = "seq-macro"
|
|
253
|
+
version = "0.3.6"
|
|
254
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
255
|
+
checksum = "1bc711410fbe7399f390ca1c3b60ad0f53f80e95c5eb935e52268a0e2cd49acc"
|
|
256
|
+
|
|
257
|
+
[[package]]
|
|
258
|
+
name = "shell-words"
|
|
259
|
+
version = "1.1.1"
|
|
260
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
261
|
+
checksum = "dc6fe69c597f9c37bfeeeeeb33da3530379845f10be461a66d16d03eca2ded77"
|
|
262
|
+
|
|
263
|
+
[[package]]
|
|
264
|
+
name = "shlex"
|
|
265
|
+
version = "1.3.0"
|
|
266
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
267
|
+
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
|
268
|
+
|
|
269
|
+
[[package]]
|
|
270
|
+
name = "syn"
|
|
271
|
+
version = "2.0.117"
|
|
272
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
273
|
+
checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99"
|
|
274
|
+
dependencies = [
|
|
275
|
+
"proc-macro2",
|
|
276
|
+
"quote",
|
|
277
|
+
"unicode-ident",
|
|
278
|
+
]
|
|
279
|
+
|
|
280
|
+
[[package]]
|
|
281
|
+
name = "throttle-machines"
|
|
282
|
+
version = "0.6.0"
|
|
283
|
+
dependencies = [
|
|
284
|
+
"matryona-machines",
|
|
285
|
+
]
|
|
286
|
+
|
|
287
|
+
[[package]]
|
|
288
|
+
name = "throttle_machines_native"
|
|
289
|
+
version = "0.5.0"
|
|
290
|
+
dependencies = [
|
|
291
|
+
"magnus",
|
|
292
|
+
"matryona-machines",
|
|
293
|
+
"rb-sys",
|
|
294
|
+
"throttle-machines",
|
|
295
|
+
]
|
|
296
|
+
|
|
297
|
+
[[package]]
|
|
298
|
+
name = "unicode-ident"
|
|
299
|
+
version = "1.0.24"
|
|
300
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
301
|
+
checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75"
|
|
302
|
+
|
|
303
|
+
[[package]]
|
|
304
|
+
name = "windows-link"
|
|
305
|
+
version = "0.2.1"
|
|
306
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
307
|
+
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
data/Cargo.toml
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[workspace]
|
|
2
|
+
members = ["ext/throttle_machines_native/core", "ext/throttle_machines_native/ffi"]
|
|
3
|
+
default-members = ["ext/throttle_machines_native/core"]
|
|
4
|
+
resolver = "3"
|
|
5
|
+
|
|
6
|
+
[workspace.package]
|
|
7
|
+
edition = "2024"
|
|
8
|
+
rust-version = "1.99"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
|
|
11
|
+
[workspace.dependencies]
|
|
12
|
+
throttle-machines = { path = "ext/throttle_machines_native/core" }
|
|
13
|
+
matryona-machines = { version = ">=0.6", default-features = false }
|
|
14
|
+
magnus = { version = "0.9.3", default-features = false }
|
|
15
|
+
# Nothing here calls rb-sys directly: this is the compiled fallback that
|
|
16
|
+
# implements the stable API for a Ruby rb-sys ships no pre-generated bindings
|
|
17
|
+
# for, such as a preview. magnus asks for "stable-api" without it, and its
|
|
18
|
+
# default-features = false drops the default that would have supplied it.
|
|
19
|
+
rb-sys = { version = "0.9.130", default-features = false, features = ["stable-api-compiled-fallback"] }
|
|
20
|
+
|
|
21
|
+
[workspace.lints.rust]
|
|
22
|
+
unsafe_code = "deny"
|
|
23
|
+
unused_must_use = "warn"
|
|
24
|
+
missing_docs = "warn"
|
|
25
|
+
|
|
26
|
+
[workspace.lints.clippy]
|
|
27
|
+
all = { level = "warn", priority = -1 }
|
|
28
|
+
pedantic = { level = "warn", priority = -1 }
|
|
29
|
+
nursery = { level = "warn", priority = -1 }
|
|
30
|
+
unwrap_used = "deny"
|
|
31
|
+
expect_used = "deny"
|