rename catar into pxar

To avoid confusion with the casync implementation.
This commit is contained in:
Dietmar Maurer
2019-03-14 10:54:09 +01:00
parent 7c4dd94670
commit 8968258b66
16 changed files with 85 additions and 82 deletions

View File

@ -14,7 +14,7 @@ use proxmox_backup::client::*;
use proxmox_backup::backup::*;
//use proxmox_backup::backup::image_index::*;
//use proxmox_backup::config::datastore;
//use proxmox_backup::catar::encoder::*;
//use proxmox_backup::pxar::encoder::*;
//use proxmox_backup::backup::datastore::*;
use serde_json::{json, Value};
@ -26,7 +26,7 @@ use xdg::BaseDirectories;
use lazy_static::lazy_static;
lazy_static! {
static ref BACKUPSPEC_REGEX: Regex = Regex::new(r"^([a-zA-Z0-9_-]+\.(?:catar|raw)):(.+)$").unwrap();
static ref BACKUPSPEC_REGEX: Regex = Regex::new(r"^([a-zA-Z0-9_-]+\.(?:pxar|raw)):(.+)$").unwrap();
}
@ -129,13 +129,13 @@ fn backup_directory<P: AsRef<Path>>(
let query = tools::json_object_to_query(param)?;
let path = format!("api2/json/admin/datastore/{}/catar?{}", repo.store(), query);
let path = format!("api2/json/admin/datastore/{}/pxar?{}", repo.store(), query);
let stream = CaTarBackupStream::open(dir_path.as_ref(), all_file_systems, verbose)?;
let stream = PxarBackupStream::open(dir_path.as_ref(), all_file_systems, verbose)?;
let body = Body::wrap_stream(stream);
client.upload("application/x-proxmox-backup-catar", body, &path)?;
client.upload("application/x-proxmox-backup-pxar", body, &path)?;
Ok(())
}
@ -183,6 +183,7 @@ fn strip_chunked_file_expenstions(list: Vec<String>) -> Vec<String> {
result
}
/* not used:
fn list_backups(
param: Value,
_info: &ApiMethod,
@ -223,6 +224,7 @@ fn list_backups(
//Ok(result)
Ok(Value::Null)
}
*/
fn list_backup_groups(
param: Value,
@ -474,8 +476,8 @@ fn complete_backup_source(arg: &str, param: &HashMap<String, String>) -> Vec<Str
let data: Vec<&str> = arg.splitn(2, ':').collect();
if data.len() != 2 {
result.push(String::from("root.catar:/"));
result.push(String::from("etc.catar:/etc"));
result.push(String::from("root.pxar:/"));
result.push(String::from("etc.pxar:/etc"));
return result;
}
@ -544,13 +546,13 @@ fn restore(
let target = tools::required_string_param(&param, "target")?;
if archive_name.ends_with(".catar") {
let path = format!("api2/json/admin/datastore/{}/catar?{}", repo.store(), query);
if archive_name.ends_with(".pxar") {
let path = format!("api2/json/admin/datastore/{}/pxar?{}", repo.store(), query);
println!("DOWNLOAD FILE {} to {}", path, target);
let target = PathBuf::from(target);
let writer = CaTarBackupWriter::new(&target, true)?;
let writer = PxarBackupWriter::new(&target, true)?;
client.download(&path, Box::new(writer))?;
} else {
bail!("unknown file extensions - unable to download '{}'", archive_name);

View File

@ -12,9 +12,9 @@ use serde_json::{Value};
use std::io::{Read, Write};
use std::path::PathBuf;
use proxmox_backup::catar::format_definition::*;
use proxmox_backup::catar::encoder::*;
use proxmox_backup::catar::decoder::*;
use proxmox_backup::pxar::format_definition::*;
use proxmox_backup::pxar::encoder::*;
use proxmox_backup::pxar::decoder::*;
use proxmox_backup::tools::*;
@ -62,7 +62,7 @@ fn print_filenames(
let mut reader = std::io::BufReader::new(file);
let mut decoder = CaTarDecoder::new(&mut reader)?;
let mut decoder = PxarDecoder::new(&mut reader)?;
let root = decoder.root();
@ -86,7 +86,7 @@ fn dump_archive(
let archive = tools::required_string_param(&param, "archive")?;
let mut file = std::fs::File::open(archive)?;
println!("CATAR {}", archive);
println!("PXAR {}", archive);
let mut buffer = [0u8; 16];
@ -149,7 +149,7 @@ fn create_archive(
let mut writer = std::io::BufWriter::with_capacity(1024*1024, file);
CaTarEncoder::encode(source, &mut dir, &mut writer, all_file_systems, verbose)?;
PxarEncoder::encode(source, &mut dir, &mut writer, all_file_systems, verbose)?;
writer.flush()?;
@ -162,7 +162,7 @@ fn main() {
.insert("create", CliCommand::new(
ApiMethod::new(
create_archive,
ObjectSchema::new("Create new catar archive.")
ObjectSchema::new("Create new .pxar archive.")
.required("archive", StringSchema::new("Archive name"))
.required("source", StringSchema::new("Source directory."))
.optional("verbose", BooleanSchema::new("Verbose output.").default(false))