Skip to content

Commit ccacf9e

Browse files
committed
complete rename from get to fetch
1 parent 11bade6 commit ccacf9e

File tree

11 files changed

+109
-110
lines changed

11 files changed

+109
-110
lines changed

src/cli.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use iroh::{NodeAddr, PublicKey, RelayUrl};
1919
use tokio::io::AsyncWriteExt;
2020

2121
use crate::{
22-
get::{db::DownloadProgress, progress::BlobProgress, Stats},
22+
fetch::{db::DownloadProgress, progress::BlobProgress, Stats},
2323
net_protocol::DownloadMode,
2424
provider::AddProgress,
2525
rpc::client::blobs::{

src/downloader/get.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ use iroh::endpoint;
77

88
use super::{progress::BroadcastProgressSender, DownloadKind, FailureAction, GetStartFut, Getter};
99
use 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

3535
impl<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
}

src/downloader/progress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pub type ProgressSubscriber = AsyncChannelProgressSender<DownloadProgress>;
2121
/// Track the progress of downloads.
2222
///
2323
/// This struct allows to create [`ProgressSender`] structs to be passed to
24-
/// [`crate::get::db::get_to_db`]. Each progress sender can be subscribed to by any number of
24+
/// [`crate::fetch::db::fetch_to_db`]. Each progress sender can be subscribed to by any number of
2525
/// [`ProgressSubscriber`] channel senders, which will receive each progress update (if they have
2626
/// capacity). Additionally, the [`ProgressTracker`] maintains a [`TransferState`] for each
2727
/// transfer, applying each progress update to update this state. When subscribing to an already

src/downloader/test/getter.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ impl Getter for TestingGetter {
3636
// since for testing we don't need a real connection, just keep track of what peer is the
3737
// request being sent to
3838
type Connection = NodeId;
39-
type NeedsConn = GetStateNeedsConn;
39+
type NeedsConn = FetchStateNeedsConn;
4040

4141
fn get(
4242
&mut self,
4343
kind: DownloadKind,
4444
progress_sender: BroadcastProgressSender,
4545
) -> GetStartFut<Self::NeedsConn> {
46-
std::future::ready(Ok(downloader::GetOutput::NeedsConn(GetStateNeedsConn(
46+
std::future::ready(Ok(downloader::GetOutput::NeedsConn(FetchStateNeedsConn(
4747
self.clone(),
4848
kind,
4949
progress_sender,
@@ -53,11 +53,11 @@ impl Getter for TestingGetter {
5353
}
5454

5555
#[derive(Debug)]
56-
pub(super) struct GetStateNeedsConn(TestingGetter, DownloadKind, BroadcastProgressSender);
56+
pub(super) struct FetchStateNeedsConn(TestingGetter, DownloadKind, BroadcastProgressSender);
5757

58-
impl downloader::NeedsConn<NodeId> for GetStateNeedsConn {
58+
impl downloader::NeedsConn<NodeId> for FetchStateNeedsConn {
5959
fn proceed(self, peer: NodeId) -> super::GetProceedFut {
60-
let GetStateNeedsConn(getter, kind, progress_sender) = self;
60+
let FetchStateNeedsConn(getter, kind, progress_sender) = self;
6161
let mut inner = getter.0.write();
6262
inner.request_history.push((kind, peer));
6363
let request_duration = inner.request_duration;

src/fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ use crate::{
3030
};
3131

3232
mod error;
33-
pub use error::GetError;
33+
pub use error::Error;
3434
pub mod db;
3535
pub mod progress;
3636
pub mod request;

0 commit comments

Comments
 (0)