@@ -15,7 +15,6 @@ use crate::config::Cfg;
1515use  crate :: dist:: temp; 
1616use  crate :: download:: { download_file,  download_file_with_resume} ; 
1717use  crate :: errors:: * ; 
18- use  crate :: notifications:: Notification ; 
1918use  crate :: process:: Process ; 
2019use  crate :: utils; 
2120
@@ -339,9 +338,25 @@ impl DownloadTracker {
339338    } 
340339} 
341340
342- fn  file_hash ( path :  & Path ,  notify_handler :  & Notifier )  -> Result < String >  { 
341+ #[ derive( Debug ) ]  
342+ pub ( crate )  enum  Notification < ' a >  { 
343+     /// The URL of the download is passed as the last argument, to allow us to track concurrent downloads. 
344+ DownloadingComponent ( & ' a  str ,  & ' a  str ) , 
345+     RetryingDownload ( & ' a  str ) , 
346+     /// Received the Content-Length of the to-be downloaded data with 
347+ /// the respective URL of the download (for tracking concurrent downloads). 
348+ DownloadContentLengthReceived ( u64 ,  Option < & ' a  str > ) , 
349+     /// Received some data. 
350+ DownloadDataReceived ( & ' a  [ u8 ] ,  Option < & ' a  str > ) , 
351+     /// Download has finished. 
352+ DownloadFinished ( Option < & ' a  str > ) , 
353+     /// Download has failed. 
354+ DownloadFailed ( & ' a  str ) , 
355+ } 
356+ 
357+ fn  file_hash ( path :  & Path ,  notifier :  & Notifier )  -> Result < String >  { 
343358    let  mut  hasher = Sha256 :: new ( ) ; 
344-     let  mut  downloaded = utils:: FileReaderWithProgress :: new_file ( path,  notify_handler ) ?; 
359+     let  mut  downloaded = utils:: FileReaderWithProgress :: new_file ( path,  notifier ) ?; 
345360    use  std:: io:: Read ; 
346361    let  mut  buf = vec ! [ 0 ;  32768 ] ; 
347362    while  let  Ok ( n)  = downloaded. read ( & mut  buf)  { 
0 commit comments