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)

  1. Fetch an array containing UUID strings for each client device that has synchronized this document.
  2. For each client device that isn’t the current device:
    1. Fetch an array containing UUID strings for each available SyncCommandSet.
  3. Determine which SyncCommandSets haven’t yet been applied locally.
  4. If any SyncCommandSets haven’t yet been applied, fetch them to the UnappliedSyncCommandSets helper file directory.
  5. Go through each SyncCommandSet and:
    1. Carry out the command, determining whether synchronization can continue, or whether e.g. the entire store needs to be downloaded.
    2. Add the UUID of the set to the list of AppliedSyncCommands.ticdsync.
  6. If synchronization can continue, then for each client device that isn’t the current device:
    1. Fetch an array containing UUID strings for each available SyncChangeSet.
    2. Determine which SyncChangeSets haven’t yet been applied locally.
    3. If any SyncChangeSets haven’t yet been applied, fetch them to the UnappliedSyncChangeSets helper file directory.

Operations are typically created automatically by the relevant sync manager.

%warning%
Warning: You must use one of the subclasses of TICDSPreSynchronizationOperation.

Tasks

Methods Overridden by Subclasses

Callbacks

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

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

unappliedSyncChangeSetsFileLocation

The location of this document’s UnappliedSyncChangeSets.ticdsync file.

@property (strong) NSURL *unappliedSyncChangeSetsFileLocation

Declared In

TICDSPreSynchronizationOperation.h

unappliedSyncChangesDirectoryLocation

The location of the UnappliedSyncChanges directory for this synchronization operation.

@property (strong) NSURL *unappliedSyncChangesDirectoryLocation

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