Skip to content

Commit f0f218d

Browse files
committed
Address review comments
1 parent 4529be6 commit f0f218d

File tree

3 files changed

+4
-22
lines changed

3 files changed

+4
-22
lines changed

src/store/fs.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1333,7 +1333,7 @@ impl FsStore {
13331333
.thread_name_fn(|| {
13341334
format!(
13351335
"iroh-blob-store-{}",
1336-
THREAD_NR.fetch_add(1, Ordering::SeqCst)
1336+
THREAD_NR.fetch_add(1, Ordering::Relaxed)
13371337
)
13381338
})
13391339
.enable_time()

src/store/fs/bao_file.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -531,10 +531,6 @@ impl entity_manager::Reset for BaoFileHandle {
531531
fn reset(&mut self) {
532532
self.send_replace(BaoFileStorage::Initial);
533533
}
534-
535-
fn ref_count(&self) -> usize {
536-
self.0.receiver_count() + self.0.sender_count()
537-
}
538534
}
539535

540536
/// A reader for a bao file, reading just the data.

src/store/fs/util/entity_manager.rs

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,6 @@ use tokio::sync::{mpsc, oneshot};
1212
pub trait Reset: Default {
1313
/// Reset the state to its default value.
1414
fn reset(&mut self);
15-
16-
/// A ref count to ensure that the state is unique when shutting down.
17-
///
18-
/// You are not allowed to clone the state out of a task, even though that
19-
/// is possible.
20-
fn ref_count(&self) -> usize;
2115
}
2216

2317
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
@@ -219,7 +213,6 @@ mod entity_actor {
219213
)
220214
.await
221215
.ok();
222-
assert_eq!(self.state.state.ref_count(), 1);
223216
P::on_shutdown(self.state.clone(), ShutdownCause::Idle).await;
224217
// Notify the main actor that we have completed shutdown.
225218
// here we also give back the rest of ourselves so the main actor can recycle us.
@@ -846,10 +839,6 @@ mod tests {
846839
fn reset(&mut self) {
847840
*self.0.borrow_mut() = Default::default();
848841
}
849-
850-
fn ref_count(&self) -> usize {
851-
Arc::strong_count(&self.0)
852-
}
853842
}
854843

855844
#[derive(Debug, Default)]
@@ -971,8 +960,9 @@ mod tests {
971960
for id in values.keys() {
972961
let log = global.log.get(id).unwrap();
973962
if log.len() % 2 != 0 {
974-
println!("{log:#?}");
975-
panic!("Log for entity {id} must contain an even number of events");
963+
panic!(
964+
"Log for entity {id} must contain an even number of events.\n{log:#?}"
965+
);
976966
}
977967
for (i, (event, _)) in log.iter().enumerate() {
978968
assert_eq!(
@@ -1106,10 +1096,6 @@ mod tests {
11061096
fn reset(&mut self) {
11071097
*self.0.borrow_mut() = Default::default();
11081098
}
1109-
1110-
fn ref_count(&self) -> usize {
1111-
1
1112-
}
11131099
}
11141100

11151101
fn get_path(root: impl AsRef<Path>, id: u64) -> PathBuf {

0 commit comments

Comments
 (0)