rename PxarBackupWriter into PxarDecodeWriter
This commit is contained in:
parent
b005ed12d5
commit
5defa71bf9
@ -552,7 +552,7 @@ fn restore(
|
||||
println!("DOWNLOAD FILE {} to {}", path, target);
|
||||
|
||||
let target = PathBuf::from(target);
|
||||
let writer = PxarBackupWriter::new(&target, true)?;
|
||||
let writer = PxarDecodeWriter::new(&target, true)?;
|
||||
client.download(&path, Box::new(writer))?;
|
||||
} else {
|
||||
bail!("unknown file extensions - unable to download '{}'", archive_name);
|
||||
|
@ -9,12 +9,12 @@ use crate::pxar::decoder::*;
|
||||
|
||||
/// Writer implementation to deccode a .pxar archive (download).
|
||||
|
||||
pub struct PxarBackupWriter {
|
||||
pub struct PxarDecodeWriter {
|
||||
pipe: Option<std::fs::File>,
|
||||
child: Option<thread::JoinHandle<()>>,
|
||||
}
|
||||
|
||||
impl Drop for PxarBackupWriter {
|
||||
impl Drop for PxarDecodeWriter {
|
||||
|
||||
fn drop(&mut self) {
|
||||
drop(self.pipe.take());
|
||||
@ -22,9 +22,9 @@ impl Drop for PxarBackupWriter {
|
||||
}
|
||||
}
|
||||
|
||||
impl PxarBackupWriter {
|
||||
impl PxarDecodeWriter {
|
||||
|
||||
pub fn new(base: &Path, _verbose: bool) -> Result<Self, Error> {
|
||||
pub fn new(base: &Path, verbose: bool) -> Result<Self, Error> {
|
||||
let (rx, tx) = nix::unistd::pipe()?;
|
||||
|
||||
let base = PathBuf::from(base);
|
||||
@ -32,10 +32,11 @@ impl PxarBackupWriter {
|
||||
let child = thread::spawn(move|| {
|
||||
let mut reader = unsafe { std::fs::File::from_raw_fd(rx) };
|
||||
let mut decoder = PxarDecoder::new(&mut reader);
|
||||
|
||||
|
||||
|
||||
if let Err(err) = decoder.restore(&base, & |path| {
|
||||
println!("RESTORE: {:?}", path);
|
||||
if verbose {
|
||||
println!("RESTORE: {:?}", path);
|
||||
}
|
||||
Ok(())
|
||||
}) {
|
||||
eprintln!("pxar decode failed - {}", err);
|
||||
@ -48,7 +49,7 @@ impl PxarBackupWriter {
|
||||
}
|
||||
}
|
||||
|
||||
impl Write for PxarBackupWriter {
|
||||
impl Write for PxarDecodeWriter {
|
||||
|
||||
fn write(&mut self, buffer: &[u8]) -> Result<usize, std::io::Error> {
|
||||
let pipe = match self.pipe {
|
||||
|
Loading…
Reference in New Issue
Block a user