1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! One bounded unit of owner-local work.
use crate::;
/// A hostable owner that performs one bounded turn at a time.
///
/// A reactor may implement this trait, but the trait does not require I/O,
/// readiness, sockets, or any other reactor-specific mechanism. State
/// machines, compaction loops, worker coordinators, and maintenance owners can
/// use the same host.
///
/// # Contract
///
/// Each call must return after bounded work, must not hide an unbounded wait,
/// and must report the owner's complete current [`Turn`] interest. Returning
/// [`crate::Next::Stop`] permanently ends this duty's hosted lifecycle.
///
/// The supplied [`Moment`] is authoritative for one invocation. Every deadline
/// comparison, timeout decision, behavior-changing state transition or
/// timestamp, and returned [`crate::Next`] must derive from that observation.
/// A duty must not sample a wall or monotonic clock during `turn`: time may
/// advance between invocations, but not within one logical turn.
///
/// After `turn` returns, the host may observe its clock again to account for
/// execution time and calculate the actual wait duration.