mirror of https://github.com/dswd/zvault
Prelude
This commit is contained in:
parent
5e816fe794
commit
45ec45941a
|
@ -1,3 +1,6 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{Read, Seek, SeekFrom, BufReader};
|
use std::io::{Read, Seek, SeekFrom, BufReader};
|
||||||
|
@ -5,16 +8,7 @@ use std::cmp::max;
|
||||||
use std::fmt::{self, Debug};
|
use std::fmt::{self, Debug};
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use serde::{self, Serialize, Deserialize};
|
use serde;
|
||||||
use quick_error::ResultExt;
|
|
||||||
|
|
||||||
use util::*;
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
|
|
||||||
static HEADER_STRING: [u8; 7] = *b"zvault\x01";
|
|
||||||
static HEADER_VERSION: u8 = 1;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Hash, PartialEq, Eq, Clone, Default)]
|
#[derive(Hash, PartialEq, Eq, Clone, Default)]
|
||||||
|
|
|
@ -1,13 +1,11 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
|
|
||||||
use quick_error::ResultExt;
|
|
||||||
|
|
||||||
use util::*;
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
|
|
||||||
pub struct BundleDb {
|
pub struct BundleDb {
|
||||||
path: PathBuf,
|
path: PathBuf,
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use util::*;
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
quick_error!{
|
quick_error!{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum BundleError {
|
pub enum BundleError {
|
||||||
|
|
|
@ -8,6 +8,10 @@ pub use self::writer::BundleWriter;
|
||||||
pub use self::bundle::*;
|
pub use self::bundle::*;
|
||||||
pub use self::db::*;
|
pub use self::db::*;
|
||||||
|
|
||||||
|
pub static HEADER_STRING: [u8; 7] = *b"zvault\x01";
|
||||||
|
pub static HEADER_VERSION: u8 = 1;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Bundle format
|
Bundle format
|
||||||
|
|
|
@ -1,17 +1,11 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
use super::*;
|
||||||
|
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::io::{Write, Seek, SeekFrom, BufWriter};
|
use std::io::{Write, Seek, SeekFrom, BufWriter};
|
||||||
use std::sync::{Arc, Mutex};
|
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 {
|
pub struct BundleWriter {
|
||||||
mode: BundleMode,
|
mode: BundleMode,
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::io::{self, Cursor, Read, Write};
|
use std::io::{self, Cursor, Read, Write};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
|
||||||
use chrono::Duration;
|
use chrono::Duration;
|
||||||
|
|
||||||
use ::chunker::*;
|
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
|
|
||||||
struct ChunkSink {
|
struct ChunkSink {
|
||||||
chunks: Vec<(usize, usize)>,
|
chunks: Vec<(usize, usize)>,
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use ::chunker::ChunkerType;
|
use ::prelude::*;
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,11 @@ mod args;
|
||||||
mod logger;
|
mod logger;
|
||||||
mod algotest;
|
mod algotest;
|
||||||
|
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use std::process::exit;
|
use std::process::exit;
|
||||||
|
|
||||||
use ::repository::{Repository, Config, Backup};
|
|
||||||
use ::util::*;
|
|
||||||
use self::args::Arguments;
|
use self::args::Arguments;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,13 +16,13 @@ extern crate sodiumoxide;
|
||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
|
||||||
|
|
||||||
pub mod util;
|
pub mod util;
|
||||||
pub mod bundledb;
|
pub mod bundledb;
|
||||||
pub mod index;
|
pub mod index;
|
||||||
mod chunker;
|
mod chunker;
|
||||||
mod repository;
|
mod repository;
|
||||||
mod cli;
|
mod cli;
|
||||||
|
mod prelude;
|
||||||
|
|
||||||
// TODO: Seperate remote folder
|
// TODO: Seperate remote folder
|
||||||
// TODO: - Copy/move backup files to remote folder
|
// TODO: - Copy/move backup files to remote folder
|
||||||
|
|
|
@ -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;
|
|
@ -1,14 +1,10 @@
|
||||||
use super::{Repository, RepositoryError};
|
use ::prelude::*;
|
||||||
use super::metadata::{FileType, Inode};
|
|
||||||
|
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
use std::io::{self, BufReader, BufWriter, Read, Write};
|
use std::io::{self, BufReader, BufWriter, Read, Write};
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::path::{self, Path, PathBuf};
|
use std::path::{self, Path, PathBuf};
|
||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
|
|
||||||
use quick_error::ResultExt;
|
|
||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,8 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::io::{Read, Write, Cursor};
|
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 {
|
impl Repository {
|
||||||
pub fn get_bundle_id(&self, id: u32) -> Result<BundleId, RepositoryError> {
|
pub fn get_bundle_id(&self, id: u32) -> Result<BundleId, RepositoryError> {
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::io::{self, BufReader, Read, Write, BufWriter};
|
use std::io::{self, BufReader, Read, Write, BufWriter};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
|
|
||||||
use ::bundledb::{Bundle, BundleId, BundleInfo};
|
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
|
|
||||||
static HEADER_STRING: [u8; 7] = *b"zbunmap";
|
static HEADER_STRING: [u8; 7] = *b"zbunmap";
|
||||||
static HEADER_VERSION: u8 = 1;
|
static HEADER_VERSION: u8 = 1;
|
||||||
|
|
|
@ -1,12 +1,11 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use serde_yaml;
|
use serde_yaml;
|
||||||
|
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
|
||||||
use ::util::*;
|
|
||||||
use ::chunker::ChunkerType;
|
|
||||||
|
|
||||||
|
|
||||||
quick_error!{
|
quick_error!{
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
|
|
||||||
use super::backup::{Backup, BackupError};
|
use super::backup::BackupError;
|
||||||
use super::bundle_map::BundleMapError;
|
use super::bundle_map::BundleMapError;
|
||||||
use super::config::ConfigError;
|
use super::config::ConfigError;
|
||||||
use super::integrity::RepositoryIntegrityError;
|
|
||||||
use ::index::IndexError;
|
|
||||||
use ::bundledb::BundleError;
|
|
||||||
use ::chunker::ChunkerError;
|
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
|
|
||||||
quick_error!{
|
quick_error!{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use super::Repository;
|
use ::prelude::*;
|
||||||
use ::bundledb::BundleInfo;
|
|
||||||
|
|
||||||
pub struct RepositoryInfo {
|
pub struct RepositoryInfo {
|
||||||
pub bundle_count: usize,
|
pub bundle_count: usize,
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use super::{Repository, RepositoryError};
|
use ::prelude::*;
|
||||||
use super::metadata::FileContents;
|
|
||||||
|
|
||||||
use ::bundledb::BundleId;
|
use super::metadata::FileContents;
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
use std::collections::VecDeque;
|
use std::collections::VecDeque;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::fs::{self, Metadata, File, Permissions};
|
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::os::unix::fs::{PermissionsExt, symlink};
|
||||||
use std::io::{Read, Write};
|
use std::io::{Read, Write};
|
||||||
|
|
||||||
use ::util::*;
|
|
||||||
use super::{Repository, RepositoryError};
|
|
||||||
use super::integrity::RepositoryIntegrityError;
|
|
||||||
use ::bundledb::BundleMode;
|
|
||||||
|
|
||||||
|
|
||||||
#[derive(Debug, Eq, PartialEq)]
|
#[derive(Debug, Eq, PartialEq)]
|
||||||
pub enum FileType {
|
pub enum FileType {
|
||||||
|
|
|
@ -8,22 +8,20 @@ mod backup;
|
||||||
mod error;
|
mod error;
|
||||||
mod vacuum;
|
mod vacuum;
|
||||||
|
|
||||||
|
use ::prelude::*;
|
||||||
|
|
||||||
use std::mem;
|
use std::mem;
|
||||||
use std::cmp::max;
|
use std::cmp::max;
|
||||||
use std::path::{PathBuf, Path};
|
use std::path::{PathBuf, Path};
|
||||||
use std::fs;
|
use std::fs;
|
||||||
use std::sync::{Arc, Mutex};
|
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::error::RepositoryError;
|
||||||
pub use self::config::Config;
|
pub use self::config::Config;
|
||||||
pub use self::metadata::{Inode, FileType};
|
pub use self::metadata::{Inode, FileType};
|
||||||
pub use self::backup::Backup;
|
pub use self::backup::Backup;
|
||||||
pub use self::integrity::RepositoryIntegrityError;
|
pub use self::integrity::RepositoryIntegrityError;
|
||||||
|
pub use self::info::RepositoryInfo;
|
||||||
use self::bundle_map::BundleMap;
|
use self::bundle_map::BundleMap;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
use super::{Repository, RepositoryError, RepositoryIntegrityError};
|
use ::prelude::*;
|
||||||
|
|
||||||
use super::metadata::FileContents;
|
use super::metadata::FileContents;
|
||||||
|
|
||||||
use std::collections::{HashMap, HashSet, VecDeque};
|
use std::collections::{HashMap, HashSet, VecDeque};
|
||||||
|
|
||||||
use ::bundledb::BundleMode;
|
|
||||||
use ::util::*;
|
|
||||||
|
|
||||||
|
|
||||||
pub struct BundleUsage {
|
pub struct BundleUsage {
|
||||||
pub used: Bitmap,
|
pub used: Bitmap,
|
||||||
|
|
Loading…
Reference in New Issue