Draft: Introduce high level sftp file transfer api
Add a description of the new feature/bug fix. Reference any relevant bugs.
Checklist
-
Commits have Signed-off-by:
with name/author being identical to the commit author -
Code modified for feature -
Test suite updated with functionality tests -
Test suite updated with negative tests -
Documentation updated
Reviewer's checklist:
-
Any issues marked for closing are addressed -
There is a test suite reasonably covering new functionality or modifications -
Function naming, parameters, return values, types, etc., are consistent and according to CONTRIBUTING.md -
This feature/change has adequate documentation added -
No obvious mistakes in the code
Summary by Sourcery
Introduce a new high-level SFTP FT subsystem in libssh to simplify file transfers (upload, download, remote copy) with extended resume, metric tracking, and progress callback support, alongside a copy-range extension and buffer file I/O utilities, complete with tests, benchmarks, and documentation.
New Features:
- Introduce high-level SFTP file transfer API supporting upload, download, and remote copy with resume, metrics, and progress callbacks
- Implement sftp_copy_file_range to leverage the SFTP "copy-data" extension for direct file‐to‐file copying
- Add ssh_buffer_file_read and ssh_buffer_file_write helper APIs to load/store data between ssh_buffer and local files
Enhancements:
- Expose file transfer metrics (bytes transferred, total, skipped) via sftp_ft_get_* functions
- Support configurable chunk sizes and concurrent request counts in SFTP transfers
- Integrate SFTP FT API into existing benchmarks with new options for upload, download, and remote copy
Build:
- Update CMakeLists to compile and link new sftp_ft module and include corresponding tests and benchmarks
Documentation:
- Add user-facing documentation for the SFTP FT API in doc/sftp_ft.dox
Tests:
- Add comprehensive cmocka tests for the new SFTP FT API (including resume, chunk/request variations, and target file modes)
- Add torture tests for sftp_copy_file_range and new buffer read/write functions
- Extend unittests to cover ssh_buffer_file_read and ssh_buffer_file_write behaviors
Edited by sourcery-ai