pub fn close(talk: &mut Talk, store: &Talks) -> Result<()>Expand description
Close a conversation. Idempotent: closing an already-closed conversation is not an error, since the operator’s intent - “I am done with this” - is already satisfied.
Re-reads the record under Talks::guard rather than trusting the
caller’s copy of talk, and writes that fresh copy back rather than the
one passed in. web::talk_close loads talk and calls this right after
with no gap of its own, but without the guard that load can still land
between a record or turn elsewhere reading the file and writing it
back - and a close built on the older snapshot would put it right back,
silently dropping whatever turn the other call had just appended.
If the re-read fails, this errors rather than falling back to the
caller’s stale copy: talk::begin always puts the record before handing
out a Talk, so the only way a re-read can fail is a concurrent
Talks::remove having deleted it, and writing the stale copy back would
resurrect exactly what that delete removed.