@@ -35,7 +35,7 @@ pub struct Downloader {
3535#[ rpc_requests( message = SwarmMsg , alias = "Msg" ) ]
3636#[ derive( Debug , Serialize , Deserialize ) ]
3737enum SwarmProtocol {
38- #[ rpc( tx = mpsc:: Sender <DownloadProgessItem >) ]
38+ #[ rpc( tx = mpsc:: Sender <DownloadProgressItem >) ]
3939 Download ( DownloadRequest ) ,
4040}
4141
@@ -47,7 +47,7 @@ struct DownloaderActor {
4747}
4848
4949#[ derive( Debug , Serialize , Deserialize ) ]
50- pub enum DownloadProgessItem {
50+ pub enum DownloadProgressItem {
5151 #[ serde( skip) ]
5252 Error ( anyhow:: Error ) ,
5353 TryProvider {
@@ -99,15 +99,15 @@ impl DownloaderActor {
9999async fn handle_download ( store : Store , pool : ConnectionPool , msg : DownloadMsg ) {
100100 let DownloadMsg { inner, mut tx, .. } = msg;
101101 if let Err ( cause) = handle_download_impl ( store, pool, inner, & mut tx) . await {
102- tx. send ( DownloadProgessItem :: Error ( cause) ) . await . ok ( ) ;
102+ tx. send ( DownloadProgressItem :: Error ( cause) ) . await . ok ( ) ;
103103 }
104104}
105105
106106async fn handle_download_impl (
107107 store : Store ,
108108 pool : ConnectionPool ,
109109 request : DownloadRequest ,
110- tx : & mut mpsc:: Sender < DownloadProgessItem > ,
110+ tx : & mut mpsc:: Sender < DownloadProgressItem > ,
111111) -> anyhow:: Result < ( ) > {
112112 match request. strategy {
113113 SplitStrategy :: Split => handle_download_split_impl ( store, pool, request, tx) . await ?,
@@ -128,7 +128,7 @@ async fn handle_download_split_impl(
128128 store : Store ,
129129 pool : ConnectionPool ,
130130 request : DownloadRequest ,
131- tx : & mut mpsc:: Sender < DownloadProgessItem > ,
131+ tx : & mut mpsc:: Sender < DownloadProgressItem > ,
132132) -> anyhow:: Result < ( ) > {
133133 let providers = request. providers ;
134134 let requests = split_request ( & request. request , & providers, & pool, & store, Drain ) . await ?;
@@ -141,7 +141,7 @@ async fn handle_download_split_impl(
141141 let progress_tx = progress_tx. clone ( ) ;
142142 async move {
143143 let hash = request. hash ;
144- let ( tx, rx) = tokio:: sync:: mpsc:: channel :: < ( usize , DownloadProgessItem ) > ( 16 ) ;
144+ let ( tx, rx) = tokio:: sync:: mpsc:: channel :: < ( usize , DownloadProgressItem ) > ( 16 ) ;
145145 progress_tx. send ( rx) . await . ok ( ) ;
146146 let sink = TokioMpscSenderSink ( tx)
147147 . with_map_err ( io:: Error :: other)
@@ -157,12 +157,12 @@ async fn handle_download_split_impl(
157157 into_stream ( progress_rx)
158158 . flat_map ( into_stream)
159159 . map ( move |( id, item) | match item {
160- DownloadProgessItem :: Progress ( offset) => {
160+ DownloadProgressItem :: Progress ( offset) => {
161161 total += offset;
162162 if let Some ( prev) = offsets. insert ( id, offset) {
163163 total -= prev;
164164 }
165- DownloadProgessItem :: Progress ( total)
165+ DownloadProgressItem :: Progress ( total)
166166 }
167167 x => x,
168168 } )
@@ -177,7 +177,7 @@ async fn handle_download_split_impl(
177177 Some ( ( _hash, Ok ( ( ) ) ) ) => {
178178 }
179179 Some ( ( _hash, Err ( _e) ) ) => {
180- tx. send( DownloadProgessItem :: DownloadError ) . await ?;
180+ tx. send( DownloadProgressItem :: DownloadError ) . await ?;
181181 }
182182 None => break ,
183183 }
@@ -301,19 +301,19 @@ impl<'de> Deserialize<'de> for DownloadRequest {
301301pub type DownloadOptions = DownloadRequest ;
302302
303303pub struct DownloadProgress {
304- fut : future:: Boxed < irpc:: Result < mpsc:: Receiver < DownloadProgessItem > > > ,
304+ fut : future:: Boxed < irpc:: Result < mpsc:: Receiver < DownloadProgressItem > > > ,
305305}
306306
307307impl DownloadProgress {
308- fn new ( fut : future:: Boxed < irpc:: Result < mpsc:: Receiver < DownloadProgessItem > > > ) -> Self {
308+ fn new ( fut : future:: Boxed < irpc:: Result < mpsc:: Receiver < DownloadProgressItem > > > ) -> Self {
309309 Self { fut }
310310 }
311311
312- pub async fn stream ( self ) -> irpc:: Result < impl Stream < Item = DownloadProgessItem > + Unpin > {
312+ pub async fn stream ( self ) -> irpc:: Result < impl Stream < Item = DownloadProgressItem > + Unpin > {
313313 let rx = self . fut . await ?;
314314 Ok ( Box :: pin ( rx. into_stream ( ) . map ( |item| match item {
315315 Ok ( item) => item,
316- Err ( e) => DownloadProgessItem :: Error ( e. into ( ) ) ,
316+ Err ( e) => DownloadProgressItem :: Error ( e. into ( ) ) ,
317317 } ) ) )
318318 }
319319
@@ -323,8 +323,8 @@ impl DownloadProgress {
323323 tokio:: pin!( stream) ;
324324 while let Some ( item) = stream. next ( ) . await {
325325 match item? {
326- DownloadProgessItem :: Error ( e) => Err ( e) ?,
327- DownloadProgessItem :: DownloadError => anyhow:: bail!( "Download error" ) ,
326+ DownloadProgressItem :: Error ( e) => Err ( e) ?,
327+ DownloadProgressItem :: DownloadError => anyhow:: bail!( "Download error" ) ,
328328 _ => { }
329329 }
330330 }
@@ -375,7 +375,7 @@ async fn split_request<'a>(
375375 providers : & Arc < dyn ContentDiscovery > ,
376376 pool : & ConnectionPool ,
377377 store : & Store ,
378- progress : impl Sink < DownloadProgessItem , Error = io:: Error > ,
378+ progress : impl Sink < DownloadProgressItem , Error = io:: Error > ,
379379) -> anyhow:: Result < Box < dyn Iterator < Item = GetRequest > + Send + ' a > > {
380380 Ok ( match request {
381381 FiniteRequest :: Get ( req) => {
@@ -431,13 +431,13 @@ async fn execute_get(
431431 request : Arc < GetRequest > ,
432432 providers : & Arc < dyn ContentDiscovery > ,
433433 store : & Store ,
434- mut progress : impl Sink < DownloadProgessItem , Error = io:: Error > ,
434+ mut progress : impl Sink < DownloadProgressItem , Error = io:: Error > ,
435435) -> anyhow:: Result < ( ) > {
436436 let remote = store. remote ( ) ;
437437 let mut providers = providers. find_providers ( request. content ( ) ) ;
438438 while let Some ( provider) = providers. next ( ) . await {
439439 progress
440- . send ( DownloadProgessItem :: TryProvider {
440+ . send ( DownloadProgressItem :: TryProvider {
441441 id : provider,
442442 request : request. clone ( ) ,
443443 } )
@@ -450,7 +450,7 @@ async fn execute_get(
450450 let local_bytes = local. local_bytes ( ) ;
451451 let Ok ( conn) = conn. await else {
452452 progress
453- . send ( DownloadProgessItem :: ProviderFailed {
453+ . send ( DownloadProgressItem :: ProviderFailed {
454454 id : provider,
455455 request : request. clone ( ) ,
456456 } )
@@ -461,21 +461,21 @@ async fn execute_get(
461461 . execute_get_sink (
462462 & conn,
463463 local. missing ( ) ,
464- ( & mut progress) . with_map ( move |x| DownloadProgessItem :: Progress ( x + local_bytes) ) ,
464+ ( & mut progress) . with_map ( move |x| DownloadProgressItem :: Progress ( x + local_bytes) ) ,
465465 )
466466 . await
467467 {
468468 Ok ( _stats) => {
469469 progress
470- . send ( DownloadProgessItem :: PartComplete {
470+ . send ( DownloadProgressItem :: PartComplete {
471471 request : request. clone ( ) ,
472472 } )
473473 . await ?;
474474 return Ok ( ( ) ) ;
475475 }
476476 Err ( _cause) => {
477477 progress
478- . send ( DownloadProgessItem :: ProviderFailed {
478+ . send ( DownloadProgressItem :: ProviderFailed {
479479 id : provider,
480480 request : request. clone ( ) ,
481481 } )
0 commit comments