pub fn lock_session(
id: &str,
continued: bool,
kind: &str,
) -> Result<Option<SessionLock>, RuntimeError>Expand description
The session lock for a boot() host that drives Runtime itself (rpc,
synaps server). Continuing a session that another process (a TUI, the
daemon, another rpc) holds is REFUSED: two writers would fork its history
and the older one’s saves would overwrite the newer’s. So is continuing
a session already compacted into a successor (its history is closed). A
fresh session, or a lock that cannot be taken for another reason (e.g. a
read-only sessions dir), proceeds best-effort, as the session actor does.
The lock is held for the returned value’s lifetime; a holder that
continued a session runs crash recovery (recover_turn_draft).