@@ -19,11 +19,10 @@ use iroh::{NodeAddr, PublicKey, RelayUrl};
1919use tokio:: io:: AsyncWriteExt ;
2020
2121use crate :: {
22- get:: { db:: DownloadProgress , progress:: BlobProgress , Stats } ,
23- net_protocol:: DownloadMode ,
24- provider:: AddProgress ,
22+ get:: Stats ,
2523 rpc:: client:: blobs:: {
26- self , BlobInfo , BlobStatus , CollectionInfo , DownloadOptions , IncompleteBlobInfo , WrapOption ,
24+ self , AddProgressEvent , BlobInfo , BlobProgressEvent , BlobStatus , CollectionInfo ,
25+ DownloadMode , DownloadOptions , DownloadProgressEvent , IncompleteBlobInfo , WrapOption ,
2726 } ,
2827 store:: { ConsistencyCheckProgress , ExportFormat , ExportMode , ReportLevel , ValidateProgress } ,
2928 ticket:: BlobTicket ,
@@ -895,29 +894,29 @@ pub struct ProvideResponseEntry {
895894 pub hash : Hash ,
896895}
897896
898- /// Combines the [`AddProgress `] outputs from a [`Stream`] into a single tuple.
897+ /// Combines the [`AddProgressEvent `] outputs from a [`Stream`] into a single tuple.
899898pub async fn aggregate_add_response (
900- mut stream : impl Stream < Item = Result < AddProgress > > + Unpin ,
899+ mut stream : impl Stream < Item = Result < AddProgressEvent > > + Unpin ,
901900) -> Result < ( Hash , BlobFormat , Vec < ProvideResponseEntry > ) > {
902901 let mut hash_and_format = None ;
903902 let mut collections = BTreeMap :: < u64 , ( String , u64 , Option < Hash > ) > :: new ( ) ;
904903 let mut mp = Some ( ProvideProgressState :: new ( ) ) ;
905904 while let Some ( item) = stream. next ( ) . await {
906905 match item? {
907- AddProgress :: Found { name, id, size } => {
906+ AddProgressEvent :: Found { name, id, size } => {
908907 tracing:: trace!( "Found({id},{name},{size})" ) ;
909908 if let Some ( mp) = mp. as_mut ( ) {
910909 mp. found ( name. clone ( ) , id, size) ;
911910 }
912911 collections. insert ( id, ( name, size, None ) ) ;
913912 }
914- AddProgress :: Progress { id, offset } => {
913+ AddProgressEvent :: Progress { id, offset } => {
915914 tracing:: trace!( "Progress({id}, {offset})" ) ;
916915 if let Some ( mp) = mp. as_mut ( ) {
917916 mp. progress ( id, offset) ;
918917 }
919918 }
920- AddProgress :: Done { hash, id } => {
919+ AddProgressEvent :: Done { hash, id } => {
921920 tracing:: trace!( "Done({id},{hash:?})" ) ;
922921 if let Some ( mp) = mp. as_mut ( ) {
923922 mp. done ( id, hash) ;
@@ -931,15 +930,15 @@ pub async fn aggregate_add_response(
931930 }
932931 }
933932 }
934- AddProgress :: AllDone { hash, format, .. } => {
933+ AddProgressEvent :: AllDone { hash, format, .. } => {
935934 tracing:: trace!( "AllDone({hash:?})" ) ;
936935 if let Some ( mp) = mp. take ( ) {
937936 mp. all_done ( ) ;
938937 }
939938 hash_and_format = Some ( HashAndFormat { hash, format } ) ;
940939 break ;
941940 }
942- AddProgress :: Abort ( e) => {
941+ AddProgressEvent :: Abort ( e) => {
943942 if let Some ( mp) = mp. take ( ) {
944943 mp. error ( ) ;
945944 }
@@ -1032,7 +1031,7 @@ impl ProvideProgressState {
10321031/// Displays the download progress for a given stream.
10331032pub async fn show_download_progress (
10341033 hash : Hash ,
1035- mut stream : impl Stream < Item = Result < DownloadProgress > > + Unpin ,
1034+ mut stream : impl Stream < Item = Result < DownloadProgressEvent > > + Unpin ,
10361035) -> Result < ( ) > {
10371036 eprintln ! ( "Fetching: {}" , hash) ;
10381037 let mp = MultiProgress :: new ( ) ;
@@ -1043,7 +1042,7 @@ pub async fn show_download_progress(
10431042 let mut seq = false ;
10441043 while let Some ( x) = stream. next ( ) . await {
10451044 match x? {
1046- DownloadProgress :: InitialState ( state) => {
1045+ DownloadProgressEvent :: InitialState ( state) => {
10471046 if state. connected {
10481047 op. set_message ( format ! ( "{} Requesting ...\n " , style( "[2/3]" ) . bold( ) . dim( ) ) ) ;
10491048 }
@@ -1063,21 +1062,21 @@ pub async fn show_download_progress(
10631062 ip. set_length ( size. value ( ) ) ;
10641063 ip. reset ( ) ;
10651064 match blob. progress {
1066- BlobProgress :: Pending => { }
1067- BlobProgress :: Progressing ( offset) => ip. set_position ( offset) ,
1068- BlobProgress :: Done => ip. finish_and_clear ( ) ,
1065+ BlobProgressEvent :: Pending => { }
1066+ BlobProgressEvent :: Progressing ( offset) => ip. set_position ( offset) ,
1067+ BlobProgressEvent :: Done => ip. finish_and_clear ( ) ,
10691068 }
10701069 if !seq {
10711070 op. finish_and_clear ( ) ;
10721071 }
10731072 }
10741073 }
10751074 }
1076- DownloadProgress :: FoundLocal { .. } => { }
1077- DownloadProgress :: Connected => {
1075+ DownloadProgressEvent :: FoundLocal { .. } => { }
1076+ DownloadProgressEvent :: Connected => {
10781077 op. set_message ( format ! ( "{} Requesting ...\n " , style( "[2/3]" ) . bold( ) . dim( ) ) ) ;
10791078 }
1080- DownloadProgress :: FoundHashSeq { children, .. } => {
1079+ DownloadProgressEvent :: FoundHashSeq { children, .. } => {
10811080 op. set_message ( format ! (
10821081 "{} Downloading {} blob(s)\n " ,
10831082 style( "[3/3]" ) . bold( ) . dim( ) ,
@@ -1087,7 +1086,7 @@ pub async fn show_download_progress(
10871086 op. reset ( ) ;
10881087 seq = true ;
10891088 }
1090- DownloadProgress :: Found { size, child, .. } => {
1089+ DownloadProgressEvent :: Found { size, child, .. } => {
10911090 if seq {
10921091 op. set_position ( child. into ( ) ) ;
10931092 } else {
@@ -1096,13 +1095,13 @@ pub async fn show_download_progress(
10961095 ip. set_length ( size) ;
10971096 ip. reset ( ) ;
10981097 }
1099- DownloadProgress :: Progress { offset, .. } => {
1098+ DownloadProgressEvent :: Progress { offset, .. } => {
11001099 ip. set_position ( offset) ;
11011100 }
1102- DownloadProgress :: Done { .. } => {
1101+ DownloadProgressEvent :: Done { .. } => {
11031102 ip. finish_and_clear ( ) ;
11041103 }
1105- DownloadProgress :: AllDone ( Stats {
1104+ DownloadProgressEvent :: AllDone ( Stats {
11061105 bytes_read,
11071106 elapsed,
11081107 ..
@@ -1116,7 +1115,7 @@ pub async fn show_download_progress(
11161115 ) ;
11171116 break ;
11181117 }
1119- DownloadProgress :: Abort ( e) => {
1118+ DownloadProgressEvent :: Abort ( e) => {
11201119 bail ! ( "download aborted: {}" , e) ;
11211120 }
11221121 }
0 commit comments