This commit is contained in:
Dennis Schwerdel 2017-03-21 11:28:11 +01:00
parent 5e816fe794
commit 45ec45941a
20 changed files with 53 additions and 80 deletions

View File

@ -1,3 +1,6 @@
use ::prelude::*;
use super::*;
use std::path::{Path, PathBuf};
use std::fs::{self, File};
use std::io::{Read, Seek, SeekFrom, BufReader};
@ -5,16 +8,7 @@ use std::cmp::max;
use std::fmt::{self, Debug};
use std::sync::{Arc, Mutex};
use serde::{self, Serialize, Deserialize};
use quick_error::ResultExt;
use util::*;
use super::*;
static HEADER_STRING: [u8; 7] = *b"zvault\x01";
static HEADER_VERSION: u8 = 1;
use serde;
#[derive(Hash, PartialEq, Eq, Clone, Default)]

View File

@ -1,13 +1,11 @@
use ::prelude::*;
use super::*;
use std::path::{Path, PathBuf};
use std::collections::HashMap;
use std::fs;
use std::sync::{Arc, Mutex};
use quick_error::ResultExt;
use util::*;
use super::*;
pub struct BundleDb {
path: PathBuf,

View File

@ -1,9 +1,9 @@
use ::prelude::*;
use super::*;
use std::path::{Path, PathBuf};
use std::io;
use util::*;
use super::*;
quick_error!{
#[derive(Debug)]
pub enum BundleError {

View File

@ -8,6 +8,10 @@ pub use self::writer::BundleWriter;
pub use self::bundle::*;
pub use self::db::*;
pub static HEADER_STRING: [u8; 7] = *b"zvault\x01";
pub static HEADER_VERSION: u8 = 1;
/*
Bundle format

View File

@ -1,17 +1,11 @@
use ::prelude::*;
use super::*;
use std::path::Path;
use std::fs::{self, File};
use std::io::{Write, Seek, SeekFrom, BufWriter};
use std::sync::{Arc, Mutex};
use quick_error::ResultExt;
use util::*;
use super::*;
static HEADER_STRING: [u8; 7] = *b"zvault\x01";
static HEADER_VERSION: u8 = 1;
pub struct BundleWriter {
mode: BundleMode,

View File

@ -1,12 +1,11 @@
use ::prelude::*;
use std::io::{self, Cursor, Read, Write};
use std::fs::File;
use std::collections::HashSet;
use chrono::Duration;
use ::chunker::*;
use ::util::*;
struct ChunkSink {
chunks: Vec<(usize, usize)>,

View File

@ -1,5 +1,4 @@
use ::chunker::ChunkerType;
use ::util::*;
use ::prelude::*;
use std::process::exit;

View File

@ -2,11 +2,11 @@ mod args;
mod logger;
mod algotest;
use ::prelude::*;
use chrono::prelude::*;
use std::process::exit;
use ::repository::{Repository, Config, Backup};
use ::util::*;
use self::args::Arguments;

View File

@ -16,13 +16,13 @@ extern crate sodiumoxide;
extern crate ansi_term;
extern crate libc;
pub mod util;
pub mod bundledb;
pub mod index;
mod chunker;
mod repository;
mod cli;
mod prelude;
// TODO: Seperate remote folder
// TODO: - Copy/move backup files to remote folder

9
src/prelude.rs Normal file
View File

@ -0,0 +1,9 @@
pub use ::util::*;
pub use ::bundledb::{Bundle, BundleMode, BundleWriter, BundleInfo, BundleId, BundleError, BundleDb};
pub use ::chunker::{ChunkerType, Chunker, ChunkerStatus, IChunker, ChunkerError};
pub use ::repository::{Repository, Backup, Config, RepositoryError, RepositoryInfo, Inode, FileType, RepositoryIntegrityError};
pub use ::index::{Index, Location, IndexError};
pub use serde::{Serialize, Deserialize};
pub use quick_error::ResultExt;

View File

@ -1,14 +1,10 @@
use super::{Repository, RepositoryError};
use super::metadata::{FileType, Inode};
use ::util::*;
use ::prelude::*;
use std::io::{self, BufReader, BufWriter, Read, Write};
use std::fs::{self, File};
use std::path::{self, Path, PathBuf};
use std::collections::{HashMap, VecDeque};
use quick_error::ResultExt;
use chrono::prelude::*;

View File

@ -1,14 +1,8 @@
use ::prelude::*;
use std::mem;
use std::io::{Read, Write, Cursor};
use super::{Repository, RepositoryError};
use ::index::Location;
use ::bundledb::{BundleId, BundleMode};
use super::integrity::RepositoryIntegrityError;
use ::util::*;
use ::chunker::{IChunker, ChunkerStatus};
impl Repository {
pub fn get_bundle_id(&self, id: u32) -> Result<BundleId, RepositoryError> {

View File

@ -1,11 +1,10 @@
use ::prelude::*;
use std::collections::HashMap;
use std::path::Path;
use std::io::{self, BufReader, Read, Write, BufWriter};
use std::fs::File;
use ::bundledb::{Bundle, BundleId, BundleInfo};
use ::util::*;
static HEADER_STRING: [u8; 7] = *b"zbunmap";
static HEADER_VERSION: u8 = 1;

View File

@ -1,12 +1,11 @@
use ::prelude::*;
use serde_yaml;
use std::fs::File;
use std::path::Path;
use std::io;
use ::util::*;
use ::chunker::ChunkerType;
quick_error!{
#[derive(Debug)]

View File

@ -1,14 +1,11 @@
use ::prelude::*;
use std::io;
use std::path::PathBuf;
use super::backup::{Backup, BackupError};
use super::backup::BackupError;
use super::bundle_map::BundleMapError;
use super::config::ConfigError;
use super::integrity::RepositoryIntegrityError;
use ::index::IndexError;
use ::bundledb::BundleError;
use ::chunker::ChunkerError;
use ::util::*;
quick_error!{

View File

@ -1,5 +1,5 @@
use super::Repository;
use ::bundledb::BundleInfo;
use ::prelude::*;
pub struct RepositoryInfo {
pub bundle_count: usize,

View File

@ -1,8 +1,6 @@
use super::{Repository, RepositoryError};
use super::metadata::FileContents;
use ::prelude::*;
use ::bundledb::BundleId;
use ::util::*;
use super::metadata::FileContents;
use std::collections::VecDeque;

View File

@ -1,3 +1,5 @@
use ::prelude::*;
use std::collections::HashMap;
use std::path::Path;
use std::fs::{self, Metadata, File, Permissions};
@ -5,11 +7,6 @@ use std::os::linux::fs::MetadataExt;
use std::os::unix::fs::{PermissionsExt, symlink};
use std::io::{Read, Write};
use ::util::*;
use super::{Repository, RepositoryError};
use super::integrity::RepositoryIntegrityError;
use ::bundledb::BundleMode;
#[derive(Debug, Eq, PartialEq)]
pub enum FileType {

View File

@ -8,22 +8,20 @@ mod backup;
mod error;
mod vacuum;
use ::prelude::*;
use std::mem;
use std::cmp::max;
use std::path::{PathBuf, Path};
use std::fs;
use std::sync::{Arc, Mutex};
use super::index::Index;
use super::bundledb::{BundleDb, BundleWriter};
use super::chunker::Chunker;
use ::util::*;
pub use self::error::RepositoryError;
pub use self::config::Config;
pub use self::metadata::{Inode, FileType};
pub use self::backup::Backup;
pub use self::integrity::RepositoryIntegrityError;
pub use self::info::RepositoryInfo;
use self::bundle_map::BundleMap;

View File

@ -1,11 +1,9 @@
use super::{Repository, RepositoryError, RepositoryIntegrityError};
use ::prelude::*;
use super::metadata::FileContents;
use std::collections::{HashMap, HashSet, VecDeque};
use ::bundledb::BundleMode;
use ::util::*;
pub struct BundleUsage {
pub used: Bitmap,