refresh_machines 0.7.3-x86_64-linux → 0.7.4-x86_64-linux
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 +7 -0
- data/README.md +2 -2
- data/lib/refresh_machines/version.rb +1 -1
- data/lib/refresh_machines.rb +5 -5
- data/lib/refresh_machines_native/refresh_machines_native.so +0 -0
- data/sig/refresh_machines.rbs +7 -5
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9e51894ecd148876860c81f0560e4cbc336fd4a6a6468c4672ff60b75c58d757
|
|
4
|
+
data.tar.gz: d9ccb59d820dfdf9f25e0f1e07b3b48d942cfe3f5817d4c3d7fe4898520b967c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '093a2a59a70c6465ebcb5838fa6755b1f24ea12329825a479f0a3d245c99a24d95fdcd86e2ff597fd91145d45767926ab4cd88c622637a2a6dec5ae42e2ea31b'
|
|
7
|
+
data.tar.gz: 8b25ec80f1c9ed4156c9713a1a72728a5f601cf426b5f2e8a3ee271142ebc6b613fab42b172bcb36b5842c5c2bbc4a341c42507ac41af492ba59cefd02d0257f
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.4](https://github.com/seuros/refresh_machines/compare/refresh_machines/v0.7.3...refresh_machines/v0.7.4) (2026-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* accept every age the gem returns ([a09310d](https://github.com/seuros/refresh_machines/commit/a09310d1bed8a0c08e8f78c4e69ad94e459f8fd2))
|
|
9
|
+
|
|
3
10
|
## [0.7.3](https://github.com/seuros/refresh_machines/compare/refresh_machines/v0.7.2...refresh_machines/v0.7.3) (2026-11-16)
|
|
4
11
|
|
|
5
12
|
|
data/README.md
CHANGED
|
@@ -289,11 +289,11 @@ refresher.decide(1, t0, 0) # => :zero_lead, a zero lease is overdue
|
|
|
289
289
|
|
|
290
290
|
## The Rules of the Quartermaster
|
|
291
291
|
|
|
292
|
-
- **Everything is an Integer** in `0..2**64-1`, except instants (below). Floats, nil and strings raise `TypeError`. Out of range raises `RangeError`. A policy argument that isn't a `Policy` raises `TypeError`. An id the refresher could never have issued, one whose sequence (the low 48 bits) is zero, raises `RangeError` wherever a lease or waiter id is taken (`store`, `fail`, `abandon`, `cancel`, `flight`), before the refresher is asked.
|
|
292
|
+
- **Everything is an Integer** in `0..2**64-1`, except instants and ages (below). Floats, nil and strings raise `TypeError`. Out of range raises `RangeError`. A policy argument that isn't a `Policy` raises `TypeError`. An id the refresher could never have issued, one whose sequence (the low 48 bits) is zero, raises `RangeError` wherever a lease or waiter id is taken (`store`, `fail`, `abandon`, `cancel`, `flight`), before the refresher is asked.
|
|
293
293
|
- **Values are valid or do not exist.** Every Data value checks itself through the core when it is built, by the gem or by hand: `Policy` windows in `0..2**64-1`; `Fresh#age`, `Stale#age` and `Backoff#until` Integer nanoseconds up to the core's `Duration::MAX`; a `Stale#revalidation` that is a `Lead`, `:in_flight`, a `Backoff` or an `Unavailable`; lease, waiter and flight ids with a nonzero sequence; a `Wait` or `Notification` whose waiter is of its flight's scope and issued after it; an `Unavailable#refusal` that is a refusal symbol; an `outcome` of `:completed` or `:abandoned`. The wrong type raises `TypeError`, a value outside that `RangeError`: `Fetch.new(0)`, `Wait.new(2, 3)` and `Unavailable.new(:nope)` raise.
|
|
294
294
|
- **The binding never loses work.** Every argument is converted before the core is called, and every class was resolved once, when the extension loaded. A mutating call whose answer is a Ruby object (`decide`, `sweep`, `poll`, `drain`) decides on a copy of the refresher and keeps it only once the answer is built, natively (allocate, fill, freeze, no Ruby `initialize`); `drain` and `sweep` read into a buffer first. Frozen meanwhile is `FrozenError`, changed meanwhile `RuntimeError`; a call that raises changed nothing.
|
|
295
295
|
- **Values are sealed, and the binding is the authority.** Subclassing a value class raises `TypeError` and `allocate` is undefined. Sealing stops accidents, not reflection (a named subclass's constant is bound before the raise, `Marshal.load` skips `initialize`), so a value the binding reads (a `Policy`, a `Stale`'s revalidation) must be an instance of exactly its class, and its fields are checked again: a forged one raises `TypeError` or `RangeError`.
|
|
296
|
-
- **Time is Integer nanoseconds.** Instants (`now`, `Backoff#until`) and spans (ages, the three policy windows, `lead_for`, `retry_after`) alike, in and out. A Float, a Rational or anything else that isn't an Integer raises `TypeError`.
|
|
296
|
+
- **Time is Integer nanoseconds.** Instants (`now`, `Backoff#until`) and spans (ages, the three policy windows, `lead_for`, `retry_after`) alike, in and out. A Float, a Rational or anything else that isn't an Integer raises `TypeError`. `now` and an age argument (`put`, `store`, `Policy#state`, `#while_revalidate?`, `#if_error?`) run over the whole Rust `Duration` range, `0..Duration::MAX` nanoseconds (about `1.8e28`), so every `Backoff#until` the refresher answers reads back as `now` and every age it answers (`age`, `fail`, `stale_if_error`, `Fresh#age`, `Stale#age`) reads back as an age. The other spans (the policy windows, `lead_for`, `retry_after`) are in `0..2**64-1`. Outside its range a value raises `RangeError`. Nothing wraps: a returned age or `Backoff#until` is the exact sum, even past `2**64-1`.
|
|
297
297
|
- **Refusals don't raise.** `:time_regressed`, `:zero_lead`, `:entries_full`, `:flights_full`, `:waiters_full`, `:exhausted` and `:stale` are answers, and a refused call changes nothing.
|
|
298
298
|
- **Every answer, by method.**
|
|
299
299
|
|
data/lib/refresh_machines.rb
CHANGED
|
@@ -13,11 +13,11 @@ module RefreshMachines
|
|
|
13
13
|
# Every instant and span in this gem is Integer nanoseconds: `now` as read
|
|
14
14
|
# from `Process.clock_gettime(Process::CLOCK_MONOTONIC, :nanosecond)`, and
|
|
15
15
|
# every age, window, `lead_for`, `retry_after` and `Backoff#until`.
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
# past 2**64-1, up to
|
|
20
|
-
# wrapping.
|
|
16
|
+
# `now` and age arguments are in 0..`Duration::MAX`, so every instant and
|
|
17
|
+
# age the refresher answers reads back; the other span arguments, and the
|
|
18
|
+
# Policy windows, are in 0..2**64-1. An age or instant the core answers
|
|
19
|
+
# (Fresh, Stale, Backoff, `fail`, `age`) may be past 2**64-1, up to
|
|
20
|
+
# `Duration::MAX`, because sums saturate instead of wrapping.
|
|
21
21
|
Policy = Data.define(:fresh_for, :stale_while_revalidate, :stale_if_error) do
|
|
22
22
|
def initialize(fresh_for:, stale_while_revalidate:, stale_if_error:)
|
|
23
23
|
RefreshMachines.__send__(:__policy, fresh_for, stale_while_revalidate, stale_if_error)
|
|
Binary file
|
data/sig/refresh_machines.rbs
CHANGED
|
@@ -2,11 +2,13 @@ module RefreshMachines
|
|
|
2
2
|
VERSION: String
|
|
3
3
|
|
|
4
4
|
# Every instant (`now`, `Backoff#until`) and span (ages, policy windows,
|
|
5
|
-
# `lead_for`, `retry_after`) is Integer nanoseconds. A
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
# included) reads back
|
|
9
|
-
#
|
|
5
|
+
# `lead_for`, `retry_after`) is Integer nanoseconds. A `now` or age argument
|
|
6
|
+
# (`put`, `store`, Policy#state, #while_revalidate?, #if_error?) may be
|
|
7
|
+
# anything in 0..Duration::MAX, so every instant and age the refresher
|
|
8
|
+
# answers (past 2**64-1 included) reads back. The other span arguments
|
|
9
|
+
# (policy windows, `lead_for`, `retry_after`) must be in 0..2**64-1. A
|
|
10
|
+
# returned sum may be larger than 2**64-1, up to the core's Duration::MAX;
|
|
11
|
+
# it never wraps.
|
|
10
12
|
#
|
|
11
13
|
# Every Data value validates when built, by the gem or by hand: TypeError
|
|
12
14
|
# for the wrong type, RangeError for a value the core rejects.
|