Compare commits

..

No commits in common. "75e9d7a9d288a907a2c3edb0641f29e4850b96ae" and "55c5f2493705e32d1c52f324ce1ba541ae392d9d" have entirely different histories.

5 changed files with 4 additions and 27 deletions

View File

@ -7,8 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased](https://git.rustybever.be/Chewing_Bever/alex/src/branch/dev) ## [Unreleased](https://git.rustybever.be/Chewing_Bever/alex/src/branch/dev)
## [0.3.0](https://git.rustybever.be/Chewing_Bever/alex/src/tag/0.3.0)
### Added ### Added
* Incremental backups * Incremental backups

2
Cargo.lock generated
View File

@ -10,7 +10,7 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
[[package]] [[package]]
name = "alex" name = "alex"
version = "0.3.0" version = "0.2.2"
dependencies = [ dependencies = [
"chrono", "chrono",
"clap", "clap",

View File

@ -1,6 +1,6 @@
[package] [package]
name = "alex" name = "alex"
version = "0.3.0" version = "0.2.2"
description = "Wrapper around Minecraft server processes, designed to complement Docker image installations." description = "Wrapper around Minecraft server processes, designed to complement Docker image installations."
authors = ["Jef Roosens"] authors = ["Jef Roosens"]
edition = "2021" edition = "2021"

View File

@ -53,8 +53,7 @@ where
} }
} }
/// Create a new backup, either full or incremental, depending on the state of the current /// Create a new backup with the expected type.
/// chain.
pub fn create_backup(&mut self) -> io::Result<()> { pub fn create_backup(&mut self) -> io::Result<()> {
// We start a new chain if the current chain is complete, or if there isn't a first chain // We start a new chain if the current chain is complete, or if there isn't a first chain
// yet // yet

View File

@ -56,7 +56,6 @@ impl Backup<()> {
} }
impl<T: Clone> Backup<T> { impl<T: Clone> Backup<T> {
/// Set the backup's metadata.
pub fn set_metadata(&mut self, metadata: T) { pub fn set_metadata(&mut self, metadata: T) {
self.metadata = Some(metadata); self.metadata = Some(metadata);
} }
@ -127,19 +126,7 @@ impl<T: Clone> Backup<T> {
}) })
} }
/// Create a new Incremental backup from the given state, populated with the given directories. /// Create a new incremental backup from a given previous backup
///
/// # Arguments
///
/// * `previous_state` - State the file system was in during the previous backup in the chain
/// * `previous_start_time` - Start time of the previous backup; used to filter files
/// * `backup_dir` - Directory to store archive in
/// * `dirs` - list of tuples `(path_in_tar, src_dir)` with `path_in_tar` the directory name
/// under which `src_dir`'s contents should be stored in the archive
///
/// # Returns
///
/// The `Backup` instance describing this new backup.
pub fn create_from<P: AsRef<Path>>( pub fn create_from<P: AsRef<Path>>(
previous_state: HashMap<PathBuf, HashSet<PathBuf>>, previous_state: HashMap<PathBuf, HashSet<PathBuf>>,
previous_start_time: chrono::DateTime<Utc>, previous_start_time: chrono::DateTime<Utc>,
@ -197,13 +184,6 @@ impl<T: Clone> Backup<T> {
}) })
} }
/// Restore the backup by extracting its contents to the respective directories.
///
/// # Arguments
///
/// * `backup_dir` - Backup directory where the file is stored
/// * `dirs` - list of tuples `(path_in_tar, dst_dir)` with `dst_dir` the directory on-disk
/// where the files stored under `path_in_tar` inside the tarball should be extracted to.
pub fn restore<P: AsRef<Path>>( pub fn restore<P: AsRef<Path>>(
&self, &self,
backup_dir: P, backup_dir: P,