ref code
This commit is contained in:
@@ -101,8 +101,7 @@ fn real_make_oss_key(oss_backupd_config: &OSSBackupdConfig, oss_backupd_config_i
|
|||||||
key.push_str("/");
|
key.push_str("/");
|
||||||
key.push_str(&oss_backupd_config_item.get_file_name());
|
key.push_str(&oss_backupd_config_item.get_file_name());
|
||||||
key.push_str("_");
|
key.push_str("_");
|
||||||
let ymdhms = Utc::now().format("%Y%m%d_%H%M%S").to_string();
|
key.push_str(&get_now_ymdhms());
|
||||||
key.push_str(&ymdhms);
|
|
||||||
|
|
||||||
if !suffix.is_empty() {
|
if !suffix.is_empty() {
|
||||||
key.push_str(&format!(".{}", suffix));
|
key.push_str(&format!(".{}", suffix));
|
||||||
@@ -111,6 +110,10 @@ fn real_make_oss_key(oss_backupd_config: &OSSBackupdConfig, oss_backupd_config_i
|
|||||||
key
|
key
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn get_now_ymdhms() -> String {
|
||||||
|
Utc::now().format("%Y%m%d_%H%M%S").to_string()
|
||||||
|
}
|
||||||
|
|
||||||
pub fn remove_start_end_slash(s: &str) -> String {
|
pub fn remove_start_end_slash(s: &str) -> String {
|
||||||
let mut ss = s;
|
let mut ss = s;
|
||||||
while ss.starts_with("/") {
|
while ss.starts_with("/") {
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ impl Options {
|
|||||||
Options {
|
Options {
|
||||||
version: false,
|
version: false,
|
||||||
verbose: false,
|
verbose: false,
|
||||||
config: "".to_string(),
|
config: "".to_owned(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,5 +125,3 @@ fn get_current_secs() -> u64 {
|
|||||||
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()
|
SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap().as_secs()
|
||||||
}
|
}
|
||||||
|
|
||||||
// use sync meta.txt file ?
|
|
||||||
// record valid files ...
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ pub fn zip_file(target: &str, zip_file: &str) -> XResult<()> {
|
|||||||
copy_io_with_head(&mut File::open(target_path)?, &mut zip, -1, "Compressing")?;
|
copy_io_with_head(&mut File::open(target_path)?, &mut zip, -1, "Compressing")?;
|
||||||
|
|
||||||
zip.finish()?;
|
zip.finish()?;
|
||||||
} else {
|
} else { // TODO when target is PATH!
|
||||||
let mut_zip = RefCell::new(zip);
|
let mut_zip = RefCell::new(zip);
|
||||||
walk_dir(&target_path, &|p, e| {
|
walk_dir(&target_path, &|p, e| {
|
||||||
print_message(MessageType::WARN, &format!("Compress {} failed: {}", &p.display(), &e));
|
print_message(MessageType::WARN, &format!("Compress {} failed: {}", &p.display(), &e));
|
||||||
|
|||||||
Reference in New Issue
Block a user