pub fn insert(
        &mut self,
        config: impl Into<Arc<RepositoryConfig>>,
    ) -> Result<Option<Arc<RepositoryConfig>>, InsertError> {
        let dynamic_configs_path =
            self.dynamic_configs_path.as_ref().ok_or(InsertError::DynamicConfigurationDisabled)?;

        let config = config.into();

        // Clear any connections so we aren't talking to stale repositories.
        let connected_to_amber = self.amber_conns.write().remove(config.repo_url()).is_some();
        let connected_to_rust_tuf = self.rust_tuf_conns.write().remove(config.repo_url()).is_some();
        if connected_to_amber || connected_to_rust_tuf {
            fx_log_info!("closing connection to {} repo because config changed", config.repo_url());
        }

        let inspectable_config = InspectableRepositoryConfig::new(
            Arc::clone(&config),
            &self.inspect.dynamic_configs_node,
            config.repo_url().host(),
        );
        let result = self.dynamic_configs.insert(config.repo_url().clone(), inspectable_config);

        Self::save(dynamic_configs_path, &mut self.dynamic_configs);
        Ok(result.map(|a| Arc::clone(&*a)))
    }
/// Inserts a [RepositoryConfig] into this manager.
///
/// If dynamic configuration is disabled (if the manager does not have a dynamic config path)
/// `Err(InsertError)` is returned.
///
/// If the manager did not have a [RepositoryConfig] with a corresponding repository url for
/// the repository, `Ok(None)` is returned.
///
/// If the manager did have this repository present as a dynamic config, the value is replaced
/// and the old [RepositoryConfig] is returned. If this repository is a static config, the
/// static config is shadowed by the dynamic config until it is removed.
Inserts a [RepositoryConfig] into this manager.
If dynamic configuration is disabled (if the manager does not have a dynamic config path)
`Err(InsertError)` is returned.

If the manager did not have a [RepositoryConfig] with a corresponding repository url for
the repository, `Ok(None)` is returned.

If the manager did have this repository present as a dynamic config, the value is replaced
and the old [RepositoryConfig] is returned. If this repository is a static config, the
static config is shadowed by the dynamic config until it is removed.
Inserts a [ RepositoryConfig ] into this manager . If dynamic configuration is disabled ( if the manager does not have a dynamic config path ) ` Err ( InsertError ) ` is returned . If the manager did not have a [ RepositoryConfig ] with a corresponding repository url for the repository ` Ok ( None ) ` is returned . If the manager did have this repository present as a dynamic config the value is replaced and the old [ RepositoryConfig ] is returned . If this repository is a static config the static config is shadowed by the dynamic config until it is removed .
pub fn insert(
        &mut self,
        config: impl Into<Arc<RepositoryConfig>>,
    ) -> Result<Option<Arc<RepositoryConfig>>, InsertError> {
        let dynamic_configs_path =
            self.dynamic_configs_path.as_ref().ok_or(InsertError::DynamicConfigurationDisabled)?;
        let config = config.into();
        // Clear any connections so we aren't talking to stale repositories.
        let connected_to_amber = self.amber_conns.write().remove(config.repo_url()).is_some();
        let connected_to_rust_tuf = self.rust_tuf_conns.write().remove(config.repo_url()).is_some();
        if connected_to_amber || connected_to_rust_tuf {
            fx_log_info!("closing connection to {} repo because config changed", config.repo_url());
        }
        let inspectable_config = InspectableRepositoryConfig::new(
            Arc::clone(&config),
            &self.inspect.dynamic_configs_node,
            config.repo_url().host(),
        );
        let result = self.dynamic_configs.insert(config.repo_url().clone(), inspectable_config);
        Self::save(dynamic_configs_path, &mut self.dynamic_configs);
        Ok(result.map(|a| Arc::clone(&*a)))
    }
pub fn insert ( & mut self , config : impl Into < Arc < RepositoryConfig > > , ) -> Result < Option < Arc < RepositoryConfig > > , InsertError > { let dynamic_configs_path = self . dynamic_configs_path . as_ref ( ) . ok_or ( InsertError :: DynamicConfigurationDisabled ) ? ; let config = config . into ( ) ; // Clear any connections so we aren't talking to stale repositories. let connected_to_amber = self . amber_conns . write ( ) . remove ( config . repo_url ( ) ) . is_some ( ) ; let connected_to_rust_tuf = self . rust_tuf_conns . write ( ) . remove ( config . repo_url ( ) ) . is_some ( ) ; if connected_to_amber || connected_to_rust_tuf { fx_log_info ! ( " " config repo_url ( ) ) ; } let inspectable_config = InspectableRepositoryConfig :: new ( Arc :: clone ( & config ) , & self . inspect . dynamic_configs_node , config . repo_url ( ) . host ( ) , ) ; let result = self . dynamic_configs . insert ( config . repo_url ( ) . clone ( ) , inspectable_config ) ; Self :: save ( dynamic_configs_path , & mut self . dynamic_configs ) ; Ok ( result . map ( | a | Arc :: clone ( & * a ) ) ) }
Inserts a [RepositoryConfig] into this manager.
Inserts a [ RepositoryConfig ] into this manager .
&mut self
config
impl Into<Arc<RepositoryConfig>>