Commit db836b7
authored
fix(mesh): publish the estate so every transport can report it (#2309)
The peer sync loop is started only by _serve_http, and the estate it
builds (_PEER_SYNC_STATE, _KNOWN_PROFILES) is process memory. But
mempalace_mesh_peers ships in every transport, including the stdio
servers agents connect through, and those processes never run a sync
round.
So they answered from a permanently empty estate: every peer reduced to
a bare name and url with no reachable, last_success_at,
remote_version_vector or profile; origin_profiles holding only this
node; and configured peers reported as unnamed_origins -- "known only
transitively" -- because their replica_id is learned during a sync and
nothing else supplies it. The hub next door had all of it.
The sync loop now publishes the estate to mesh_state.json in the
per-palace server state directory after every round, alongside the
token and serverinfo that already use that directory for exactly this
"hub records something other local processes read" purpose. 0600, and
written to a temp name then renamed so a reader in another process
never observes a half-serialized estate.
_mesh_peers_payload merges the published estate underneath any
in-process state, per peer, so the process that actually syncs keeps
reporting its own fresher observation and every other process reports
the hub's instead of nothing.
The new estate_source field says where the reading came from:
in_process, published_at, and whether the publishing hub is still
alive. A crashed hub leaves a last-known-good estate, which is worth
showing -- "last seen as" beats a blank node -- but must not be read as
live.
peers.json tokens are not in the estate and never reach the file; both
are asserted.1 parent c860fb1 commit db836b7
4 files changed
Lines changed: 332 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4854 | 4854 | | |
4855 | 4855 | | |
4856 | 4856 | | |
4857 | | - | |
| 4857 | + | |
4858 | 4858 | | |
4859 | 4859 | | |
4860 | 4860 | | |
| |||
7234 | 7234 | | |
7235 | 7235 | | |
7236 | 7236 | | |
7237 | | - | |
7238 | | - | |
7239 | | - | |
7240 | | - | |
| 7237 | + | |
| 7238 | + | |
| 7239 | + | |
| 7240 | + | |
| 7241 | + | |
| 7242 | + | |
| 7243 | + | |
| 7244 | + | |
| 7245 | + | |
| 7246 | + | |
| 7247 | + | |
7241 | 7248 | | |
7242 | 7249 | | |
7243 | 7250 | | |
7244 | 7251 | | |
7245 | 7252 | | |
7246 | 7253 | | |
7247 | 7254 | | |
| 7255 | + | |
| 7256 | + | |
| 7257 | + | |
| 7258 | + | |
| 7259 | + | |
| 7260 | + | |
| 7261 | + | |
| 7262 | + | |
| 7263 | + | |
| 7264 | + | |
| 7265 | + | |
| 7266 | + | |
| 7267 | + | |
| 7268 | + | |
| 7269 | + | |
| 7270 | + | |
| 7271 | + | |
| 7272 | + | |
| 7273 | + | |
| 7274 | + | |
| 7275 | + | |
| 7276 | + | |
| 7277 | + | |
| 7278 | + | |
| 7279 | + | |
| 7280 | + | |
| 7281 | + | |
| 7282 | + | |
| 7283 | + | |
| 7284 | + | |
| 7285 | + | |
| 7286 | + | |
| 7287 | + | |
| 7288 | + | |
| 7289 | + | |
| 7290 | + | |
7248 | 7291 | | |
7249 | 7292 | | |
7250 | 7293 | | |
| |||
7298 | 7341 | | |
7299 | 7342 | | |
7300 | 7343 | | |
| 7344 | + | |
| 7345 | + | |
| 7346 | + | |
| 7347 | + | |
| 7348 | + | |
| 7349 | + | |
| 7350 | + | |
7301 | 7351 | | |
7302 | 7352 | | |
7303 | 7353 | | |
7304 | 7354 | | |
7305 | | - | |
| 7355 | + | |
7306 | 7356 | | |
7307 | 7357 | | |
7308 | 7358 | | |
| |||
7320 | 7370 | | |
7321 | 7371 | | |
7322 | 7372 | | |
7323 | | - | |
| 7373 | + | |
7324 | 7374 | | |
| 7375 | + | |
| 7376 | + | |
| 7377 | + | |
| 7378 | + | |
| 7379 | + | |
| 7380 | + | |
| 7381 | + | |
| 7382 | + | |
| 7383 | + | |
7325 | 7384 | | |
7326 | 7385 | | |
7327 | 7386 | | |
| |||
7373 | 7432 | | |
7374 | 7433 | | |
7375 | 7434 | | |
| 7435 | + | |
| 7436 | + | |
| 7437 | + | |
7376 | 7438 | | |
7377 | 7439 | | |
7378 | 7440 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
44 | 49 | | |
45 | 50 | | |
46 | 51 | | |
| |||
88 | 93 | | |
89 | 94 | | |
90 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
91 | 171 | | |
92 | 172 | | |
93 | 173 | | |
| |||
0 commit comments