bus5 B5 (A-107): the keeper's process answers mesh-broker's snapshot verbs itself through AnswerSeat

snapshot-get, snapshot-restore, snapshot-restore-cancel and snapshot-remove are answered by
the keeper's process with the proved caller; it publishes snapshot-get's chunks and hears
their acks on its own subscription, and acts at once with no hand-over through requests
(the record of a running restore is written before it runs). The tools bundle keeps its
tools, nats_snapshots among them. The protected refusal and the whole test's case (send,
restore in place, removal) stay.

Builds: design 47 G A-107 (G-20-lead-answers), §681

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-11 23:56:06 +01:00
parent a9dfe77b1d
commit 44cb7ad449
8 changed files with 378 additions and 254 deletions
+12
View File
@@ -111,6 +111,18 @@ func (k *Keeper) startRestore(r *Request) (string, error) {
k.restoring = run
k.mu.Unlock()
r.ActID = run.act
// The act's record is written before the restore runs, as the end of the restore and a restart's cut-off read it; a record that
// cannot be written ends the start, so no restore runs that nothing could find again.
held := *r
held.Done, held.Outcome = k.now(), "accepted"
data, _ := json.Marshal(held)
if _, err := k.Store.Put(StateRequests, r.ID, data); err != nil {
k.mu.Lock()
k.restoring = nil
k.mu.Unlock()
cancel()
return "error", fmt.Errorf("the restore's record cannot be written, so nothing is restored: %w", err)
}
k.record(r, fmt.Sprintf("restores the snapshot of the request %s (%s) in place", rec.ID, rec.Path))
go k.restore(ctx, run, rec, r.Caller, r.Why)
return "accepted", nil