Expand description
Operator-declared instance registry. Step 3 of browser-multi-instance.
Maps each instance label (operator YAML browser[].instance) to its
Arc<BrowserPlugin> — one Chrome handle per declared instance.
Mirrors the multi-instance pattern from
nexo-rs-plugin-whatsapp/src/bot_registry.rs:28:
OnceLock<Arc<DashMap<String, ...>>> — same Arc<DashMap> instance
shared across the boot loop (on_configure), the dispatch resolver
(dispatch::resolve_plugin, Step 5), and admin RPC handlers
(admin::list_instances, Step 7).
This registry coexists with the legacy per-agent_id PROFILES
map in main.rs (Phase 81.17.c.multi-profile). When the registry
is empty, dispatch falls back to the legacy map; when populated,
it wins.
Functions§
- clear
- Drop every entry. Used by tests; production callers should diff
against
entriesand unregister individual labels so live Chromes can be shut down cleanly. - entries
- Snapshot every
(label, plugin)pair. Useful for the dispatcher’s “exactly-one-declared” compat shim + adminlist_instances. - len
- Number of declared instances. O(1).
- lookup
- Look up the live
Arc<BrowserPlugin>forlabel. - register
- Register
pluginunderlabel. Overwrites any prior entry — callers that need diff-aware behaviour (the boot loop) compare againstentriesbefore re-registering. - unregister
- Drop the entry for
label. Returns the priorArc<BrowserPlugin>so the caller can.shutdown_chrome().awaiton the removed value.