pub async fn run_session<S>(
stream: S,
replica: &Mutex<Replica>,
workspace_id: GrainId,
) -> Result<SessionOutcome>Expand description
Run a session to completion.
Returns once both sides have said Done and Settled and every piece of content this
side asked for has been answered — with the bytes, or with Missing. A stream that ends
first returns without an error, but commits nothing.
replica is locked for each step that touches it, never across a wait on the peer — not
for its Hello (issue #163), and not while content is in flight. A caller that used to
pre-lock a Mutex<Replica> around the whole call should stop: passing the mutex itself
is what leaves the replica free for a scan or another session meanwhile.
A peer that stops making progress is given up on after IDLE_TIMEOUT with
Error::Protocol; nothing bounds the session’s total length.
S must be 'static because the write half is moved into a task; a stream owned by the
caller (a socket, a spliced pipe, a duplex) is.