use failure::*; use nix::unistd::{fork, ForkResult, pipe}; use std::os::unix::io::RawFd; use chrono::{Local, Utc, TimeZone}; use std::path::{Path, PathBuf}; use std::collections::{HashSet, HashMap}; use std::ffi::OsStr; use std::io::{Write, Seek, SeekFrom}; use std::os::unix::fs::OpenOptionsExt; use proxmox::{sortable, identity}; use proxmox::tools::fs::{file_get_contents, file_get_json, replace_file, CreateOptions, image_size}; use proxmox::api::{ApiHandler, ApiMethod, RpcEnvironment}; use proxmox::api::schema::*; use proxmox::api::cli::*; use proxmox::api::api; use proxmox_backup::tools; use proxmox_backup::api2::types::*; use proxmox_backup::client::*; use proxmox_backup::backup::*; use proxmox_backup::pxar::{ self, catalog::* }; //use proxmox_backup::backup::image_index::*; //use proxmox_backup::config::datastore; //use proxmox_backup::pxar::encoder::*; //use proxmox_backup::backup::datastore::*; use serde_json::{json, Value}; //use hyper::Body; use std::sync::{Arc, Mutex}; //use regex::Regex; use xdg::BaseDirectories; use futures::*; use tokio::sync::mpsc; proxmox::api::const_regex! { BACKUPSPEC_REGEX = r"^([a-zA-Z0-9_-]+\.(?:pxar|img|conf|log)):(.+)$"; } const REPO_URL_SCHEMA: Schema = StringSchema::new("Repository URL.") .format(&BACKUP_REPO_URL) .max_length(256) .schema(); const BACKUP_SOURCE_SCHEMA: Schema = StringSchema::new( "Backup source specification ([