1+ // Copyright (c) Microsoft Corporation.
2+ // Licensed under the MIT license.
3+
4+ //! Builder and configuration helpers for constructing
5+ //! [`LifecycleManager`](crate::LifecycleManager).
6+
17use std:: collections:: HashMap ;
28use std:: path:: { Path , PathBuf } ;
39use std:: time:: Duration ;
@@ -83,6 +89,8 @@ pub struct LifecycleBuilder {
8389}
8490
8591impl LifecycleBuilder {
92+ /// Create a builder with sensible defaults for the provided plugin
93+ /// directory.
8694 pub ( crate ) fn new ( plugin_dir : PathBuf ) -> Self {
8795 Self {
8896 plugin_dir,
@@ -163,7 +171,12 @@ impl LifecycleBuilder {
163171 } )
164172 }
165173
166- /// Construct a [`LifecycleManager`], optionally performing eager loading.
174+ /// Construct a [`LifecycleManager`] using the current builder settings.
175+ ///
176+ /// If eager loading is enabled the plugin directory is scanned
177+ /// immediately; otherwise the caller can defer loading until a later
178+ /// [`LifecycleManager::load_all_components`](crate::LifecycleManager::load_all_components)
179+ /// invocation.
167180 pub async fn build ( self ) -> Result < LifecycleManager > {
168181 let config = self . build_config ( ) ?;
169182 let eager = config. eager_load ( ) ;
@@ -175,6 +188,7 @@ impl LifecycleBuilder {
175188 }
176189}
177190
191+ /// Create the default HTTP client used when none is supplied.
178192fn default_http_client ( ) -> Result < reqwest:: Client > {
179193 let http_timeout = std:: env:: var ( "HTTP_TIMEOUT_SECS" )
180194 . ok ( )
@@ -187,6 +201,7 @@ fn default_http_client() -> Result<reqwest::Client> {
187201 . context ( "Failed to create default HTTP client" )
188202}
189203
204+ /// Create the default OCI client used when none is supplied.
190205fn default_oci_client ( ) -> Result < oci_client:: Client > {
191206 let oci_timeout = std:: env:: var ( "OCI_TIMEOUT_SECS" )
192207 . ok ( )
@@ -213,6 +228,8 @@ impl LifecycleConfig {
213228 }
214229}
215230
231+ /// Internal helper that exposes the decomposed configuration values to the
232+ /// lifecycle manager for initialization.
216233pub ( crate ) struct LifecycleConfigParts {
217234 pub plugin_dir : PathBuf ,
218235 pub secrets_dir : PathBuf ,
0 commit comments