Skip to main content

fetch_oneshot_types

Function fetch_oneshot_types 

Source
pub async fn fetch_oneshot_types(
    connection: &Connection,
    candidates: Vec<String>,
    per_unit_concurrency: u64,
) -> (HashMap<String, bool>, u64)
Expand description

Look up Service.Type for each candidate over D-Bus.

Service type is not exposed via the varlink metrics API, so the varlink path resolves it here to keep unhealthy in parity with the D-Bus path. (io.systemd.Unit.List does expose it as context.Service.Type, so this lookup can go away once monitord adopts that API — see #37.) Concurrency is bounded by per_unit_concurrency, like the D-Bus per-unit loop. A lookup failure for one unit is logged and omitted from the map (which apply_oneshot_types treats as “not oneshot”) rather than failing the whole collection, mirroring units::parse_state.

Returns the resolved types plus the number of successful lookups, so the caller can account this phase in UnitsCollectionTimings like any other per-service D-Bus work.