Skip to main content

MigrateOptions

Struct MigrateOptions 

Source
#[non_exhaustive]
pub struct MigrateOptions { /* private fields */ }
Expand description

Opt-in behaviour for AppRoot::migrate_from_with. The default is strict and identical to AppRoot::migrate_from: any symlink or special file in the source is refused.

The type is #[non_exhaustive]; build it with MigrateOptions::strict and the builders.

Implementations§

Source§

impl MigrateOptions

Source

pub fn include_roots(self, roots: Vec<PathBuf>) -> Result<Self, AppRootError>

Restrict migration to these relative roots, including each directory’s descendants. An empty list selects nothing; the default selects the whole tree. Selected migrations always revalidate source & destination, retain previously selected roots for retries of the same source, & use versioned scope-aware state without writing a historical whole-tree completion marker.

Source

pub fn strict() -> Self

Refuse every symlink and special file (the default).

Copy symlinks as link entries, never traversing them. A relative link that stays inside the tree keeps its text; a relative link that leaves the tree becomes an absolute link to its original target (resolved lexically against the link’s old location); an absolute or dangling link is copied as it is. If the destination cannot create a link the migration fails with the retryable AppRootError::link_not_created error before any marker is written, unless MigrateOptions::optional_links marks that link omittable.

Source

pub fn skip_ephemeral_specials(self, on: bool) -> Self

Skip sockets and FIFOs (never opened) and report them. Device nodes and any other special file are still refused. On Windows an AF_UNIX socket file (a reparse point) counts as a socket.

Source

pub fn skip_reparse_points(self, on: bool) -> Self

Windows reparse-point policy. A junction (mount point) or any other reparse point that is neither a symlink nor an AF_UNIX socket is never followed, opened, copied or recreated: the migration cannot tell whether it leads out of the root, and recreating a junction as a symlink would change what it is. By default (and in strict mode) such an entry refuses the migration with AppRootError::UnsupportedSource, before anything is written. With this option the entry is skipped and reported (MigrationReport::skipped_reparse_points, and in the state file), and the result is MigrationState::ReadyWithOmissions, never Ready: the caller has declared the entry disposable and the omission stays on record. A directory reparse point is never recursed into. No effect on other platforms (they have none).

Caller policy naming links that may be omitted when the destination cannot create them. The predicate receives the link’s path relative to the migrated tree. It only matters together with MigrateOptions::preserve_links, and only for a link whose creation failed; every other link is migrated normally. Omissions are reported in the outcome and in the marker, separately from required links.

Source

pub fn exclude(self, rel: impl Into<PathBuf>) -> Self

Leave the entry at rel (a path relative to the migrated tree) and everything below it out of the copy. For state a lifecycle participant moves by its own means (an encrypted database and its key, moved by RootCutover through the participant that owns it): copying such files as plain bytes would race the owner’s relocation and collide with its destination. An excluded path is not planned, copied, verified or recorded; it is neither an omission nor a reason for the state to be ReadyWithOmissions, so the caller that excludes a path owns moving it. Exclusions match exact components; differently spelled case aliases are refused rather than silently skipped. rel must be relative and made only of normal components; anything else is ignored (it can match no entry).

Source

pub fn ephemeral_specials(&self) -> bool

Source

pub fn reparse_points(&self) -> bool

Trait Implementations§

Source§

impl Clone for MigrateOptions

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MigrateOptions

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for MigrateOptions

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.