IncrementalBackupEngine

Struct IncrementalBackupEngine 

Source
pub struct IncrementalBackupEngine { /* private fields */ }
Expand description

増分バックアップエンジン

変更検出とバックアップタイプの決定を担当します。

§フィールド

  • backup_base - バックアップディレクトリのベースパス

§使用例

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();

Implementations§

Source§

impl IncrementalBackupEngine

Source

pub fn new(backup_base: PathBuf) -> Self

新しい IncrementalBackupEngine を作成

§引数
  • backup_base - バックアップディレクトリのベースパス
§戻り値

IncrementalBackupEngine インスタンス

§使用例
use backup_suite::core::incremental::IncrementalBackupEngine;
use std::path::PathBuf;

let engine = IncrementalBackupEngine::new(PathBuf::from("./backups"));
Source

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();
Source

pub fn find_latest_backup(&self) -> Result<Option<PathBuf>>

最新のバックアップディレクトリを検索

§戻り値

成功時は最新バックアップのパス(存在しない場合はNone)、失敗時はエラー

§Errors

以下の場合にエラーを返します:

  • バックアップディレクトリの読み込みに失敗した場合
Source

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();
Source

pub fn load_previous_metadata(&self) -> Result<BackupMetadata>

前回のバックアップメタデータを読み込み

§戻り値

成功時はメタデータ、失敗時はエラー

§Errors

以下の場合にエラーを返します:

  • 前回のバックアップが見つからない場合
  • メタデータの読み込みに失敗した場合
Source

pub fn get_previous_backup_name(&self) -> Result<Option<String>>

前回のバックアップ名を取得

§戻り値

成功時はバックアップ名、失敗時はエラー

§Errors

以下の場合にエラーを返します:

  • 最新バックアップの検索に失敗した場合
  • バックアップ名の取得に失敗した場合

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

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

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V