simplify backup lib structure (pub use xxx:*), improve doc
This commit is contained in:
parent
d78345bcfc
commit
e5064ba607
|
@ -10,7 +10,7 @@ use serde_json::{json, Value};
|
|||
|
||||
use crate::config::datastore;
|
||||
|
||||
use crate::backup::datastore::*;
|
||||
use crate::backup::*;
|
||||
|
||||
mod catar;
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ use failure::*;
|
|||
|
||||
use crate::tools;
|
||||
use crate::tools::wrapped_reader_stream::*;
|
||||
use crate::backup::datastore::*;
|
||||
use crate::backup::dynamic_index::*;
|
||||
use crate::backup::*;
|
||||
//use crate::server::rest::*;
|
||||
use crate::api::schema::*;
|
||||
use crate::api::router::*;
|
||||
|
|
|
@ -3,7 +3,7 @@ use failure::*;
|
|||
|
||||
use crate::api::schema::*;
|
||||
use crate::api::router::*;
|
||||
use crate::backup::chunk_store::*;
|
||||
use crate::backup::*;
|
||||
use serde_json::{json, Value};
|
||||
use std::path::PathBuf;
|
||||
|
||||
|
|
|
@ -11,8 +11,17 @@
|
|||
//! whereas the `FixedIndex*` format is an optimization to store a
|
||||
//! list of equal sized chunks.
|
||||
|
||||
pub mod chunker;
|
||||
pub mod chunk_store;
|
||||
pub mod fixed_index;
|
||||
pub mod dynamic_index;
|
||||
pub mod datastore;
|
||||
mod chunker;
|
||||
pub use chunker::*;
|
||||
|
||||
mod chunk_store;
|
||||
pub use chunk_store::*;
|
||||
|
||||
mod fixed_index;
|
||||
pub use fixed_index::*;
|
||||
|
||||
mod dynamic_index;
|
||||
pub use dynamic_index::*;
|
||||
|
||||
mod datastore;
|
||||
pub use datastore::*;
|
||||
|
|
|
@ -30,6 +30,7 @@ impl Default for GarbageCollectionStatus {
|
|||
}
|
||||
}
|
||||
|
||||
/// File system based chunk store
|
||||
pub struct ChunkStore {
|
||||
name: String, // used for error reporting
|
||||
pub (crate) base: PathBuf,
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
//! Slinding window chunker (Buzhash)
|
||||
//!
|
||||
//! This is a rewrite of *casync* chunker (cachunker.h) in rust.
|
||||
//!
|
||||
//! Hashing by cyclic polynomial (also called Buzhash) has the benefit
|
||||
//! of avoiding multiplications, using barrel shifts instead. For more
|
||||
//! information please take a look at the [Rolling
|
||||
//! Hash](https://en.wikipedia.org/wiki/Rolling_hash) artikel from
|
||||
//! wikipedia.
|
||||
|
||||
const CA_CHUNKER_WINDOW_SIZE: usize = 48;
|
||||
|
||||
/// Slinding window chunker (Buzhash)
|
||||
///
|
||||
/// This is a rewrite of *casync* chunker (cachunker.h) in rust.
|
||||
///
|
||||
/// Hashing by cyclic polynomial (also called Buzhash) has the benefit
|
||||
/// of avoiding multiplications, using barrel shifts instead. For more
|
||||
/// information please take a look at the [Rolling
|
||||
/// Hash](https://en.wikipedia.org/wiki/Rolling_hash) artikel from
|
||||
/// wikipedia.
|
||||
|
||||
pub struct Chunker {
|
||||
h: u32,
|
||||
window_size: usize,
|
||||
|
|
|
@ -15,15 +15,23 @@ use super::dynamic_index::*;
|
|||
|
||||
use chrono::{Utc, TimeZone};
|
||||
|
||||
/// Datastore Management
|
||||
///
|
||||
/// A Datastore can store severals backups, and provides the
|
||||
/// management interface for backup.
|
||||
pub struct DataStore {
|
||||
chunk_store: Arc<ChunkStore>,
|
||||
gc_mutex: Mutex<bool>,
|
||||
}
|
||||
|
||||
/// Detailed Backup Information
|
||||
#[derive(Debug)]
|
||||
pub struct BackupInfo {
|
||||
/// Type of backup
|
||||
pub backup_type: String,
|
||||
/// Unique (for this type) ID
|
||||
pub backup_id: String,
|
||||
/// Backup timestamp
|
||||
pub backup_time: DateTime<Utc>,
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,10 @@ use std::os::unix::io::AsRawFd;
|
|||
use uuid::Uuid;
|
||||
//use chrono::{Local, TimeZone};
|
||||
|
||||
/// Header format definition for dynamic index files (`.dixd`)
|
||||
#[repr(C)]
|
||||
//pub struct DynamicIndexHeader {
|
||||
pub struct DynamicIndexHeader {
|
||||
/// The string `PROXMOX-DIDX`
|
||||
pub magic: [u8; 12],
|
||||
pub version: u32,
|
||||
pub uuid: [u8; 16],
|
||||
|
|
|
@ -10,8 +10,10 @@ use std::os::unix::io::AsRawFd;
|
|||
use uuid::Uuid;
|
||||
use chrono::{Local, TimeZone};
|
||||
|
||||
/// Header format definition for fixed index files (`.fixd`)
|
||||
#[repr(C)]
|
||||
pub struct FixedIndexHeader {
|
||||
/// The string `PROXMOX-FIDX`
|
||||
pub magic: [u8; 12],
|
||||
pub version: u32,
|
||||
pub uuid: [u8; 16],
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
extern crate proxmox_backup;
|
||||
|
||||
use proxmox_backup::backup::chunker::*;
|
||||
//use proxmox_backup::backup::chunker::*;
|
||||
use proxmox_backup::backup::*;
|
||||
|
||||
fn main() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue