Skip to main content

Module capability

Module capability 

Source
Expand description

Capabilities a service provides to other services.

Dispatch sites that ask “is service X installed?” almost always actually mean “is there an installed service that plays role Y?” — modeling that question as a typed Capability lookup decouples integration glue from hardcoded service names. New providers (a different reverse proxy, a different OIDC IdP, an external SMTP relay) drop in without the auth bridge / Caddy patcher / network-join logic having to learn their names.

Today the provider→capability mapping comes from [crate::WellKnownService::capabilities] (a static map). Step 2 of the migration moves the declaration into each service’s service.toml and persists it through metadata.toml so InstalledService can report capabilities without core knowing the service name.

Enums§

Capability
A role a service can play for other services. Pattern-match exhaustively — adding a new variant forces every dispatch site to think about it.

Functions§

any_installed_provider
Convenience: check live install state via crate::list_installed for whether any provider of cap is currently installed. Use this at planning sites that don’t already have an installed: &[…] slice in scope — anything inside crate::auth_bridge takes the slice as a parameter and should call find_installed_provider instead.
def_provides
Capability list declared by a [ServiceDef]. Use this when the def is already in scope (e.g. in add_service after find_service) — it avoids the registry round-trip that service_provides does.
find_installed_provider
Find an installed service that provides the given capability. Returns the first match — capabilities like Capability::ReverseProxy are expected to have at most one provider installed at a time, but we don’t enforce that yet (a future “multiple OIDC providers” world is the caller’s problem to resolve).
installed_provides
Whether an InstalledService provides the given capability. Reads from the persisted snapshot in metadata.toml (hydrated into InstalledService::provides at crate::list_installed time).
service_provides
Whether a service named name provides the given capability, resolved by reading its [capabilities] provides declaration from the cached default registry on disk.