Expand description
§rsynko-session
rsynko-session states the relation between what is intended and what is happening. A collection states that a request wants work done; the world holds runs — threads, processes, anything this program cannot reach into. Attendance is the reconciliation of the two, and it is the same reconciliation whether the run downloads a resource, transfers a folder, or reads what a source offers.
Attendance is not recorded twice. A request that has a run is no longer one that wants a run, so what the requests themselves state is the whole record of what is running.
§Specification surface
An interpreter states five sorts through SessionSorts — the request identity, the run, what a run says, how it ends, and how it refuses — and implements four capabilities over them:
UndertakingAlgstates which requests want work and what beginning it is;RunReadAlgstates whether a run is over, what it has said since it was last read, and how it ended;RunHoldAlgholds a run still, lets it go, and tells one nobody wants to end;AttentionAlgstates what all of that means to whoever asked, and reads back what they want now asWanted.
Time is read through ClockAlg, so how long a run has been running is a statement about a clock the interpreter supplies. Attending carries one run together with the time it has spent running and held still.
§Attention
SessionExt::attend is one pass of attention, derived from those capabilities and stating nothing of its own beyond the order it takes them in. A program written over the same capabilities composes with it:
use alux_ext::ext;
use rsynko_session::*;
#[ext(name = ExampleSessionExt)]
impl<This> This
where
This: UndertakingAlg + RunReadAlg + RunHoldAlg + AttentionAlg + ClockAlg,
{
/// Attends until nothing is running and nothing is left wanting to run.
fn example_attend_until_settled(
&mut self,
running: &mut Vec<Attending<This::Id, This::Run, This::Moment>>,
) {
while !running.is_empty() || !self.unattended().is_empty() {
self.attend(running);
}
}
}The order that pass takes is the meaning it adds. Ending comes before beginning, so leaving never races starting. A run is seen to be over before it is read, so everything it wrote before ending is read. What it said is stated before how it ended, so nothing it said is lost to the ending that followed it. And a run nobody wants is told to end on every pass until it is over, because a run that has not begun yet cannot be told to stop.
Leaving is not a separate path: an interpreter whose Wanted answers Unwanted once the reader is leaving ends every run through the ordinary pass.
§Laws
SessionLaws::session_laws checks all of that against any interpreter, over the runs a SessionLawFixture authors, reading back what each request was told as Telling.
Macros§
- ambassador_
impl_ Attention Alg - A macro to be used by
ambassador::Delegateto delegateAttentionAlg - ambassador_
impl_ Clock Alg - A macro to be used by
ambassador::Delegateto delegateClockAlg - ambassador_
impl_ RunHold Alg - A macro to be used by
ambassador::Delegateto delegateRunHoldAlg - ambassador_
impl_ RunRead Alg - A macro to be used by
ambassador::Delegateto delegateRunReadAlg - ambassador_
impl_ Undertaking Alg - A macro to be used by
ambassador::Delegateto delegateUndertakingAlg
Structs§
- Attending
- Denotes one run, and the time it has spent running and held still.
Enums§
- Telling
- Denotes one thing a request was told about the run working on its behalf.
- Wanted
- Denotes what a request wants of the run working on its behalf.
Traits§
- Attention
Alg - Specifies what beginning, saying, running, and ending mean to whoever asked for the work.
- Clock
Alg - Specifies reading the passage of time.
- RunHold
Alg - Specifies holding one run still, letting it go again, and ending one nobody wants.
- RunRead
Alg - Specifies reading one run while it happens, and ending it once it is over.
- Session
Ext - Derives one pass of attention from beginning, reading, holding, and ending runs.
- Session
LawFixture - Supplies the runs an attendance scenario cannot author for itself.
- Session
Laws - Authors the attendance laws.
- Session
Sorts - The sorts of running work — the type families the attendance classes share.
- Undertaking
Alg - Specifies which requests want work done, and what beginning it is.