Skip to main content

persisted_peer_groups

Function persisted_peer_groups 

pub async fn persisted_peer_groups(
    config_path: &Path,
) -> Result<Option<HashMap<String, PeerGroupConfig>>, Error>
Expand description

The peer_groups table as it is on disk right now, or None when the file does not exist yet and the in-memory copy is all there is.

Only the policy table is taken. Reloading the whole Config would pull the secret, env-override and 1Password snapshot state that save depends on through a second decrypt cycle, and a peer-group write has no business rewriting any of it.

Every writer of a peer group needs this: the daemon gives the gateway, the RPC path and the channels separate Config copies of the same file, so holding the shared write lock is not sufficient on its own. A handle’s peer_groups can be older than what another writer already saved, and the write would then check policy against stale state and persist it back over the newer table.