pub struct IncrementalBackupEngine { /* private fields */ }Expand description
Implementations§
Source§impl IncrementalBackupEngine
impl IncrementalBackupEngine
Sourcepub fn determine_backup_type(&self) -> Result<BackupType>
pub fn determine_backup_type(&self) -> Result<BackupType>
バックアップタイプを決定
前回のバックアップが存在するかチェックし、存在すればIncremental、 存在しなければFullを返します。
§戻り値
成功時は BackupType、失敗時はエラー
§Errors
以下の場合にエラーを返します:
- 最新バックアップの検索に失敗した場合
§使用例
use backup_suite::core::incremental::IncrementalBackupEngine;
use std::path::PathBuf;
let engine = IncrementalBackupEngine::new(PathBuf::from("./backups"));
let backup_type = engine.determine_backup_type().unwrap();Sourcepub fn find_latest_backup(&self) -> Result<Option<PathBuf>>
pub fn find_latest_backup(&self) -> Result<Option<PathBuf>>
Sourcepub fn detect_changed_files(
&self,
current_files: &[(PathBuf, PathBuf)],
previous_metadata: &BackupMetadata,
) -> Result<Vec<(PathBuf, PathBuf)>>
pub fn detect_changed_files( &self, current_files: &[(PathBuf, PathBuf)], previous_metadata: &BackupMetadata, ) -> Result<Vec<(PathBuf, PathBuf)>>
変更ファイルを検出
前回のバックアップメタデータと現在のファイルハッシュを比較し、 変更されたファイルのリストを返します。
§引数
current_files- 現在のファイルリスト(相対パス、絶対パス)previous_metadata- 前回のバックアップメタデータ
§戻り値
変更されたファイルのリスト(相対パス、絶対パス)
§Errors
以下の場合にエラーを返します:
- ファイルハッシュの計算に失敗した場合
§使用例
use backup_suite::core::incremental::IncrementalBackupEngine;
use backup_suite::core::integrity::BackupMetadata;
use std::path::PathBuf;
let engine = IncrementalBackupEngine::new(PathBuf::from("./backups"));
let files = vec![(PathBuf::from("file.txt"), PathBuf::from("/path/to/file.txt"))];
let metadata = BackupMetadata::new();
let changed = engine.detect_changed_files(&files, &metadata).unwrap();Sourcepub fn load_previous_metadata(&self) -> Result<BackupMetadata>
pub fn load_previous_metadata(&self) -> Result<BackupMetadata>
Auto Trait Implementations§
impl Freeze for IncrementalBackupEngine
impl RefUnwindSafe for IncrementalBackupEngine
impl Send for IncrementalBackupEngine
impl Sync for IncrementalBackupEngine
impl Unpin for IncrementalBackupEngine
impl UnwindSafe for IncrementalBackupEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.