diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 20:46:28 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-09-27 20:55:19 -0300 |
| commit | cca47d63c3ba774cb4de6f76603ba6edc5b475fe (patch) | |
| tree | a0e7c45ba191155be232240dbf53c9ae34f209ba /docs | |
| parent | 82d8152cd15ea3ddd238caec2072bc2a1327a578 (diff) | |
| download | cloud9-cca47d63c3ba774cb4de6f76603ba6edc5b475fe.tar.gz cloud9-cca47d63c3ba774cb4de6f76603ba6edc5b475fe.zip | |
fs: a backend can keep a parked request by ticket and answer it later, and a clunk interrupts what is parked on its fid
A backend holding a read that has nothing yet had to find its park by
walking the engine's slots and matching a tag. Now Conn.hold() answers
.again and returns a Ticket (slot and that park's sequence number);
Conn.waiting() says whether that very park still waits, and
Conn.answerWith() answers it with what a producer makes, asking the
producer only while it waits and under the same lock, the way lib9p lets
a server keep a Req and respond() later, so a consuming answer is never
spent on a flushed request. The sequence number counts on across the
connections a runner slot serves (initIn keeps it), so a ticket of one
never names a park of the next. A clunk or remove fails everything
parked on its fid with EINTR first, so no slot outlives its fid to be
retried with a released handle or answered to a fid of the same number
walked anew; retry's check for a vanished fid is gone with it. 9ns maps
acme's "shut down" to EIO.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/design.md | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/docs/design.md b/docs/design.md index 702315b..e8805e5 100644 --- a/docs/design.md +++ b/docs/design.md @@ -101,7 +101,14 @@ round, oldest first, until it completes; a parked write keeps a copy of its data up to `park_data_max` bytes. Any other operation answering `again`, or a park with no free slot, fails with EAGAIN. Tflush answers a parked request's tag with EINTR before its Rflush and drops the slot; a flush of an -unknown tag is just Rflush. `hangup()` marks every open fid orphaned and +unknown tag is just Rflush. A clunk or remove of a fid does the same to +everything parked on it first, so no slot outlives its fid. Instead of +waiting to be retried, a backend may keep a parked request and answer it +itself (lib9p's kept Req): `ticket()` names the park by its slot and that +park's sequence number, `waiting()` says whether it still waits (not +flushed, clunked, hung up or out being retried), and `answer()` answers it +only then, so a tag a client reuses after a flush is never answered with +what was meant for the old one. `hangup()` marks every open fid orphaned and `next()` then yields the release each one owes before anything else, so a dropped connection still pays the backend; a Tversion does the same before negotiating. @@ -157,7 +164,14 @@ the connection's task with the engine unlocked and answers with engine over between `Conn.lock()` and `Conn.unlock()`, drives `next()`, `retry()` and `reply()` itself and calls `Conn.flush()` so the connection task sends what that produced (the editor answers on its own thread this -way). `opened` and `closed` bracket a slot's life; `Conn.user` is the +way). `Conn.hold()` answers `.again` and returns the park's ticket; +`Conn.waiting()` says whether it still waits, and `Conn.answerWith()` +answers it later from anywhere with what a producer makes, asking the +producer only while the park still waits and under the same lock, so an +answer that consumes (a record off a queue) is never spent on a flushed +request. The engine's sequence number counts on across the connections a +slot serves (`initIn` keeps it), so a ticket of one never names a park of +the next. `opened` and `closed` bracket a slot's life; `Conn.user` is the application's. Wake-up is explicit. Each connection has a flag word and an `Io.Event`; the |
