P3: the mesh bridge (bridge => true, export => mesh, inbound forwarding, D25 on the bridge only) #7
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Purpose (feature): one node per LAN cluster is the mesh bridge. Only it holds a mesh pool, a D25 claim and mesh advertisements. It serves the capabilities a service exports to the mesh by forwarding each call into the LAN, and the other nodes reach the mesh through it.
DECIDED 2026-12-02 "I have created and cloned macula-services/mcl-core. Let's build this properly. In the end I hope we keep a single repo: mcl-core that will replace both mcl-om and mcl-lan" (Raf)
DECIDED 2026-12-02 "trust on sight. mcl-martha services should auto-cluster over LAN, no mcl-station required. Distributed Erlang offers us all we need." (Raf)
DECIDED 2026-12-02 "Shared cookie + secret (Recommended)" (Raf)
Design: docs/DESIGN.md §3 and §5, and §9 "What P1 left". Refs #3 (P2, the LAN transport this builds on). P4 (#4) runs in parallel.
Scope
A node with the
lanapp envoffbehaves exactly as today (1.9.0 behaviour): it is its own bridge and advertises everything it hosts.On a node with the LAN on:
bridge: a new app env,trueon one node, defaultfalse. Only a bridge node starts the mesh pool (when seeds are set). The pool start moves frommcl_core_identityto the bridge side. A non-bridge LAN node is not refused for{mesh, required}without seeds or a realm, because the mesh is the bridge's.export => meshon a capability: the bridge advertises on the mesh only exported capabilities, under today's<org>/<name>with the capability's ownauth. These are the ones it hosts, plus those other cluster nodes host. Each node's served capability joins apgexport group carrying its spec without the handler, so the bridge learns them on its 30 s republish tick.callerset to the mesh caller's node id as macula verified it. The serving member's guard pipeline runs with that caller. The guard runs once per call, not twice, so rate limits are not halved. An exported capability the LAN cannot serve (realm-bound auth, streamer) is advertised with its own handler, and only from the bridge node.call_capabilityandpublishalready try the LAN first, then the bridge. On a non-bridge node, the bridge step is relayed to the bridge node over distribution. The mesh then sees the bridge's identity. With no bridge in the cluster, the answer is the one the bridge gives with no pool today.Out of P3 (named so nobody assumes it): mesh events are not republished onto the LAN. A mesh subscription runs only on the bridge node, for the bridge's own services. No tag: the 1.0.0 tag waits for Raf's yes via the Supervisor once P3 lands.
Files P3 touches (for the overlap check with P4)
src/contract/mcl_core_sup.erl: pool child only on a bridge (or LAN off); the bridge supervisor child.src/contract/mcl_core_identity.erl: pool start moved out; mesh-required check skipped on a non-bridge LAN node.src/contract/mcl_core.erl: claim per exported org; boot passes exports.src/contract/mcl_core_service.erl:exportin the capability type and docs.src/bridge/mcl_core_bridge.erl:bridge/0, outbound relay, pool start.src/bridge/mcl_core_capabilities.erl: advertise selection (exported only, with the LAN on), remote exports, forwarding handler.src/bridge/mcl_core_claim.erl: orgs from remote exports, if needed.src/bridge/mcl_core_bridge_inbound.erl(the forwarding handler),src/bridge/mcl_core_bridge_sup.erl(the bridge'spgscope and relay).src/lan/mcl_core_lan.erl: ONE new export, a LAN call made as a given caller (call_as/6). P4's entry point needs the same thing for a member's call, so P4 should reuse it rather than add a second one.src/lan/mcl_core_lan_capability.erl: join the export group ininit/1.test/mcl_core_bridge_SUITE.erl(peer nodes), eunit for the advertise selection and the relay;test/mcl_core_lan_SUITE.erluntouched.docs/DESIGN.md§9 (appended),CHANGELOG.md.P4 is expected in
src/lan/(entry point, members, tokens) andmcl_core_lan_sup.erl. P3 does not touchmcl_core_lan_sup.erl,mcl_core_lan_secrets.erl,mcl_core_lan_hosts.erlormcl_core_lan_node.erl.Done when
bridgefalse, no mesh pool child is started, no claim is sent, nothing is advertised,{mesh, required}does not refuse boot for missing mesh settings, and /health isok.export => meshcapabilities, its own and other nodes' (tested on the advertise selection; no real station).callerset to the given mesh caller, the payload's owncalleroverwritten, and the guard run once (peer-node test).{callers, {nodes, Ids}}on a forwarded call is decided against the mesh caller, not the bridge's node id (peer-node test).no_clientwith no bridge present (peer-node test with a stand-in mesh path).Landed: main
e728bd5926(fast-forward, PR 8). Review r=1 by Jupiter via Mars. PR CI on that tip: 6878-6881 green; 6882 is the accepted #2 scaffold-lint red. Main runs are being watched; this issue reopens on a red.Done when:
bridgefalse: no pool child (mcl_core_bridge_testssup children), no claim (claim_test_, anda_member_with_seeds_runs_no_pool_and_no_claim), nothing advertised (advertised_sets_test_),{mesh, required}not refused (identity_test_and the suite case, with a bridge refused as control), /healthok.export => mesh, own and other nodes' (mesh_sets_test_,an_exported_capability_is_forwarded_with_the_mesh_caller).calleroverwritten (an_exported_capability_is_forwarded_with_the_mesh_caller); guard runs once (the_guard_runs_once_on_a_forwarded_call).{callers, {nodes, Ids}}decided against the mesh caller (a_forwarded_call_is_admitted_against_the_mesh_caller).a_member_relays_its_mesh_traffic_to_the_bridge, stand-in mesh path on the bridge); with no bridge, the no-pool answer (with_no_bridge_a_member_answers_as_a_node_with_no_pool).claim_test_,the_bridge_claims_only_the_orgs_it_exportswith a standalone control).