Skip to content

Conversation

@pushkarm029
Copy link
Collaborator

  • Added run_ready_to_receive and run_send_files_to functions to facilitate file transfers.
  • Introduced ReadyToReceiveSubscriber and SendFilesToSubscriber traits for event handling.
  • Enhanced CLI with new arguments for waiting to receive files and sending files to a receiver.
  • Updated Cargo.toml dependencies and added new modules for handling ready-to-receive operations.
  • Improved logging and progress tracking during file transfers.

This Pull request enhances the user experience by allowing receivers to generate QR codes for easy connection and enabling senders to connect to waiting receivers using tickets and confirmation codes.

…re CLI

- Added `run_ready_to_receive` and `run_send_files_to` functions to facilitate file transfers.
- Introduced `ReadyToReceiveSubscriber` and `SendFilesToSubscriber` traits for event handling.
- Enhanced CLI with new arguments for waiting to receive files and sending files to a receiver.
- Updated Cargo.toml dependencies and added new modules for handling ready-to-receive operations.
- Improved logging and progress tracking during file transfers.

This commit enhances the user experience by allowing receivers to generate QR codes for easy connection and enabling senders to connect to waiting receivers using tickets and confirmation codes.

Signed-off-by: Pushkar Mishra <[email protected]>
- Added `prompt_for_credentials` function for asynchronous user input of peer credentials.
- Introduced QR code generation for ticket and confirmation codes to facilitate file transfers.
- Updated CLI commands to allow for manual credential entry and improved user prompts.
- Enhanced logging and error handling throughout the file transfer process.
- Updated dependencies in `Cargo.toml` to include `qrcode` for QR code functionality.

These changes improve the user experience by providing a seamless way to connect senders and receivers through QR codes or manual input of credentials.

Signed-off-by: Pushkar Mishra <[email protected]>
Signed-off-by: Pushkar Mishra <[email protected]>
Signed-off-by: Pushkar Mishra <[email protected]>
Signed-off-by: Pushkar Mishra <[email protected]>
@github-actions
Copy link

Benchmark for fe26a8e

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.3±0.80µs 255.7±1.63µs +2.16%
blake3_resource_id_creation/compute_from_bytes:medium 15.9±0.05µs 15.9±0.06µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1380.9±8.44ns 1429.9±2.01ns +3.55%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 194.3±0.48µs 199.6±0.56µs +2.73%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1707.6±4.07µs 1734.0±21.20µs +1.55%
crc32_resource_id_creation/compute_from_bytes:large 87.4±0.33µs 87.4±0.28µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.02µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.1±0.40ns 93.1±0.30ns 0.00%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 62.9±0.24µs 62.9±0.56µs 0.00%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 914.1±2.88µs 1183.2±8.81µs +29.44%
resource_index/index_build//tmp/ark-fs-index-benchmarks3yEmgy 100.3±1.58ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksStoOol 98.5±1.23ms N/A N/A
resource_index/index_get_resource_by_id 100.7±1.36ns 102.2±1.45ns +1.49%
resource_index/index_get_resource_by_path 64.5±0.22ns 64.8±0.40ns +0.47%
resource_index/index_update_all 1079.5±39.46ms 1127.2±81.61ms +4.42%
resource_index/index_update_one 649.7±23.90ms 652.7±25.57ms +0.46%

@pushkarm029
Copy link
Collaborator Author

@oluiscabral please review

…e QR code functionality

- Updated `Cargo.toml` to streamline dependency paths and remove duplicates.
- Refactored imports in CLI and exchanges to use `arkdrop` namespaces consistently.
- Improved QR code display and handling in file transfer processes for better user experience.
- Cleaned up unused code and improved error handling in file receiving and sending logic.

These changes enhance the maintainability of the codebase and improve the overall user experience during file transfers.

Signed-off-by: Pushkar Mishra <[email protected]>
…ore CLI and receiver

- Replaced `std::process::exit(0)` with `Ok(())` in file transfer cancellation and completion logic to improve error handling and maintain control flow.
- Updated the `Carrier` implementation to enhance error management during task completion.

These changes enhance the robustness of the file transfer process by allowing for better error propagation and control flow management.

Signed-off-by: Pushkar Mishra <[email protected]>
@github-actions
Copy link

