pub fn new(
        artifact_manager: &dyn ArtifactManager,
        metrics: DownloadPrioritizerMetrics,
    ) -> Self {
        let download_prioritizer = Self {
            metrics,
            replica_map: Default::default(),
        };
        {
            let mut guard = download_prioritizer.replica_map.write().unwrap();
            let (client_advert_map, _) = guard.deref_mut();

            for client in ArtifactTag::iter() {
                let client = &mut client_advert_map.index_mut(client);
                client.get_priority_fn = Arc::new(get_priority_fn_from_manager);
            }
        }
        // Get all the priority functions from the clients !!
        let _ = download_prioritizer.update_priority_functions(artifact_manager);
        download_prioritizer
    }
/// Constructor. Returns a new instance of DownloadPrioritizer.
Constructor. Returns a new instance of DownloadPrioritizer.
Constructor . Returns a new instance of DownloadPrioritizer .
pub fn new(
        artifact_manager: &dyn ArtifactManager,
        metrics: DownloadPrioritizerMetrics,
    ) -> Self {
        let download_prioritizer = Self {
            metrics,
            replica_map: Default::default(),
        };
        {
            let mut guard = download_prioritizer.replica_map.write().unwrap();
            let (client_advert_map, _) = guard.deref_mut();
            for client in ArtifactTag::iter() {
                let client = &mut client_advert_map.index_mut(client);
                client.get_priority_fn = Arc::new(get_priority_fn_from_manager);
            }
        }
        // Get all the priority functions from the clients !!
        let _ = download_prioritizer.update_priority_functions(artifact_manager);
        download_prioritizer
    }
pub fn new ( artifact_manager : & dyn ArtifactManager , metrics : DownloadPrioritizerMetrics , ) -> Self { let download_prioritizer = Self { metrics , replica_map : Default :: default ( ) , } ; { let mut guard = download_prioritizer . replica_map . write ( ) . unwrap ( ) ; let ( client_advert_map , _ ) = guard . deref_mut ( ) ; for client in ArtifactTag :: iter ( ) { let client = & mut client_advert_map . index_mut ( client ) ; client . get_priority_fn = Arc :: new ( get_priority_fn_from_manager ) ; } } // Get all the priority functions from the clients !! let _ = download_prioritizer . update_priority_functions ( artifact_manager ) ; download_prioritizer }
Constructor.
Constructor .
artifact_manager
&dyn ArtifactManager
metrics
DownloadPrioritizerMetrics
artifact_manager
&dyn ArtifactManager
metrics
DownloadPrioritizerMetrics