#[repr(transparent)]pub struct NSFileManagerResumeSyncBehavior(pub NSInteger);
NSFileManager
only.Expand description
The behaviors the file manager can apply to resolve conflicts when resuming a sync.
You use this type when calling FileManager/resumeSyncForUbiquitousItem(at:with:completionHandler:)
to resume synchronizing.
In most situations, the NSFileManagerResumeSyncBehavior/preserveLocalChanges
behavior is the best choice to avoid risk of data loss.
See also Apple’s documentation
Tuple Fields§
§0: NSInteger
Implementations§
Source§impl NSFileManagerResumeSyncBehavior
impl NSFileManagerResumeSyncBehavior
Sourcepub const PreserveLocalChanges: Self
pub const PreserveLocalChanges: Self
Resumes synchronizing by uploading the local version of the file.
If the server has a newer version, the server may create a conflict copy of the file, or may automatically pick the winner of the conflict.
Apps can choose to implement conflict handling themselves by passing NSFileManagerResumeSyncBehaviorAfterUploadWithFailOnConflict
.
Sourcepub const AfterUploadWithFailOnConflict: Self
pub const AfterUploadWithFailOnConflict: Self
Resumes sync by first uploading the local version of the file, failing if the provider detects a conflict.
If the upload succeeds, the sync resumes with the preserveLocalChanges
behavior.
If the provider detects a conflict, the upload fails with an NSFileWriteUnknownError-enum.case
, with the underlying error of
<doc
://com.apple.documentation/documentation/FileProvider/NSFileProviderError/localVersionConflictingWithServer>.
In this case, the app needs to call FileManager/fetchLatestRemoteVersionOfItem(at:completionHandler:)
, rebase local changes on top of the newly fetched version to resolve the conflict, and try again to resume sync.
This scenario is only available on paused items for which the file provider supports the fail-on-conflict behavior.
To check that the file provider supports the behavior, get the NSURLUbiquitousItemSupportedSyncControlsKey
URL resource and verify that NSFileManagerSupportedSyncControls/failUploadOnConflict
is true
.
Sourcepub const DropLocalChanges: Self
pub const DropLocalChanges: Self
Resumes synchronizing by overwriting any local changes with the remote version of the file.
If a conflict occurs, the file manager stores the local changes as an alternate version. Only use this behavior if you provide a separate means of resolving and merging conflicts.
Trait Implementations§
Source§impl Clone for NSFileManagerResumeSyncBehavior
impl Clone for NSFileManagerResumeSyncBehavior
Source§fn clone(&self) -> NSFileManagerResumeSyncBehavior
fn clone(&self) -> NSFileManagerResumeSyncBehavior
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Ord for NSFileManagerResumeSyncBehavior
impl Ord for NSFileManagerResumeSyncBehavior
Source§fn cmp(&self, other: &NSFileManagerResumeSyncBehavior) -> Ordering
fn cmp(&self, other: &NSFileManagerResumeSyncBehavior) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for NSFileManagerResumeSyncBehavior
impl PartialEq for NSFileManagerResumeSyncBehavior
Source§fn eq(&self, other: &NSFileManagerResumeSyncBehavior) -> bool
fn eq(&self, other: &NSFileManagerResumeSyncBehavior) -> bool
self
and other
values to be equal, and is used by ==
.