2019-08-16 10:27:17 +00:00
|
|
|
//! Trait for file list catalog
|
2019-08-09 06:11:32 +00:00
|
|
|
//!
|
|
|
|
//! A file list catalog simply store a directory tree. Such catalogs
|
|
|
|
//! may be used as index to do a fast search for files.
|
|
|
|
|
|
|
|
use failure::*;
|
2019-08-16 10:27:17 +00:00
|
|
|
use std::ffi::CStr;
|
2019-11-11 13:19:54 +00:00
|
|
|
|
2019-08-09 06:11:32 +00:00
|
|
|
pub trait BackupCatalogWriter {
|
|
|
|
fn start_directory(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn end_directory(&mut self) -> Result<(), Error>;
|
|
|
|
fn add_file(&mut self, name: &CStr, size: u64, mtime: u64) -> Result<(), Error>;
|
|
|
|
fn add_symlink(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn add_hardlink(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn add_block_device(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn add_char_device(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn add_fifo(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
fn add_socket(&mut self, name: &CStr) -> Result<(), Error>;
|
|
|
|
}
|
|
|
|
|
2019-08-16 10:27:17 +00:00
|
|
|
pub struct DummyCatalogWriter();
|
|
|
|
|
|
|
|
impl BackupCatalogWriter for DummyCatalogWriter {
|
|
|
|
fn start_directory(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn end_directory(&mut self) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_file(&mut self, _name: &CStr, _size: u64, _mtime: u64) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_symlink(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_hardlink(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_block_device(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_char_device(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_fifo(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
|
|
|
fn add_socket(&mut self, _name: &CStr) -> Result<(), Error> { Ok(()) }
|
2019-08-09 06:11:32 +00:00
|
|
|
}
|