priority_machines 0.6.1 → 0.6.2
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 +1 -1
- data/ext/priority_machines_native/ffi/src/lib.rs +12 -6
- data/lib/priority_machines/version.rb +1 -1
- data/sig/priority_machines.rbs +5 -3
- 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: '02686a9daa629e5629197cd35537411ccc1f42d3319645bd84746b903226336b'
|
|
4
|
+
data.tar.gz: ac9fe0cefc5c9100fb244dcbe6a7bd0fdf42d11431ed1b512fbd57883433b06b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9c519ac78a7258031345bee962c0deffdc46ceab414c640a5bc0c7f160e6aefbd27abc3c42a62e9ba33c53daf9507dd98aa07149c7a898cee3e9f67115fbb63f
|
|
7
|
+
data.tar.gz: '07529e51c9c765fb4579293d49a8dcf2adf9d15c1c2d8dffb22fb4f6731424d8ba550c69dfa65dded14826b1ed384f426442c27377626e98dda520a3bd2127d3'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.6.2](https://github.com/seuros/priority_machines/compare/priority_machines/v0.6.1...priority_machines/v0.6.2) (2026-11-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* order every sibling instant as a deadline ([774eee5](https://github.com/seuros/priority_machines/commit/774eee5cd29bc27963d7901f91fe006765b19d16))
|
|
9
|
+
|
|
3
10
|
## [0.6.1](https://github.com/seuros/priority_machines/compare/priority_machines/v0.6.0...priority_machines/v0.6.1) (2026-11-16)
|
|
4
11
|
|
|
5
12
|
|
data/README.md
CHANGED
|
@@ -206,7 +206,7 @@ A call that is honoured answers with a value. A call that is not honoured answer
|
|
|
206
206
|
- **Positional, like the core.** `WeightedRoundRobin.new(weights)`, `DeficitRoundRobin.new(quanta)`, `RoundRobin.new`. There are no keywords and no defaults.
|
|
207
207
|
- **Weights, quanta and costs are positive Integers** up to `4_294_967_295`. Floats raise `TypeError`. Zero, negatives and anything larger raise `RangeError`.
|
|
208
208
|
- **Ready flags are real booleans.** Anything that isn't `true` or `false` raises `TypeError`, `nil` included.
|
|
209
|
-
- **Time is Integer nanoseconds.** Deadlines are instants on one monotonic clock, `0..2**64-1`,
|
|
209
|
+
- **Time is Integer nanoseconds.** Deadlines are instants on one monotonic clock over the whole Rust `Duration` range, `0..Duration::MAX` nanoseconds (about `1.8e28`), or `nil`, so an instant a sibling gem answers past `2**64-1` (batch's `deadline`, dedup's `expires`) is a deadline here too. A Float or any other non-Integer raises `TypeError`; a negative value or one past the range raises `RangeError`. Only the stateless `earliest_deadline` takes time; no scheduler reads or stores a clock.
|
|
210
210
|
- **A refusal is a symbol, and nothing changed.** `:unknown_lane` leaves the scheduler exactly as it was. A lane index is any Integer in `0..2**64-1`; one that is not a lane is refused, not raised.
|
|
211
211
|
- **A repeat is honoured.** Deactivating a lane that holds nothing answers `:idle` and changes nothing. The scheduler can prove it from its own state: the lane has no credit and is not mid-visit. A lane is mid-visit only when the scheduler points at it and this visit has already served it a turn (weighted) or paid it its quantum (deficit); a lane that is merely next in line holds nothing, so deactivating it never costs it its place.
|
|
212
212
|
- **No handles.** Lanes are indices you chose, not ids the scheduler issued, so there is nothing to scope and nothing to resume after a restart: build a fresh scheduler.
|
|
@@ -4,10 +4,8 @@ mod init;
|
|
|
4
4
|
mod round_robin;
|
|
5
5
|
mod scheduler;
|
|
6
6
|
|
|
7
|
-
use
|
|
8
|
-
|
|
9
|
-
use magnus::{Error, RArray, Ruby, Value};
|
|
10
|
-
use matryona_machines::ruby::{exact_array_with, integer, optional};
|
|
7
|
+
use magnus::{Error, RArray, Ruby, Value, prelude::*};
|
|
8
|
+
use matryona_machines::ruby::{exact_array_with, instant, integer};
|
|
11
9
|
use priority_machines::{Deactivation, Refusal};
|
|
12
10
|
|
|
13
11
|
/// `value` as exactly an `Array` (no subclass), `TypeError` naming the
|
|
@@ -37,10 +35,18 @@ matryona_machines::symbols! {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
pub(crate) fn earliest_deadline(ruby: &Ruby, deadlines: Value) -> Result<Option<usize>, Error> {
|
|
40
|
-
// Convert the complete call before entering the core.
|
|
38
|
+
// Convert the complete call before entering the core. A deadline is an
|
|
39
|
+
// instant over the whole `Duration` range, so every instant a sibling gem
|
|
40
|
+
// answers as `now + span` (past `u64` included) orders here.
|
|
41
41
|
let deadlines = array(ruby, deadlines, "deadlines")?
|
|
42
42
|
.into_iter()
|
|
43
|
-
.map(|value|
|
|
43
|
+
.map(|value| {
|
|
44
|
+
if value.is_nil() {
|
|
45
|
+
Ok(None)
|
|
46
|
+
} else {
|
|
47
|
+
instant(value, "deadlines").map(Some)
|
|
48
|
+
}
|
|
49
|
+
})
|
|
44
50
|
.collect::<Result<Vec<_>, Error>>()?;
|
|
45
51
|
Ok(priority_machines::earliest_deadline(&deadlines))
|
|
46
52
|
}
|
data/sig/priority_machines.rbs
CHANGED
|
@@ -20,9 +20,11 @@ module PriorityMachines
|
|
|
20
20
|
# progress), and nothing changed.
|
|
21
21
|
type deactivation = :deactivated | :idle
|
|
22
22
|
|
|
23
|
-
# Deadlines are Integer nanoseconds on one monotonic clock,
|
|
24
|
-
#
|
|
25
|
-
#
|
|
23
|
+
# Deadlines are Integer nanoseconds on one monotonic clock, over the whole
|
|
24
|
+
# Rust Duration range 0..Duration::MAX (past 2**64-1 included, so every
|
|
25
|
+
# instant a sibling gem answers as `now + span` orders here), or nil for a
|
|
26
|
+
# lane with nothing: TypeError for a Float or any other non-Integer,
|
|
27
|
+
# RangeError outside the range. Never refuses: the lane with
|
|
26
28
|
# the earliest deadline (lowest index on a tie), or nil when none has one.
|
|
27
29
|
def self.earliest_deadline: (Array[Integer?] deadlines) -> Integer?
|
|
28
30
|
|