TICDSPreSynchronizationOperation Class Reference
Inherits from | TICDSOperation : NSOperation |
Declared in | TICDSPreSynchronizationOperation.h |
Overview
The TICDSPreSynchronizationOperation
class describes a generic operation used by the TICoreDataSync
framework to synchronize changes made to a document.
In brief, a pre-synchronization operation pulls down remote sync commands and changes.
In full, the operation carries out the following tasks: (Sync Command tasks are included below, although not yet implemented)
- Fetch an array containing UUID strings for each client device that has synchronized this document.
- For each client device that isn’t the current device:
- Fetch an array containing UUID strings for each available
SyncCommandSet
.
- Fetch an array containing UUID strings for each available
- Determine which
SyncCommandSet
s haven’t yet been applied locally. - If any
SyncCommandSet
s haven’t yet been applied, fetch them to theUnappliedSyncCommandSets
helper file directory. - Go through each
SyncCommandSet
and:- Carry out the command, determining whether synchronization can continue, or whether e.g. the entire store needs to be downloaded.
- Add the UUID of the set to the list of
AppliedSyncCommands.ticdsync
.
- If synchronization can continue, then for each client device that isn’t the current device:
- Fetch an array containing UUID strings for each available
SyncChangeSet
. - Determine which
SyncChangeSet
s haven’t yet been applied locally. - If any
SyncChangeSet
s haven’t yet been applied, fetch them to theUnappliedSyncChangeSets
helper file directory.
- Fetch an array containing UUID strings for each available
Operations are typically created automatically by the relevant sync manager.
%warning%
Warning: You must use one of the subclasses ofTICDSPreSynchronizationOperation
.
Tasks
Methods Overridden by Subclasses
-
– fetchRemoteIntegrityKey
Fetch the integrity key for this document.
-
– buildArrayOfClientDeviceIdentifiers
Build an array of
NSString
identifiers for all clients that have synchronized with this document. -
– buildArrayOfSyncChangeSetIdentifiersForClientIdentifier:
Build an array of
NSString
identifiers for eachSyncChangeSet
for the given client device. -
– fetchSyncChangeSetWithIdentifier:forClientIdentifier:toLocation:
Fetch a
SyncChangeSet
with a given identifier from a client’sSyncChanges
directory.
Callbacks
-
– fetchedRemoteIntegrityKey:
Pass back the remote integrity key for this document.
-
– builtArrayOfClientDeviceIdentifiers:
Pass back the assembled
NSArray
ofNSString
ClientDevice
identifiers. -
– builtArrayOfClientSyncChangeSetIdentifiers:forClientIdentifier:
Pass back the assembled
NSArray
ofNSString
SyncChangeSet
identifiers. -
– fetchedSyncChangeSetWithIdentifier:forClientIdentifier:modificationDate:withSuccess:
Indicate whether the download of the specified
SyncChangeSet
was successful.
Properties
-
integrityKey
The integrity key provided either by the client to check existing data matches integrity, or set during registration for new documents.
property
File Locations
-
unappliedSyncChangeSetsFileLocation
The location of this document’s
propertyUnappliedSyncChangeSets.ticdsync
file. -
unappliedSyncChangesDirectoryLocation
The location of the
propertyUnappliedSyncChanges
directory for this synchronization operation. -
appliedSyncChangeSetsFileLocation
The location of this document’s
propertyAppliedSyncChangeSets.ticdsync
file. -
syncTransactions
The sync transactions whose unsaved applied sync change files will be used as persistent stores to augment the applied sync changes managed object context.
property
Properties
appliedSyncChangeSetsFileLocation
The location of this document’s AppliedSyncChangeSets.ticdsync
file.
@property (strong) NSURL *appliedSyncChangeSetsFileLocation
Declared In
TICDSPreSynchronizationOperation.h
integrityKey
The integrity key provided either by the client to check existing data matches integrity, or set during registration for new documents.
@property (copy) NSString *integrityKey
Declared In
TICDSPreSynchronizationOperation.h
syncTransactions
The sync transactions whose unsaved applied sync change files will be used as persistent stores to augment the applied sync changes managed object context.
@property NSArray *syncTransactions
Declared In
TICDSPreSynchronizationOperation.h
Instance Methods
buildArrayOfClientDeviceIdentifiers
Build an array of NSString
identifiers for all clients that have synchronized with this document.
- (void)buildArrayOfClientDeviceIdentifiers
Discussion
Call builtArrayOfClientDeviceIdentifiers:
when the array is built.
Declared In
TICDSPreSynchronizationOperation.h
buildArrayOfSyncChangeSetIdentifiersForClientIdentifier:
Build an array of NSString
identifiers for each SyncChangeSet
for the given client device.
- (void)buildArrayOfSyncChangeSetIdentifiersForClientIdentifier:(NSString *)anIdentifier
Parameters
- anIdentifier
The unique identifier of the client.
Discussion
Call builtArrayOfClientSyncChangeSetIdentifiers:forClientIdentifier:
when the array is built.
Declared In
TICDSPreSynchronizationOperation.h
builtArrayOfClientDeviceIdentifiers:
Pass back the assembled NSArray
of NSString
ClientDevice
identifiers.
- (void)builtArrayOfClientDeviceIdentifiers:(NSArray *)anArray
Parameters
- anArray
The array of identifiers. Pass
nil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for anArray
.
Declared In
TICDSPreSynchronizationOperation.h
builtArrayOfClientSyncChangeSetIdentifiers:forClientIdentifier:
Pass back the assembled NSArray
of NSString
SyncChangeSet
identifiers.
- (void)builtArrayOfClientSyncChangeSetIdentifiers:(NSArray *)anArray forClientIdentifier:(NSString *)anIdentifier
Parameters
- anArray
The array of identifiers. Pass
nil
if an error occurred.
- anIdentifier
The client identifier for this array of
SyncChangeSet
identifiers.
Discussion
If an error occured, call setError:
first, then specify nil
for anArray
.
Declared In
TICDSPreSynchronizationOperation.h
fetchRemoteIntegrityKey
Fetch the integrity key for this document.
- (void)fetchRemoteIntegrityKey
Discussion
This method must call fetchedRemoteIntegrityKey:
to provide the key.
Declared In
TICDSPreSynchronizationOperation.h
fetchSyncChangeSetWithIdentifier:forClientIdentifier:toLocation:
Fetch a SyncChangeSet
with a given identifier from a client’s SyncChanges
directory.
- (void)fetchSyncChangeSetWithIdentifier:(NSString *)aChangeSetIdentifier forClientIdentifier:(NSString *)aClientIdentifier toLocation:(NSURL *)aLocation
Parameters
- aChangeSetIdentifier
The identifier of the sync change set to fetch.
- aClientIdentifier
The identifier of the client who created the sync change set.
- aLocation
The location of the file to upload.
Discussion
This method must call fetchedSyncChangeSetsWithIdentifier:forClientIdentifier:withSuccess:
when finished.
Declared In
TICDSPreSynchronizationOperation.h
fetchedRemoteIntegrityKey:
Pass back the remote integrity key for this document.
- (void)fetchedRemoteIntegrityKey:(NSString *)aKey
Parameters
- aKey
The remote integrity key, or
nil
if an error occurred.
Discussion
If an error occurred, call setError:
first, then specify nil
for aKey
.
Declared In
TICDSPreSynchronizationOperation.h
fetchedSyncChangeSetWithIdentifier:forClientIdentifier:modificationDate:withSuccess:
Indicate whether the download of the specified SyncChangeSet
was successful.
- (void)fetchedSyncChangeSetWithIdentifier:(NSString *)aChangeSetIdentifier forClientIdentifier:(NSString *)aClientIdentifier modificationDate:(NSDate *)aDate withSuccess:(BOOL)success
Parameters
- aChangeSetIdentifier
The identifier for the change set to fetch.
- aClientIdentifier
The identifier of the client who uploaded the change set.
- aDate
The modification date of the change set.
- success
A Boolean indicating whether the sync change set file was downloaded or not.
Discussion
If not, call setError:
first, then specify NO
for success
.
If it was successful, you should supply the original modification date of the file.
Declared In
TICDSPreSynchronizationOperation.h