Skip to content

Commit 3121b0d

Browse files
committed
undo get -> fetch rename
not worth it at this point
1 parent 03d2f8a commit 3121b0d

File tree

18 files changed

+44
-44
lines changed

18 files changed

+44
-44
lines changed

examples/fetch-fsm.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::net::SocketAddr;
77

88
use anyhow::{Context, Result};
99
use iroh_blobs::{
10-
fetch::fsm::{AtInitial, ConnectedNext, EndBlobNext},
10+
get::fsm::{AtInitial, ConnectedNext, EndBlobNext},
1111
hashseq::HashSeq,
1212
protocol::GetRequest,
1313
Hash,
@@ -63,14 +63,14 @@ async fn main() -> Result<()> {
6363
// create a request for a collection
6464
let request = GetRequest::all(hash);
6565
// create the initial state of the finite state machine
66-
let initial = iroh_blobs::fetch::fsm::start(connection, request);
66+
let initial = iroh_blobs::get::fsm::start(connection, request);
6767

6868
write_collection(initial).await
6969
} else {
7070
// create a request for a single blob
7171
let request = GetRequest::single(hash);
7272
// create the initial state of the finite state machine
73-
let initial = iroh_blobs::fetch::fsm::start(connection, request);
73+
let initial = iroh_blobs::get::fsm::start(connection, request);
7474

7575
write_blob(initial).await
7676
}
@@ -119,7 +119,7 @@ async fn write_collection(initial: AtInitial) -> Result<()> {
119119
}
120120

121121
// move to the header
122-
let header: iroh_blobs::fetch::fsm::AtBlobHeader = start_root.next();
122+
let header: iroh_blobs::get::fsm::AtBlobHeader = start_root.next();
123123
let (root_end, hashes_bytes) = header.concatenate_into_vec().await?;
124124
let next = root_end.next();
125125
let EndBlobNext::MoreChildren(at_meta) = next else {

examples/fetch-stream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use bytes::Bytes;
1111
use futures_lite::{Stream, StreamExt};
1212
use genawaiter::sync::{Co, Gen};
1313
use iroh_blobs::{
14-
fetch::fsm::{AtInitial, BlobContentNext, ConnectedNext, EndBlobNext},
14+
get::fsm::{AtInitial, BlobContentNext, ConnectedNext, EndBlobNext},
1515
hashseq::HashSeq,
1616
protocol::GetRequest,
1717
Hash,
@@ -68,7 +68,7 @@ async fn main() -> Result<()> {
6868
let request = GetRequest::all(hash);
6969

7070
// create the initial state of the finite state machine
71-
let initial = iroh_blobs::fetch::fsm::start(connection, request);
71+
let initial = iroh_blobs::get::fsm::start(connection, request);
7272

7373
// create a stream that yields all the data of the blob
7474
stream_children(initial).boxed_local()
@@ -77,7 +77,7 @@ async fn main() -> Result<()> {
7777
let request = GetRequest::single(hash);
7878

7979
// create the initial state of the finite state machine
80-
let initial = iroh_blobs::fetch::fsm::start(connection, request);
80+
let initial = iroh_blobs::get::fsm::start(connection, request);
8181

8282
// create a stream that yields all the data of the blob
8383
stream_blob(initial).boxed_local()
@@ -166,7 +166,7 @@ fn stream_children(initial: AtInitial) -> impl Stream<Item = io::Result<Bytes>>
166166
));
167167
}
168168
// move to the header
169-
let header: iroh_blobs::fetch::fsm::AtBlobHeader = start_root.next();
169+
let header: iroh_blobs::get::fsm::AtBlobHeader = start_root.next();
170170
let (root_end, hashes_bytes) = header.concatenate_into_vec().await?;
171171

172172
// parse the hashes from the hash sequence bytes

examples/local-swarm-discovery.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ mod progress {
140140
ProgressStyle,
141141
};
142142
use iroh_blobs::{
143-
fetch::{
143+
get::{
144144
progress::{BlobProgress, DownloadProgress},
145145
Stats,
146146
},

src/downloader.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ use tokio_util::{either::Either, sync::CancellationToken, time::delay_queue};
5555
use tracing::{debug, error, error_span, trace, warn, Instrument};
5656

5757
use crate::{
58-
fetch::{progress::DownloadProgress, Stats},
58+
get::{progress::DownloadProgress, Stats},
5959
metrics::Metrics,
6060
store::Store,
6161
util::{local_pool::LocalPoolHandle, progress::ProgressSender},

src/downloader/get.rs

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

88
use super::{progress::BroadcastProgressSender, DownloadKind, FailureAction, GetStartFut, Getter};
99
use crate::{
10-
fetch::Error,
11-
store::{fetch_to_db_in_steps, FetchState, FetchStateNeedsConn, Store},
10+
get::Error,
11+
store::{get_to_db_in_steps, FetchState, FetchStateNeedsConn, Store},
1212
};
1313

1414
impl From<Error> for FailureAction {
@@ -43,7 +43,7 @@ impl<S: Store> Getter for IoGetter<S> {
4343
) -> GetStartFut<Self::NeedsConn> {
4444
let store = self.store.clone();
4545
async move {
46-
match fetch_to_db_in_steps(store, kind.hash_and_format(), progress_sender).await {
46+
match get_to_db_in_steps(store, kind.hash_and_format(), progress_sender).await {
4747
Err(err) => Err(err.into()),
4848
Ok(FetchState::Complete(stats)) => Ok(super::GetOutput::Complete(stats)),
4949
Ok(FetchState::NeedsConn(needs_conn)) => {
@@ -71,13 +71,13 @@ impl super::NeedsConn<endpoint::Connection> for FetchStateNeedsConn {
7171
}
7272

7373
#[cfg(feature = "metrics")]
74-
fn track_metrics(res: &Result<crate::fetch::Stats, Error>) {
74+
fn track_metrics(res: &Result<crate::get::Stats, Error>) {
7575
use iroh_metrics::{inc, inc_by};
7676

7777
use crate::metrics::Metrics;
7878
match res {
7979
Ok(stats) => {
80-
let crate::fetch::Stats {
80+
let crate::get::Stats {
8181
bytes_written,
8282
bytes_read: _,
8383
elapsed,

src/downloader/progress.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use parking_lot::Mutex;
1111

1212
use super::DownloadKind;
1313
use crate::{
14-
fetch::progress::{DownloadProgress, TransferState},
14+
get::progress::{DownloadProgress, TransferState},
1515
util::progress::{AsyncChannelProgressSender, IdGenerator, ProgressSendError, ProgressSender},
1616
};
1717

src/downloader/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use iroh::SecretKey;
1010

1111
use super::*;
1212
use crate::{
13-
fetch::progress::{BlobId, BlobProgress, TransferState},
13+
get::progress::{BlobId, BlobProgress, TransferState},
1414
util::{
1515
local_pool::LocalPool,
1616
progress::{AsyncChannelProgressSender, IdGenerator},

src/format/collection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use iroh_io::AsyncSliceReaderExt;
88
use serde::{Deserialize, Serialize};
99

1010
use crate::{
11-
fetch::{fsm, Stats},
11+
get::{fsm, Stats},
1212
hashseq::HashSeq,
1313
store::MapEntry,
1414
util::TempTag,
@@ -142,7 +142,7 @@ impl Collection {
142142
///
143143
/// Returns the collection, a map from blob offsets to bytes, and the stats.
144144
pub async fn read_fsm_all(
145-
fsm_at_start_root: crate::fetch::fsm::AtStartRoot,
145+
fsm_at_start_root: crate::get::fsm::AtStartRoot,
146146
) -> anyhow::Result<(Collection, BTreeMap<u64, Bytes>, Stats)> {
147147
let (next, links, collection) = Self::read_fsm(fsm_at_start_root).await?;
148148
let mut res = BTreeMap::new();

src/fetch.rs renamed to src/get.rs

File renamed without changes.

src/fetch/error.rs renamed to src/get/error.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,9 @@ impl From<endpoint::WriteError> for Error {
116116
}
117117
}
118118

119-
impl From<crate::fetch::fsm::ConnectedNextError> for Error {
120-
fn from(value: crate::fetch::fsm::ConnectedNextError) -> Self {
121-
use crate::fetch::fsm::ConnectedNextError::*;
119+
impl From<crate::get::fsm::ConnectedNextError> for Error {
120+
fn from(value: crate::get::fsm::ConnectedNextError) -> Self {
121+
use crate::get::fsm::ConnectedNextError::*;
122122
match value {
123123
e @ PostcardSer(_) => {
124124
// serialization errors indicate something wrong with the request itself
@@ -138,9 +138,9 @@ impl From<crate::fetch::fsm::ConnectedNextError> for Error {
138138
}
139139
}
140140

141-
impl From<crate::fetch::fsm::AtBlobHeaderNextError> for Error {
142-
fn from(value: crate::fetch::fsm::AtBlobHeaderNextError) -> Self {
143-
use crate::fetch::fsm::AtBlobHeaderNextError::*;
141+
impl From<crate::get::fsm::AtBlobHeaderNextError> for Error {
142+
fn from(value: crate::get::fsm::AtBlobHeaderNextError) -> Self {
143+
use crate::get::fsm::AtBlobHeaderNextError::*;
144144
match value {
145145
e @ NotFound => {
146146
// > This indicates that the provider does not have the requested data.
@@ -156,9 +156,9 @@ impl From<crate::fetch::fsm::AtBlobHeaderNextError> for Error {
156156
}
157157
}
158158

159-
impl From<crate::fetch::fsm::DecodeError> for Error {
160-
fn from(value: crate::fetch::fsm::DecodeError) -> Self {
161-
use crate::fetch::fsm::DecodeError::*;
159+
impl From<crate::get::fsm::DecodeError> for Error {
160+
fn from(value: crate::get::fsm::DecodeError) -> Self {
161+
use crate::get::fsm::DecodeError::*;
162162

163163
match value {
164164
e @ NotFound => Error::NotFound(e.into()),
File renamed without changes.
File renamed without changes.

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@
3232
pub mod cli;
3333
#[cfg(feature = "downloader")]
3434
pub mod downloader;
35-
pub mod fetch;
3635
#[cfg(feature = "formats")]
3736
pub mod format;
37+
pub mod get;
3838
pub mod hashseq;
3939
pub mod metrics;
4040
#[cfg(feature = "net_protocol")]

src/rpc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use tracing::{debug, warn};
4343

4444
use crate::{
4545
downloader::{DownloadRequest, Downloader},
46-
fetch::{progress::DownloadProgress, Stats},
4746
format::collection::Collection,
47+
get::{progress::DownloadProgress, Stats},
4848
net_protocol::{Blobs, BlobsInner},
4949
provider::{AddProgress, BatchAddPathProgress},
5050
store::{
@@ -1008,7 +1008,7 @@ impl<D: crate::store::Store> Handler<D> {
10081008
let mut remaining_nodes = nodes.len();
10091009
let mut nodes_iter = nodes.into_iter();
10101010
'outer: loop {
1011-
match crate::store::fetch_to_db_in_steps(
1011+
match crate::store::get_to_db_in_steps(
10121012
self.store().clone(),
10131013
hash_and_format,
10141014
progress.clone(),

src/rpc/client/blobs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ use tokio_util::io::{ReaderStream, StreamReader};
8282
use tracing::warn;
8383

8484
use crate::{
85-
fetch::progress::DownloadProgress as BytesDownloadProgress,
8685
format::collection::{Collection, SimpleStore},
86+
get::progress::DownloadProgress as BytesDownloadProgress,
8787
rpc::proto::{blobs::BlobDownloadRequest, RpcService},
8888
store::{
8989
BaoBlobSize, ConsistencyCheckProgress, ExportFormat, ExportMode,
@@ -675,7 +675,7 @@ pub struct DownloadOutcome {
675675
/// The size of the data we downloaded from the network
676676
pub downloaded_size: u64,
677677
/// Statistics about the download
678-
pub stats: crate::fetch::Stats,
678+
pub stats: crate::get::Stats,
679679
}
680680

681681
/// Progress stream for blob download operations.

src/rpc/proto/blobs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub struct AddPathResponse(pub AddProgress);
112112

113113
/// Progress response for [`BlobDownloadRequest`]
114114
#[derive(Debug, Clone, Serialize, Deserialize, derive_more::From, derive_more::Into)]
115-
pub struct DownloadResponse(pub crate::fetch::progress::DownloadProgress);
115+
pub struct DownloadResponse(pub crate::get::progress::DownloadProgress);
116116

117117
/// A request to the node to download and share the data specified by the hash.
118118
#[derive(Debug, Clone, Serialize, Deserialize)]

src/store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ pub mod readonly_mem;
1010
#[cfg(feature = "fs-store")]
1111
pub mod fs;
1212

13-
mod fetch_to_db;
14-
pub use fetch_to_db::{fetch_to_db, fetch_to_db_in_steps, FetchState, FetchStateNeedsConn};
13+
mod get_to_db;
14+
pub use get_to_db::{get_to_db, get_to_db_in_steps, FetchState, FetchStateNeedsConn};
1515
mod export;
1616
#[cfg(feature = "formats-collection")]
1717
pub use export::export_collection;

src/store/fetch_to_db.rs renamed to src/store/get_to_db.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tokio::sync::oneshot;
1515
use tracing::trace;
1616

1717
use crate::{
18-
fetch::{
18+
get::{
1919
self,
2020
fsm::{AtBlobHeader, AtEndBlob, ConnectedNext, EndBlobNext},
2121
progress::{BlobId, DownloadProgress},
@@ -42,7 +42,7 @@ type GetFuture = Pin<Box<dyn Future<Output = Result<Stats, Error>> + 'static>>;
4242
/// Progress is reported as [`DownloadProgress`] through a [`ProgressSender`]. Note that the
4343
/// [`DownloadProgress::AllDone`] event is not emitted from here, but left to an upper layer to send,
4444
/// if desired.
45-
pub async fn fetch_to_db<
45+
pub async fn get_to_db<
4646
D: BaoStore,
4747
C: FnOnce() -> F,
4848
F: Future<Output = anyhow::Result<Connection>>,
@@ -52,7 +52,7 @@ pub async fn fetch_to_db<
5252
hash_and_format: &HashAndFormat,
5353
progress_sender: impl ProgressSender<Msg = DownloadProgress> + IdGenerator,
5454
) -> Result<Stats, Error> {
55-
match fetch_to_db_in_steps(db.clone(), *hash_and_format, progress_sender).await? {
55+
match get_to_db_in_steps(db.clone(), *hash_and_format, progress_sender).await? {
5656
FetchState::Complete(res) => Ok(res),
5757
FetchState::NeedsConn(state) => {
5858
let conn = get_conn().await.map_err(Error::Io)?;
@@ -71,7 +71,7 @@ pub async fn fetch_to_db<
7171
/// proceed with the download.
7272
///
7373
/// Progress reporting works in the same way as documented in [`fetch_to_db`].
74-
pub async fn fetch_to_db_in_steps<
74+
pub async fn get_to_db_in_steps<
7575
D: BaoStore,
7676
P: ProgressSender<Msg = DownloadProgress> + IdGenerator,
7777
>(
@@ -194,7 +194,7 @@ async fn get_blob<D: BaoStore>(
194194
let request = GetRequest::new(*hash, RangeSpecSeq::from_ranges([required_ranges]));
195195
// full request
196196
let conn = co.get_conn().await;
197-
let request = fetch::fsm::start(conn, request);
197+
let request = get::fsm::start(conn, request);
198198
// create a new bidi stream
199199
let connected = request.next().await?;
200200
// next step. we have requested a single hash, so this must be StartRoot
@@ -210,7 +210,7 @@ async fn get_blob<D: BaoStore>(
210210
None => {
211211
// full request
212212
let conn = co.get_conn().await;
213-
let request = fetch::fsm::start(conn, GetRequest::single(*hash));
213+
let request = get::fsm::start(conn, GetRequest::single(*hash));
214214
// create a new bidi stream
215215
let connected = request.next().await?;
216216
// next step. we have requested a single hash, so this must be StartRoot
@@ -452,7 +452,7 @@ async fn get_hash_seq<D: BaoStore>(
452452
log!("requesting chunks {:?}", missing_iter);
453453
let request = GetRequest::new(*root_hash, RangeSpecSeq::from_ranges(missing_iter));
454454
let conn = co.get_conn().await;
455-
let request = fetch::fsm::start(conn, request);
455+
let request = get::fsm::start(conn, request);
456456
// create a new bidi stream
457457
let connected = request.next().await?;
458458
log!("connected");
@@ -498,7 +498,7 @@ async fn get_hash_seq<D: BaoStore>(
498498
tracing::debug!("don't have collection - doing full download");
499499
// don't have the collection, so probably got nothing
500500
let conn = co.get_conn().await;
501-
let request = fetch::fsm::start(conn, GetRequest::all(*root_hash));
501+
let request = get::fsm::start(conn, GetRequest::all(*root_hash));
502502
// create a new bidi stream
503503
let connected = request.next().await?;
504504
// next step. we have requested a single hash, so this must be StartRoot

0 commit comments

Comments
 (0)