Benchmark for c703179

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 250.4±6.32µs 250.3±2.35µs -0.04%
blake3_resource_id_creation/compute_from_bytes:medium 15.6±0.05µs 15.6±0.02µs 0.00%
blake3_resource_id_creation/compute_from_bytes:small 1380.6±26.30ns 1406.4±26.82ns +1.87%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 194.3±0.54µs 194.2±0.42µs -0.05%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1708.9±4.29µs 1712.2±19.74µs +0.19%
crc32_resource_id_creation/compute_from_bytes:large 87.2±0.21µs 87.3±0.38µs +0.11%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.03µs 5.4±0.02µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.1±0.22ns 93.2±0.60ns +0.11%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 63.3±0.14µs 63.5±0.83µs +0.32%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 952.4±8.44µs 955.6±3.89µs +0.34%
resource_index/index_build//tmp/ark-fs-index-benchmarks0VCOgY 98.0±2.29ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksMUvYTk 97.9±2.49ms N/A N/A
resource_index/index_get_resource_by_id 120.3±1.44ns 98.3±0.47ns -18.29%
resource_index/index_get_resource_by_path 57.9±0.55ns 57.8±0.34ns -0.17%
resource_index/index_update_all 1076.2±48.43ms 1175.5±86.02ms +9.23%
resource_index/index_update_one 659.3±28.82ms 672.8±31.92ms +2.05%

@github-actions
Copy link

Benchmark for b7830ad

Click to view benchmark
Test Base PR %
blake3_resource_id_creation/compute_from_bytes:large 249.8±1.74µs 249.8±2.39µs 0.00%
blake3_resource_id_creation/compute_from_bytes:medium 15.7±0.04µs 15.6±0.07µs -0.64%
blake3_resource_id_creation/compute_from_bytes:small 1396.8±26.49ns 1375.5±26.40ns -1.52%
blake3_resource_id_creation/compute_from_path:../test-assets/lena.jpg 199.0±0.33µs 194.2±0.75µs -2.41%
blake3_resource_id_creation/compute_from_path:../test-assets/test.pdf 1744.7±16.62µs 1721.8±49.48µs -1.31%
crc32_resource_id_creation/compute_from_bytes:large 87.3±0.27µs 87.3±0.35µs 0.00%
crc32_resource_id_creation/compute_from_bytes:medium 5.4±0.04µs 5.4±0.03µs 0.00%
crc32_resource_id_creation/compute_from_bytes:small 93.2±0.34ns 93.4±0.96ns +0.21%
crc32_resource_id_creation/compute_from_path:../test-assets/lena.jpg 63.2±0.36µs 63.7±0.55µs +0.79%
crc32_resource_id_creation/compute_from_path:../test-assets/test.pdf 955.2±9.74µs 955.4±11.45µs +0.02%
resource_index/index_build//tmp/ark-fs-index-benchmarksUIV18s 103.7±1.58ms N/A N/A
resource_index/index_build//tmp/ark-fs-index-benchmarksmUFWhs 103.1±1.59ms N/A N/A
resource_index/index_get_resource_by_id 99.0±0.37ns 98.3±1.68ns -0.71%
resource_index/index_get_resource_by_path 58.1±0.24ns 61.4±1.07ns +5.68%
resource_index/index_update_all 1096.8±42.67ms 1164.4±74.54ms +6.16%
resource_index/index_update_one 666.8±25.15ms 675.5±31.02ms +1.30%

- Introduced new subcommands `wait-to-receive` and `send-to` for improved file transfer functionality.
- Implemented argument parsing for both commands, allowing users to specify output directories, display names, and avatar options.
- Enhanced the handling of file transfers with dedicated functions for waiting to receive files and sending files to a receiver.

These changes enhance the usability of the CLI by providing clear commands for file transfer operations, improving the overall user experience.

Signed-off-by: Pushkar Mishra <[email protected]>
- Improved error messages for accessing progress bars, file handles, and directory creation, providing clearer feedback during file transfer operations.
- Refactored file length retrieval to use metadata for efficiency, reducing the complexity of the `len` function.
- Enhanced logging for handshake and file reception failures in the `ReadyToReceiveHandler`, improving traceability of issues.

These changes improve the robustness and user experience of the file transfer process by ensuring better error reporting and handling.

Signed-off-by: Pushkar Mishra <[email protected]>
- Added new managers for handling sending files to a receiver and ready to receive operations.
- Introduced new TUI pages for sending files to a receiver and monitoring the progress of file transfers.
- Enhanced the home application to include options for sending files to and waiting to receive files, with corresponding navigation and status updates.
- Implemented QR code rendering utilities for better user experience during file transfers.

These changes significantly improve the file transfer capabilities of the TUI, providing users with clear options and feedback during the process.

