Skip to content

Add more advanced API #80

@Vaiz

Description

@Vaiz

First of all, thank you for maintaining this useful crate!

I would like to propose a few new additions to the API that I believe would benefit crate's users.

Return the operation used in reflink_or_copy

reflink_or_copy should return an enum indicating the operation performed:

enum OperationResult { Cloned, Copied }

This provides clearer feedback to the caller about the action taken. It can be useful for understanding the efficiency of cloning, space consumption, etc.

Add more functions:

  • fn is_reflink_supported(from: impl AsRef<Path>, to: impl AsRef<Path>) -> Result<SupportedStatus>
    enum SupportedStatus { Supported, NotSupported, Unknown }

This function would help to avoid unnecessary API calls if reflink is not supported, especially when copying large folders. It would also prevent unnecessary copying if cloning is expected to work. For example, blockcloning is not supported between different ReFS volumes, so it would be quite inefficient to use this function for copying a large directory.

  • fn reflink_block(file1: FileHandle, offset1: u64, size: u64, file2: FileHandle, offset2: u64) -> Result<()>

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions