#[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
impl MigrateOptions
Sourcepub fn include_roots(self, roots: Vec<PathBuf>) -> Result<Self, AppRootError>
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.
Sourcepub fn preserve_links(self, on: bool) -> Self
pub fn preserve_links(self, on: bool) -> Self
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.
Sourcepub fn skip_ephemeral_specials(self, on: bool) -> Self
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.
Sourcepub fn skip_reparse_points(self, on: bool) -> Self
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).
Sourcepub fn optional_links(
self,
is_optional: impl Fn(&Path) -> bool + Send + Sync + 'static,
) -> Self
pub fn optional_links( self, is_optional: impl Fn(&Path) -> bool + Send + Sync + 'static, ) -> Self
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.
Sourcepub fn exclude(self, rel: impl Into<PathBuf>) -> Self
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).