Skip to content

Commit 5f94924

Browse files
committed
feat(api): rename some structs
1 parent dfcc95f commit 5f94924

5 files changed

Lines changed: 26 additions & 28 deletions

File tree

src/app.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,14 +215,12 @@ impl App {
215215
SizeGetter::Size: Send + Sync + 'static,
216216
SizeGetter::Reporter: crate::reporter::Reporter<SizeGetter::Size>,
217217
{
218-
type Hook = hook::RecordHardLink<'static, Self::Size>;
219-
fn create_hook(record: &'static hook::RecordHardLinkStorage<Self::Size>) -> Self::Hook {
220-
hook::RecordHardLink::new(record)
218+
type Hook = hook::RecordHardlink<'static, Self::Size>;
219+
fn create_hook(record: &'static hook::HardlinkList<Self::Size>) -> Self::Hook {
220+
hook::RecordHardlink::new(record)
221221
}
222-
fn init_hardlink_record() -> &'static hook::RecordHardLinkStorage<Self::Size> {
223-
hook::RecordHardLinkStorage::new()
224-
.pipe(Box::new)
225-
.pipe(Box::leak)
222+
fn init_hardlink_record() -> &'static hook::HardlinkList<Self::Size> {
223+
hook::HardlinkList::new().pipe(Box::new).pipe(Box::leak)
226224
}
227225
}
228226

src/app/sub.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ pub trait DeduplicateHardlinkSizes<Size: size::Size> {
187187
}
188188

189189
#[cfg(unix)]
190-
impl<'a, Size> DeduplicateHardlinkSizes<Size> for hook::RecordHardLink<'a, Size>
190+
impl<'a, Size> DeduplicateHardlinkSizes<Size> for hook::RecordHardlink<'a, Size>
191191
where
192192
DataTree<OsStringDisplay, Size>: Send,
193193
Size: size::Size + Sync,
194194
{
195-
type HardlinkRecord = &'a hook::RecordHardLinkStorage<Size>;
196-
type DeduplicationReport = &'a hook::RecordHardLinkStorage<Size>;
195+
type HardlinkRecord = &'a hook::HardlinkList<Size>;
196+
type DeduplicationReport = &'a hook::HardlinkList<Size>;
197197

198198
fn deduplicate_hardlink_sizes(
199199
data_tree: &mut DataTree<OsStringDisplay, Size>,

src/hook.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,6 @@ impl<Size, Reporter> Hook<Size, Reporter> for DoNothing {
4141
#[cfg(unix)]
4242
pub mod record_hardlink;
4343
#[cfg(unix)]
44-
pub use record_hardlink::RecordHardLink;
44+
pub use record_hardlink::HardlinkList;
4545
#[cfg(unix)]
46-
pub use record_hardlink::RecordHardLinkStorage;
46+
pub use record_hardlink::RecordHardlink;

src/hook/record_hardlink.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
pub mod storage;
22

3-
pub use storage::RecordHardLinkStorage;
3+
pub use storage::HardlinkList;
44

55
use super::{Hook, HookArgument};
66
use crate::{
@@ -12,19 +12,19 @@ use std::{fmt::Debug, os::unix::fs::MetadataExt};
1212

1313
/// A [hook](Hook) that record files with more than 1 links.
1414
#[derive(Debug, Clone, Copy)]
15-
pub struct RecordHardLink<'a, Size> {
15+
pub struct RecordHardlink<'a, Size> {
1616
/// Map an inode number to its size and detected paths.
17-
storage: &'a RecordHardLinkStorage<Size>,
17+
storage: &'a HardlinkList<Size>,
1818
}
1919

20-
impl<'a, Size> RecordHardLink<'a, Size> {
20+
impl<'a, Size> RecordHardlink<'a, Size> {
2121
/// Create a [hook](Hook) to record files with more than 1 links.
22-
pub fn new(storage: &'a RecordHardLinkStorage<Size>) -> Self {
23-
RecordHardLink { storage }
22+
pub fn new(storage: &'a HardlinkList<Size>) -> Self {
23+
RecordHardlink { storage }
2424
}
2525
}
2626

27-
impl<'a, Size, Report> Hook<Size, Report> for RecordHardLink<'a, Size>
27+
impl<'a, Size, Report> Hook<Size, Report> for RecordHardlink<'a, Size>
2828
where
2929
Size: size::Size + Eq + Debug,
3030
Report: Reporter<Size> + ?Sized,

src/hook/record_hardlink/storage.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ use derive_more::{Display, Error};
44
use pipe_trait::Pipe;
55
use std::{fmt::Debug, path::Path};
66

7-
/// Storage to be used by [`crate::hook::RecordHardLink`].
7+
/// Storage to be used by [`crate::hook::RecordHardlink`].
88
#[derive(Debug, Clone)]
9-
pub struct RecordHardLinkStorage<Size>(
9+
pub struct HardlinkList<Size>(
1010
/// Map an inode number to its size and detected paths.
1111
DashMap<InodeNumber, (Size, LinkPathList)>, // TODO: benchmark against Mutex<HashMap<InodeNumber, (Size, LinkPathList)>>
1212
);
1313

14-
impl<Size> RecordHardLinkStorage<Size> {
14+
impl<Size> HardlinkList<Size> {
1515
/// Create a new record.
1616
pub fn new() -> Self {
17-
RecordHardLinkStorage(DashMap::new())
17+
HardlinkList(DashMap::new())
1818
}
1919

2020
/// Iterate over the recorded entries.
@@ -23,9 +23,9 @@ impl<Size> RecordHardLinkStorage<Size> {
2323
}
2424
}
2525

26-
impl<Size> Default for RecordHardLinkStorage<Size> {
26+
impl<Size> Default for HardlinkList<Size> {
2727
fn default() -> Self {
28-
RecordHardLinkStorage::new()
28+
HardlinkList::new()
2929
}
3030
}
3131

@@ -39,15 +39,15 @@ pub struct SizeConflictError<Size> {
3939
pub detected: Size,
4040
}
4141

42-
/// Error that occurs when it fails to add an item to [`RecordHardLinkStorage`].
42+
/// Error that occurs when it fails to add an item to [`RecordHardlinkStorage`].
4343
#[derive(Debug, Display, Error)]
4444
#[display(bound(Size: Debug))]
4545
#[non_exhaustive]
4646
pub enum AddError<Size> {
4747
SizeConflict(SizeConflictError<Size>),
4848
}
4949

50-
impl<Size> RecordHardLinkStorage<Size>
50+
impl<Size> HardlinkList<Size>
5151
where
5252
Size: size::Size,
5353
{
@@ -78,7 +78,7 @@ where
7878
}
7979
}
8080

81-
/// Iterator over entries in [`RecordHardLinkStorage`].
81+
/// Iterator over entries in [`RecordHardlinkStorage`].
8282
#[derive(derive_more::Debug)]
8383
#[debug(bound())]
8484
#[debug("Iter(..)")]

0 commit comments

Comments
 (0)