Add date to bundles

pull/10/head
Dennis Schwerdel 2017-04-14 22:44:40 +02:00
parent d06149979a
commit afef4004bd
3 changed files with 11 additions and 4 deletions

View File

@ -97,7 +97,8 @@ pub struct BundleInfo {
pub raw_size: usize,
pub encoded_size: usize,
pub chunk_count: usize,
pub chunk_list_size: usize
pub chunk_list_size: usize,
pub timestamp: i64
}
serde_impl!(BundleInfo(u64?) {
id: BundleId => 0,
@ -108,7 +109,8 @@ serde_impl!(BundleInfo(u64?) {
raw_size: usize => 6,
encoded_size: usize => 7,
chunk_count: usize => 8,
chunk_list_size: usize => 9
chunk_list_size: usize => 9,
timestamp: i64 => 10
});
impl Default for BundleInfo {
@ -122,7 +124,8 @@ impl Default for BundleInfo {
encoded_size: 0,
chunk_count: 0,
mode: BundleMode::Data,
chunk_list_size: 0
chunk_list_size: 0,
timestamp: 0
}
}
}

View File

@ -6,6 +6,8 @@ use std::fs::File;
use std::io::{self, Write, BufWriter};
use std::sync::{Arc, Mutex};
use chrono::prelude::*;
quick_error!{
#[derive(Debug)]
@ -114,7 +116,8 @@ impl BundleWriter {
id: id.clone(),
raw_size: self.raw_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));
if let Some(ref encryption) = self.encryption {

View File

@ -213,6 +213,7 @@ fn print_bundle(bundle: &StoredBundle) {
println!("Bundle {}", bundle.info.id);
println!(" - Mode: {:?}", bundle.info.mode);
println!(" - Path: {:?}", bundle.path);
println!(" - Date: {}", Local.timestamp(bundle.info.timestamp, 0).to_rfc2822());
println!(" - Hash method: {:?}", bundle.info.hash_method);
let encryption = if let Some((_, ref key)) = bundle.info.encryption {
to_hex(key)