Skip to main content

attach_legacy_adapter

Function attach_legacy_adapter 

Source
pub async fn attach_legacy_adapter<F, Fut>(
    pool: &Arc<ResourcePool>,
    adapter_name: &str,
    phase: &str,
    key_extras: &[(&str, &str)],
    factory: F,
) -> Result<(Arc<dyn DriverAdapter>, AttachGuard), String>
where F: FnOnce() -> Fut + Send + 'static, Fut: Future<Output = Result<Arc<dyn DriverAdapter>, String>> + Send + 'static,
Expand description

Push A high-level helper for the executor: attach a legacy adapter through the pool under PerPhase policy and return both the unwrapped Arc<dyn DriverAdapter> and the corresponding AttachGuard.

The guard MUST outlive any use of the returned adapter reference — typically the caller stores it alongside the activity and drops it at phase teardown so the pool sees the matching resource.detach.

factory builds the adapter the first time the entry is realised. The pool only calls it once per (key, generation) even though PerPhase policy makes each phase its own key.