struct Item
pub struct Item {
}Purpose
Item context or state structure.
Public fields
This type has no public fields.
#timerHigh-density timers for heartbeats / TTL / file RTO. time.AfterFunc / Ticker spawn one sleeper task each. A gateway holding 5k heartbeats must not own 5k tasks. v1 Wheel is **poll-based**: the caller owns the list (no `$&` across `xu`, S6). Typical use is one coordinator task w := timer.new w.after_ns(30 * time.millisecond) w.every_ns(time.second) for { id := w.run // sleeps until next deadline, returns due id... } A background `xu` wrapper can sit on top once channel-of-struct is proven on the self-host path.
struct Itempub struct Item {
}Item context or state structure.
This type has no public fields.
struct Wheelpub struct Wheel {
}Wheel context or state structure.
This type has no public fields.
newpub fn new() Wheelnew creates an empty wheel with 1 ms floor resolution.
No arguments are required.
Wheel — a value of this type
($&Wheel) after_nspub fn (w $&Wheel) after_ns(delay_ns int) intafter_ns arms a one-shot. Returns id (>0).
w $&WheelWheel instance used by this call (exclusive borrow).delay_ns intint — a value of this type
($&Wheel) every_nspub fn (w $&Wheel) every_ns(period_ns int) intevery_ns arms a repeating timer.
w $&WheelWheel instance used by this call (exclusive borrow).period_ns intint — a value of this type
($&Wheel) cancelpub fn (w $&Wheel) cancel(id int) boolcancel disarms. Returns true if the id was still armed.
w $&WheelWheel instance used by this call (exclusive borrow).id intbool — true or false
($&Wheel) try_duepub fn (w $&Wheel) try_due() inttry_due pops one due id without sleeping. 0 when none.
w $&WheelWheel instance used by this call (exclusive borrow).int — a value of this type
($&Wheel) runpub fn (w $&Wheel) run() intrun sleeps until the next deadline (or tick), then pops due ids. Returns 0 when nothing is armed (after sleeping one tick).
w $&WheelWheel instance used by this call (exclusive borrow).int — a value of this type