pub struct GrantsGeneration { /* private fields */ }Expand description
BIDIR-8 (BIDIR-5’s finding): the grants generation — a count every
write that could change one of the gate’s answers moves
(GrantsMove). It is the gate’s: whoever holds an answer across time
(a duplex call’s caller, a watch) records the generation it was decided
at and asks the gate again only when it has moved — once per move, never
per item. Cheap to clone (two Arcs, one count); a read is one atomic
load; a move wakes every subscriber.
A service shares one across its gates with Gate::with_generation
(menger: the gate in front of its calls, the access layer’s and the store’s count are
one).
Implementations§
Source§impl GrantsGeneration
impl GrantsGeneration
Sourcepub fn bump(&self) -> u64
pub fn bump(&self) -> u64
Something that could change an answer moved: +1, and every subscriber woken. Answers the generation now.
Sourcepub fn on_move(told: fn(u64))
pub fn on_move(told: fn(u64))
KEEL-59 (N2): told(generation) is called, in the moving task, with
every generation a bump makes — before anything
subscribed to it wakes. Set once per process (plexus-core sets it,
so the call whose own write moved the grants is not ended by that
move); a later call is ignored.
Sourcepub fn moved(&self, why: GrantsMove) -> u64
pub fn moved(&self, why: GrantsMove) -> u64
bump, naming what moved (for the reader; the count
is one either way).