simplify backup lib structure (pub use xxx:*), improve doc

This commit is contained in:
Dietmar Maurer
2019-02-12 14:13:31 +01:00
parent d78345bcfc
commit e5064ba607
10 changed files with 42 additions and 20 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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>,
}

View File

@ -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],

View File

@ -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],