fn make_min_in_sync_replicas(file_cfg: &Option<SpuConfigFile>) -> Result<u16, IoError> {
        let mut make_min_in_sync_replicas = None;

        // 1) environment variable (optional field, ignore errors)
        if let Ok(in_sync_replica_str) = env::var(FLV_REPLICA_IN_SYNC_REPLICA_MIN) {
            let in_sync_replica = in_sync_replica_str.parse().map_err(|err| {
                IoError::new(
                    ErrorKind::InvalidInput,
                    format!("min-in-sync-replica: {}", err),
                )
            })?;
            make_min_in_sync_replicas = Some(in_sync_replica);
        }

        // 2) config file
        if make_min_in_sync_replicas.is_none() && file_cfg.is_some() {
            make_min_in_sync_replicas = file_cfg.as_ref().unwrap().min_in_sync_replicas();
        }

        // 3) unwrap or use default
        Ok(make_min_in_sync_replicas.unwrap_or(SPU_MIN_IN_SYNC_REPLICAS))
    }
/// Generate min in-sync replicas by combining all config elements. Returns error on failure.
Generate min in-sync replicas by combining all config elements. Returns error on failure.
Generate min in - sync replicas by combining all config elements . Returns error on failure .
fn make_min_in_sync_replicas(file_cfg: &Option<SpuConfigFile>) -> Result<u16, IoError> {
        let mut make_min_in_sync_replicas = None;
        // 1) environment variable (optional field, ignore errors)
        if let Ok(in_sync_replica_str) = env::var(FLV_REPLICA_IN_SYNC_REPLICA_MIN) {
            let in_sync_replica = in_sync_replica_str.parse().map_err(|err| {
                IoError::new(
                    ErrorKind::InvalidInput,
                    format!("min-in-sync-replica: {}", err),
                )
            })?;
            make_min_in_sync_replicas = Some(in_sync_replica);
        }
        // 2) config file
        if make_min_in_sync_replicas.is_none() && file_cfg.is_some() {
            make_min_in_sync_replicas = file_cfg.as_ref().unwrap().min_in_sync_replicas();
        }
        // 3) unwrap or use default
        Ok(make_min_in_sync_replicas.unwrap_or(SPU_MIN_IN_SYNC_REPLICAS))
    }
fn make_min_in_sync_replicas ( file_cfg : & Option < SpuConfigFile > ) -> Result < u16 , IoError > { let mut make_min_in_sync_replicas = None ; // 1) environment variable (optional field, ignore errors) if let Ok ( in_sync_replica_str ) = env :: var ( FLV_REPLICA_IN_SYNC_REPLICA_MIN ) { let in_sync_replica = in_sync_replica_str . parse ( ) . map_err ( | err | { IoError :: new ( ErrorKind :: InvalidInput , format ! ( " " err ) , ) } ) ? ; make_min_in_sync_replicas = Some ( in_sync_replica ) ; } // 2) config file if make_min_in_sync_replicas . is_none ( ) && file_cfg . is_some ( ) { make_min_in_sync_replicas = file_cfg . as_ref ( ) . unwrap ( ) . min_in_sync_replicas ( ) ; } // 3) unwrap or use default Ok ( make_min_in_sync_replicas . unwrap_or ( SPU_MIN_IN_SYNC_REPLICAS ) ) }
Generate min in-sync replicas by combining all config elements.
Generate min in - sync replicas by combining all config elements .
file_cfg
&Option<SpuConfigFile>
file_cfg
&Option<SpuConfigFile>