@@ -7,20 +7,20 @@ use iroh::endpoint;
7
7
8
8
use super :: { progress:: BroadcastProgressSender , DownloadKind , FailureAction , GetStartFut , Getter } ;
9
9
use crate :: {
10
- fetch:: { db:: get_to_db_in_steps , GetError } ,
10
+ fetch:: { db:: fetch_to_db_in_steps , Error } ,
11
11
store:: Store ,
12
12
} ;
13
13
14
- impl From < GetError > for FailureAction {
15
- fn from ( e : GetError ) -> Self {
14
+ impl From < Error > for FailureAction {
15
+ fn from ( e : Error ) -> Self {
16
16
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 ( ) ) ,
22
22
// 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 ( ) ) ,
24
24
}
25
25
}
26
26
}
@@ -34,7 +34,7 @@ pub(crate) struct IoGetter<S: Store> {
34
34
35
35
impl < S : Store > Getter for IoGetter < S > {
36
36
type Connection = endpoint:: Connection ;
37
- type NeedsConn = crate :: fetch:: db:: GetStateNeedsConn ;
37
+ type NeedsConn = crate :: fetch:: db:: FetchStateNeedsConn ;
38
38
39
39
fn get (
40
40
& mut self ,
@@ -43,12 +43,12 @@ impl<S: Store> Getter for IoGetter<S> {
43
43
) -> GetStartFut < Self :: NeedsConn > {
44
44
let store = self . store . clone ( ) ;
45
45
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 {
47
47
Err ( err) => Err ( err. into ( ) ) ,
48
- Ok ( crate :: fetch:: db:: GetState :: Complete ( stats) ) => {
48
+ Ok ( crate :: fetch:: db:: FetchState :: Complete ( stats) ) => {
49
49
Ok ( super :: GetOutput :: Complete ( stats) )
50
50
}
51
- Ok ( crate :: fetch:: db:: GetState :: NeedsConn ( needs_conn) ) => {
51
+ Ok ( crate :: fetch:: db:: FetchState :: NeedsConn ( needs_conn) ) => {
52
52
Ok ( super :: GetOutput :: NeedsConn ( needs_conn) )
53
53
}
54
54
}
@@ -57,7 +57,7 @@ impl<S: Store> Getter for IoGetter<S> {
57
57
}
58
58
}
59
59
60
- impl super :: NeedsConn < endpoint:: Connection > for crate :: fetch:: db:: GetStateNeedsConn {
60
+ impl super :: NeedsConn < endpoint:: Connection > for crate :: fetch:: db:: FetchStateNeedsConn {
61
61
fn proceed ( self , conn : endpoint:: Connection ) -> super :: GetProceedFut {
62
62
async move {
63
63
let res = self . proceed ( conn) . await ;
@@ -73,7 +73,7 @@ impl super::NeedsConn<endpoint::Connection> for crate::fetch::db::GetStateNeedsC
73
73
}
74
74
75
75
#[ cfg( feature = "metrics" ) ]
76
- fn track_metrics ( res : & Result < crate :: fetch:: Stats , GetError > ) {
76
+ fn track_metrics ( res : & Result < crate :: fetch:: Stats , Error > ) {
77
77
use iroh_metrics:: { inc, inc_by} ;
78
78
79
79
use crate :: metrics:: Metrics ;
@@ -90,7 +90,7 @@ fn track_metrics(res: &Result<crate::fetch::Stats, GetError>) {
90
90
inc_by ! ( Metrics , download_time_total, elapsed. as_millis( ) as u64 ) ;
91
91
}
92
92
Err ( e) => match & e {
93
- GetError :: NotFound ( _) => inc ! ( Metrics , downloads_notfound) ,
93
+ Error :: NotFound ( _) => inc ! ( Metrics , downloads_notfound) ,
94
94
_ => inc ! ( Metrics , downloads_error) ,
95
95
} ,
96
96
}
0 commit comments