Skip to content

Commit 51a6869

Browse files
committed
Remove create_is_missing
instead handle the error in remote.
1 parent dd59017 commit 51a6869

File tree

5 files changed

+6
-17
lines changed

5 files changed

+6
-17
lines changed

src/api/blobs.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,6 @@ impl Blobs {
302302
ExportBaoRequest {
303303
hash: hash.into(),
304304
ranges: ranges.into(),
305-
create_if_missing: false,
306305
},
307306
32,
308307
)

src/api/proto.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ pub struct ObserveRequest {
222222
pub struct ExportBaoRequest {
223223
pub hash: Hash,
224224
pub ranges: ChunkRanges,
225-
pub create_if_missing: bool,
226225
}
227226

228227
/// Export the given ranges as chunkks, without validation.

src/api/remote.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -420,14 +420,14 @@ impl Remote {
420420
let opts = ExportBaoOptions {
421421
hash: root,
422422
ranges: bitfield.ranges.clone(),
423-
create_if_missing: true,
424423
};
425424
let bao = self.store().export_bao_with_opts(opts, 32);
426425
let mut by_index = BTreeMap::new();
427426
let mut stream = bao.hashes_with_index();
428427
while let Some(item) = stream.next().await {
429-
let (index, hash) = item?;
430-
by_index.insert(index, hash);
428+
if let Ok((index, hash)) = item {
429+
by_index.insert(index, hash);
430+
}
431431
}
432432
let mut bitfields = BTreeMap::new();
433433
let mut hash_seq = BTreeMap::new();

src/store/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1028,7 +1028,7 @@ async fn export_ranges_impl(
10281028

10291029
#[instrument(skip_all, fields(hash = %cmd.hash_short()))]
10301030
async fn export_bao(mut cmd: ExportBaoMsg, ctx: HashContext) {
1031-
match ctx.get_maybe_create(cmd.hash, cmd.create_if_missing).await {
1031+
match ctx.get_maybe_create(cmd.hash, false).await {
10321032
Ok(handle) => {
10331033
if let Err(cause) = export_bao_impl(cmd.inner, &mut cmd.tx, handle).await {
10341034
cmd.tx

src/store/mem.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -190,20 +190,11 @@ impl Actor {
190190
self.spawn(import_path(cmd));
191191
}
192192
Command::ExportBao(ExportBaoMsg {
193-
inner:
194-
ExportBaoRequest {
195-
hash,
196-
ranges,
197-
create_if_missing,
198-
},
193+
inner: ExportBaoRequest { hash, ranges },
199194
tx,
200195
..
201196
}) => {
202-
let entry = if create_if_missing {
203-
Some(self.get_or_create_entry(hash))
204-
} else {
205-
self.get(&hash)
206-
};
197+
let entry = self.get(&hash);
207198
self.spawn(export_bao(entry, ranges, tx))
208199
}
209200
Command::ExportPath(cmd) => {

0 commit comments

Comments
 (0)