D2: remote browser operations, compare and sync in lutra-deploy

Remote trait gains remove_file, remove_dir and rename (SFTP, FTP,
folder; test servers too). browse: list, read as text (binary and size
caps), write, rename, mkdir, recursive delete that never takes the root.
job: compare (local only, server only, different by size then
contents) and sync (uploads plus explicitly listed deletions).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
danny 2026-11-06 19:38:07 +01:00
parent 064f40839f
commit a8ad74755c
10 changed files with 854 additions and 29 deletions

View file

@ -445,6 +445,24 @@ impl Remote for Sftp {
Ok(entries)
}
fn remove_file(&mut self, path: &str) -> Result<()> {
self.run("removing a file", self.sftp.remove_file(path.to_string()))?
.map_err(|e| sftp_error("cannot remove", path, &e))
}
fn remove_dir(&mut self, path: &str) -> Result<()> {
self.run("removing a folder", self.sftp.remove_dir(path.to_string()))?
.map_err(|e| sftp_error("cannot remove the folder", path, &e))
}
fn rename(&mut self, from: &str, to: &str) -> Result<()> {
self.run(
"renaming",
self.sftp.rename(from.to_string(), to.to_string()),
)?
.map_err(|e| sftp_error(&format!("cannot rename to {to}:"), from, &e))
}
/// Closes the SFTP channel and the connection. Failures are ignored:
/// the connection is dropped right after.
fn close(&mut self) {