pub(crate) mod os;
pub(crate) mod tar;
use std::io::Result;
use std::path::{Path, PathBuf};
use rayon::iter::ParallelIterator;
#[derive(Clone, Debug)]
pub(crate) struct File {
pub path: PathBuf,
pub mode: u32,
}
#[derive(Clone, Debug)]
pub(crate) struct Symlink {
pub path: PathBuf,
pub target: PathBuf,
pub mode: u32,
}
#[derive(Clone, Debug)]
pub(crate) enum DirEntry {
Directory(PathBuf),
File(File),
Symlink(Symlink),
}
pub(crate) trait Source: Sync {
fn read_dir(&self, path: &Path) -> Result<impl ParallelIterator<Item = DirEntry>>;
fn read(&self, path: &Path) -> Result<Vec<u8>>;
}
pub(crate) trait Destination: Sync {
fn write(&self, path: &Path, content: &[u8], mode: u32) -> Result<()>;
fn symlink(&self, path: &Path, target: &Path, mode: u32) -> Result<()>;
}