@@ -7,20 +7,20 @@ use iroh::endpoint;
77
88use super :: { progress:: BroadcastProgressSender , DownloadKind , FailureAction , GetStartFut , Getter } ;
99use crate :: {
10- fetch:: { db:: get_to_db_in_steps , GetError } ,
10+ fetch:: { db:: fetch_to_db_in_steps , Error } ,
1111 store:: Store ,
1212} ;
1313
14- impl From < GetError > for FailureAction {
15- fn from ( e : GetError ) -> Self {
14+ impl From < Error > for FailureAction {
15+ fn from ( e : Error ) -> Self {
1616 match e {
17- e @ GetError :: NotFound ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
18- e @ GetError :: RemoteReset ( _) => FailureAction :: RetryLater ( e. into ( ) ) ,
19- e @ GetError :: NoncompliantNode ( _) => FailureAction :: DropPeer ( e. into ( ) ) ,
20- e @ GetError :: Io ( _) => FailureAction :: RetryLater ( e. into ( ) ) ,
21- e @ GetError :: BadRequest ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
17+ e @ Error :: NotFound ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
18+ e @ Error :: RemoteReset ( _) => FailureAction :: RetryLater ( e. into ( ) ) ,
19+ e @ Error :: NoncompliantNode ( _) => FailureAction :: DropPeer ( e. into ( ) ) ,
20+ e @ Error :: Io ( _) => FailureAction :: RetryLater ( e. into ( ) ) ,
21+ e @ Error :: BadRequest ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
2222 // TODO: what do we want to do on local failures?
23- e @ GetError :: LocalFailure ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
23+ e @ Error :: LocalFailure ( _) => FailureAction :: AbortRequest ( e. into ( ) ) ,
2424 }
2525 }
2626}
@@ -34,7 +34,7 @@ pub(crate) struct IoGetter<S: Store> {
3434
3535impl < S : Store > Getter for IoGetter < S > {
3636 type Connection = endpoint:: Connection ;
37- type NeedsConn = crate :: fetch:: db:: GetStateNeedsConn ;
37+ type NeedsConn = crate :: fetch:: db:: FetchStateNeedsConn ;
3838
3939 fn get (
4040 & mut self ,
@@ -43,12 +43,12 @@ impl<S: Store> Getter for IoGetter<S> {
4343 ) -> GetStartFut < Self :: NeedsConn > {
4444 let store = self . store . clone ( ) ;
4545 async move {
46- match get_to_db_in_steps ( store, kind. hash_and_format ( ) , progress_sender) . await {
46+ match fetch_to_db_in_steps ( store, kind. hash_and_format ( ) , progress_sender) . await {
4747 Err ( err) => Err ( err. into ( ) ) ,
48- Ok ( crate :: fetch:: db:: GetState :: Complete ( stats) ) => {
48+ Ok ( crate :: fetch:: db:: FetchState :: Complete ( stats) ) => {
4949 Ok ( super :: GetOutput :: Complete ( stats) )
5050 }
51- Ok ( crate :: fetch:: db:: GetState :: NeedsConn ( needs_conn) ) => {
51+ Ok ( crate :: fetch:: db:: FetchState :: NeedsConn ( needs_conn) ) => {
5252 Ok ( super :: GetOutput :: NeedsConn ( needs_conn) )
5353 }
5454 }
@@ -57,7 +57,7 @@ impl<S: Store> Getter for IoGetter<S> {
5757 }
5858}
5959
60- impl super :: NeedsConn < endpoint:: Connection > for crate :: fetch:: db:: GetStateNeedsConn {
60+ impl super :: NeedsConn < endpoint:: Connection > for crate :: fetch:: db:: FetchStateNeedsConn {
6161 fn proceed ( self , conn : endpoint:: Connection ) -> super :: GetProceedFut {
6262 async move {
6363 let res = self . proceed ( conn) . await ;
@@ -73,7 +73,7 @@ impl super::NeedsConn<endpoint::Connection> for crate::fetch::db::GetStateNeedsC
7373}
7474
7575#[ cfg( feature = "metrics" ) ]
76- fn track_metrics ( res : & Result < crate :: fetch:: Stats , GetError > ) {
76+ fn track_metrics ( res : & Result < crate :: fetch:: Stats , Error > ) {
7777 use iroh_metrics:: { inc, inc_by} ;
7878
7979 use crate :: metrics:: Metrics ;
@@ -90,7 +90,7 @@ fn track_metrics(res: &Result<crate::fetch::Stats, GetError>) {
9090 inc_by ! ( Metrics , download_time_total, elapsed. as_millis( ) as u64 ) ;
9191 }
9292 Err ( e) => match & e {
93- GetError :: NotFound ( _) => inc ! ( Metrics , downloads_notfound) ,
93+ Error :: NotFound ( _) => inc ! ( Metrics , downloads_notfound) ,
9494 _ => inc ! ( Metrics , downloads_error) ,
9595 } ,
9696 }
0 commit comments