Signed-off-by: Pushkar Mishra <[email protected]>
- Added clipboard utility for copying text to the system clipboard, enhancing user experience during file transfers.
- Updated various TUI components to streamline return statements and improve code readability.
- Introduced new shortcuts for copying ticket and confirmation codes in the ready-to-receive and send files progress screens.
- Refactored layout and helper footer components for better organization and clarity.

These changes improve the overall usability and maintainability of the TUI, providing users with more intuitive interactions during file transfer operations.

Signed-off-by: Pushkar Mishra <[email protected]>
- Increased the length constraint for connection info from 5 to 6 to accommodate additional information.
- Adjusted the footer length constraint from 4 to 5 for better alignment and presentation.

These changes enhance the user interface of the TUI, ensuring that all necessary information is displayed clearly during file transfer operations.

Signed-off-by: Pushkar Mishra <[email protected]>
…ake module

- Deleted the `prompt_for_credentials` function from the handshake module, as it is no longer needed.
- This cleanup helps streamline the codebase by removing unnecessary components.

Signed-off-by: Pushkar Mishra <[email protected]>
Copy link
Collaborator

@oluiscabral oluiscabral left a comment

Choose a reason for hiding this comment

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

LGTM


I created a few tickets based on this review, but they're not blocking. We can merge it, move on and then look back at them on another PR

Comment on lines +736 to +764
let is_reader_none = match self.reader.read() {
Ok(guard) => guard.is_none(),
Err(e) => {
eprintln!(
"Error acquiring read lock for file {}: {}",
self.path.display(),
e
);
self.is_finished
.store(true, std::sync::atomic::Ordering::Relaxed);
return None;
}
};

if is_reader_none {
match std::fs::File::open(&self.path) {
Ok(file) => {
*self.reader.write().unwrap() = Some(file);
}
Ok(file) => match self.reader.write() {
Ok(mut guard) => *guard = Some(file),
Err(e) => {
eprintln!(
"Error acquiring write lock for file {}: {}",
self.path.display(),
e
);
self.is_finished
.store(true, std::sync::atomic::Ordering::Relaxed);
return None;
}
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good stuff!

As note, I'll add a ticket for our team to discuss if a byte-by-byte reading is really needed 🤔

Maybe it's adding just extra complexity for us to handle, since it's not actually being used by any external consumer

Copy link
Collaborator

@oluiscabral oluiscabral left a comment

Choose a reason for hiding this comment

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

The newly added use cases should be added to the bindings API (drop.udl)

- Introduced new `SendFilesToRequest` and `ReadyToReceiveRequest` structures to facilitate sending files to a receiver and waiting for a sender, respectively.
- Implemented `SendFilesToBubble` and `ReadyToReceiveBubble` interfaces to manage the lifecycle of these sessions, including methods for starting, canceling, and subscribing to events.
- Added necessary subscriber interfaces for both sender and receiver to handle progress notifications and connection events.
- Updated the `drop.udl` file to define the new data structures and interfaces, enhancing the overall file transfer capabilities.

These changes significantly improve the file transfer process by providing clear mechanisms for both sending and receiving files, enhancing user experience and functionality.

Signed-off-by: Pushkar Mishra <[email protected]>
Copy link
Collaborator

@oluiscabral oluiscabral left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me

There's just a question regarding why SenderFileDataAdapter has become public

@kirillt
Copy link
Member

kirillt commented Dec 25, 2025

Also formatter complains 😉

- Updated import statements in `home.rs`, `send_files_to.rs`, and `ready_to_receive.rs` for improved readability and organization.
- Enhanced comments in `ready_to_receive_manager.rs` and `send_files_progress.rs` to clarify functionality and maintain consistency in code style.
- Adjusted layout constraints in `send_files_to.rs` for better alignment and presentation.

These changes contribute to a cleaner and more maintainable codebase, enhancing overall developer experience.

Signed-off-by: Pushkar Mishra <[email protected]>
- Introduced a new step to free disk space in the GitHub Actions workflow for Android bindings, optimizing resource usage during the build process.
- Configured options to manage tool cache, .NET, Haskell, large packages, Docker images, and swap storage.

These changes enhance the efficiency of the build process by ensuring adequate disk space is available, contributing to smoother CI/CD operations.

Signed-off-by: Pushkar Mishra <[email protected]>
- Removed `pub(crate)` visibility from the `SenderFileDataAdapter` struct and its `inner` field to streamline access control.
- This change simplifies the interface while maintaining encapsulation, contributing to a cleaner codebase.

Signed-off-by: Pushkar Mishra <[email protected]>
Copy link
Collaborator

@oluiscabral oluiscabral left a comment

Choose a reason for hiding this comment

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

LGTM

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.

4 participants