8000 Add reflink_block function by Vaiz · Pull Request #85 · cargo-bins/reflink-copy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Add reflink_block function #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
Jan 11, 2025
Merged

Add reflink_block function #85

merged 23 commits into from
Jan 11, 2025

Conversation

Vaiz
Copy link
@Vaiz Vaiz commented Nov 25, 2024

Adding block-level reflink capabilities allows for more granular and efficient data management. This can be particularly beneficial for applications that need to clone or deduplicate specific segments of large files.

Details:

  • PR replaces --ignored with --include-ignored for cargo test to enable all tests
  • it includes only windows implementation of reflink_block, although it should be possible to add linux support in the future without changing function signature
  • reflink_block accepts immutable reference to target file to allow calling this function on the same file

issue: #80

Copy link
Member
@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

I think we need to work on the API, the current API is not cross-platform and have too many platform dependent details

src/lib.rs Outdated
Comment on lines 204 to 206
/// - The destination region must not extend past the end of file. If the application wishes to
/// extend the destination with cloned data, it must first call
/// [`File::set_len`](fn@std::fs::File::set_len).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm...

File::set_len is probably cheap on Linux, but this still makes the API slightly different on different platforms.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In most cases, it should be possible to preallocate required space for the file on any platform. I would it as a better approach than writing platform specific code. We can add to documentation later

8000
Co-authored-by: Jiahao XU <30436523+NobodyXu@users.noreply.github.com>
Signed-off-by: Vaiz <4908982+Vaiz@users.noreply.github.com>
@Vaiz
Copy link
Author
Vaiz commented Dec 1, 2024

@NobodyXu , hey,

I won't have time to work on this PR in December. There's no rush to get it merged, so we can either leave it as is for now, or I can create a new PR later. If you prefer, feel free to finish it yourself

@NobodyXu
Copy link
Member
NobodyXu commented Dec 2, 2024

That's totally fine, it's almost Christmas time and everyone is taking a break to relax themselves.

There is no need to rush anything, wish you have a nice Christmas!

Copy link
Member
@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

A few comments about improving builder and the doc

* remove commented code
* move mandatory arguments to constructor
@Vaiz Vaiz requested a review from NobodyXu January 11, 2025 20:13
Copy link
Member
@NobodyXu NobodyXu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@NobodyXu NobodyXu merged commit 6c937d6 into cargo-bins:main Jan 11, 2025
18 checks passed
@github-actions github-actions bot mentioned this pull request Jan 11, 2025
@Vaiz Vaiz deleted the reflink_block branch January 12, 2025 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0