mirror of https://github.com/dswd/zvault
Add date to bundles
This commit is contained in:
parent
d06149979a
commit
afef4004bd
|
@ -97,7 +97,8 @@ pub struct BundleInfo {
|
||||||
pub raw_size: usize,
|
pub raw_size: usize,
|
||||||
pub encoded_size: usize,
|
pub encoded_size: usize,
|
||||||
pub chunk_count: usize,
|
pub chunk_count: usize,
|
||||||
pub chunk_list_size: usize
|
pub chunk_list_size: usize,
|
||||||
|
pub timestamp: i64
|
||||||
}
|
}
|
||||||
serde_impl!(BundleInfo(u64?) {
|
serde_impl!(BundleInfo(u64?) {
|
||||||
id: BundleId => 0,
|
id: BundleId => 0,
|
||||||
|
@ -108,7 +109,8 @@ serde_impl!(BundleInfo(u64?) {
|
||||||
raw_size: usize => 6,
|
raw_size: usize => 6,
|
||||||
encoded_size: usize => 7,
|
encoded_size: usize => 7,
|
||||||
chunk_count: usize => 8,
|
chunk_count: usize => 8,
|
||||||
chunk_list_size: usize => 9
|
chunk_list_size: usize => 9,
|
||||||
|
timestamp: i64 => 10
|
||||||
});
|
});
|
||||||
|
|
||||||
impl Default for BundleInfo {
|
impl Default for BundleInfo {
|
||||||
|
@ -122,7 +124,8 @@ impl Default for BundleInfo {
|
||||||
encoded_size: 0,
|
encoded_size: 0,
|
||||||
chunk_count: 0,
|
chunk_count: 0,
|
||||||
mode: BundleMode::Data,
|
mode: BundleMode::Data,
|
||||||
chunk_list_size: 0
|
chunk_list_size: 0,
|
||||||
|
timestamp: 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,8 @@ use std::fs::File;
|
||||||
use std::io::{self, Write, BufWriter};
|
use std::io::{self, Write, BufWriter};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
|
use chrono::prelude::*;
|
||||||
|
|
||||||
|
|
||||||
quick_error!{
|
quick_error!{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
@ -114,7 +116,8 @@ impl BundleWriter {
|
||||||
id: id.clone(),
|
id: id.clone(),
|
||||||
raw_size: self.raw_size,
|
raw_size: self.raw_size,
|
||||||
encoded_size: encoded_size,
|
encoded_size: encoded_size,
|
||||||
chunk_list_size: chunk_data.len()
|
chunk_list_size: chunk_data.len(),
|
||||||
|
timestamp: Local::now().timestamp()
|
||||||
};
|
};
|
||||||
let mut info_data = try!(msgpack::encode(&info).context(&path as &Path));
|
let mut info_data = try!(msgpack::encode(&info).context(&path as &Path));
|
||||||
if let Some(ref encryption) = self.encryption {
|
if let Some(ref encryption) = self.encryption {
|
||||||
|
|
|
@ -213,6 +213,7 @@ fn print_bundle(bundle: &StoredBundle) {
|
||||||
println!("Bundle {}", bundle.info.id);
|
println!("Bundle {}", bundle.info.id);
|
||||||
println!(" - Mode: {:?}", bundle.info.mode);
|
println!(" - Mode: {:?}", bundle.info.mode);
|
||||||
println!(" - Path: {:?}", bundle.path);
|
println!(" - Path: {:?}", bundle.path);
|
||||||
|
println!(" - Date: {}", Local.timestamp(bundle.info.timestamp, 0).to_rfc2822());
|
||||||
println!(" - Hash method: {:?}", bundle.info.hash_method);
|
println!(" - Hash method: {:?}", bundle.info.hash_method);
|
||||||
let encryption = if let Some((_, ref key)) = bundle.info.encryption {
|
let encryption = if let Some((_, ref key)) = bundle.info.encryption {
|
||||||
to_hex(key)
|
to_hex(key)
|
||||||
|
|
Loading…
Reference in New Issue