Class SyncML_Sync

Description

Located in /SyncML/SyncML/Sync.php (line 21)


	
			
Variable Summary
Method Summary
 SyncML_Sync SyncML_Sync ( $syncType,  $serverURI,  $clientURI,  $serverAnchorLast,  $serverAnchorNext,  $clientAnchorNext)
 void addSyncReceived ()
 void closeSync ()
 void createSyncOutput ( &$output)
 void createUidMap ( $databaseURI,  $cuid,  $suid)
 void getClientLocURI ()
 string getServerChange (string $change, string $id)
 void getServerLocURI ()
 void handleClientSyncItem ($output &$output,  &$item, SyncML_SyncElement $item)
 void handleFinal ( &$output, [ $debug = false])
 void isComplete ()
 void setServerChange (string $change, string $sid, string $cid)
 void unsetServerChange (string $change, string $id)
 void _retrieveChanges (string $syncDB,  &$adds,  &$replaces,  &$deletes, array $adds, array $replaces, array $deletes)
 void _taskToCalendar ( $databaseURI)
Variables
integer $_clientAnchorNext (line 81)

Sync Anchors determine the interval from which changes are retrieved.

integer $_client_addreplaces = 0 (line 113)

Add due to client replace request when map entry is not found. Happens during SlowSync.

integer $_client_add_count = 0 (line 91)

Number of objects that have been sent to the server for adding.

integer $_client_delete_count = 0 (line 105)

Number of objects that have been sent to the server for deletion.

integer $_client_replace_count = 0 (line 98)

Number of objects that have been sent to the server for replacement.

integer $_errors = 0 (line 141)

Number of failed actions, for logging purposes only.

boolean $_expectingMapData = false (line 63)

Map data is expected whenever an add is sent to the client.

mixed $_serverAnchorLast (line 83)
mixed $_serverAnchorNext (line 84)
array $_server_adds (line 150)

List of object UIDs (in the keys) that have been added on the server since the last synchronization and are supposed to be sent to the client.

integer $_server_add_count = 0 (line 120)

Number of objects that have been sent to the client for adding.

array $_server_deletes (line 168)

List of object UIDs (in the keys) that have been deleted on the server since the last synchronization and are supposed to be sent to the client.

integer $_server_delete_count = 0 (line 134)

Number of objects that have been sent to the client for deletion.

array $_server_replaces (line 159)

List of object UIDs (in the keys) that have been changed on the server since the last synchronization and are supposed to be sent to the client.

integer $_server_replace_count = 0 (line 127)

Number of objects that have been sent to the client for replacement.

array $_server_task_adds (line 182)

List of task UIDs (in the keys) that have been added on the server since the last synchronization and are supposed to be sent to the client.

This is only used for clients handling tasks and events in one database. We need to seperately store the server tasks adds, so when we get a Map command from the client, we know whether to put this in tasks or calendar.

string $_sourceLocURI (line 35)

Source (server) URI (database).

constant $_state = STATE_INIT (line 74)

State of the current sync.

A sync starts in STATE_INIT and moves on to the next state with every <Final> received from the client: STATE_INIT, STATE_SYNC, STATE_MAP, STATE_COMPLETED. STATE_MAP doesn't occur for _FROM_CLIENT syncs.

integer $_syncsReceived = 0 (line 56)

Counts the <Sync>s received by the server. Currently unused.

integer $_syncsSent = 0 (line 49)

Counts the <Sync>s sent by the server.

integer $_syncType (line 42)

The synchronization method, one of the ALERT_* constants.

string $_targetLocURI (line 28)

Target (client) URI (database).

Methods
Constructor SyncML_Sync (line 184)
SyncML_Sync SyncML_Sync ( $syncType,  $serverURI,  $clientURI,  $serverAnchorLast,  $serverAnchorNext,  $clientAnchorNext)
  • $syncType
  • $serverURI
  • $clientURI
  • $serverAnchorLast
  • $serverAnchorNext
  • $clientAnchorNext
addSyncReceived (line 692)
void addSyncReceived ()
closeSync (line 712)

Completes a sync once everything is done: store the sync anchors so the next sync can be a delta sync and produce some debug info.

void closeSync ()
createSyncOutput (line 349)

Creates a <Sync> output containing the server changes.

  • todo: Check for Mem/FreeMem and Mem/FreeID when checking MaxObjSize
void createSyncOutput ( &$output)
  • &$output
createUidMap (line 759)
void createUidMap ( $databaseURI,  $cuid,  $suid)
  • $databaseURI
  • $cuid
  • $suid
getClientAnchorNext (line 744)
void getClientAnchorNext ()
getClientLocURI (line 739)
void getClientLocURI ()
getServerAnchorLast (line 754)
void getServerAnchorLast ()
getServerAnchorNext (line 749)
void getServerAnchorNext ()
getServerChange (line 788)

Returns the client ID of server change identified by the change type and server ID.

  • return: The matching client ID or null if none found.
string getServerChange (string $change, string $id)
  • string $change: The change type (add, replace, delete).
  • string $id: The object's server UID.
getServerLocURI (line 734)
void getServerLocURI ()
getSyncsReceived (line 698)
void getSyncsReceived ()
handleClientSyncItem (line 205)

Here's where the actual processing of a client-sent Sync Item takes place. Entries are added, deleted or replaced from the server database by using backend API calls.

  • todo: maybe this should be moved to SyncItem
void handleClientSyncItem ($output &$output,  &$item, SyncML_SyncElement $item)
handleFinal (line 629)

Notifies the sync that a final has been received by the client.

Depending on the current state of the sync this can mean various things: a) Init phase (Alerts) done. Next package contaings actual syncs. b) Sync sending from client done. Next package are maps (or finish or finish if ONE_WAY_FROM_CLIENT sync c) Maps finished, completly done.

void handleFinal ( &$output, [ $debug = false])
  • &$output
  • $debug
hasPendingElements (line 682)

Returns true if there are still outstanding server sync items to be sent to the client.

This is the case if the MaxMsgSize has been reached and the pending elements are to be sent in another message.

void hasPendingElements ()
isComplete (line 703)
void isComplete ()
setServerChange (line 802)

Sets the client ID of server change identified by the change type and server ID.

void setServerChange (string $change, string $sid, string $cid)
  • string $change: The change type (add, replace, delete).
  • string $sid: The object's server UID.
  • string $cid: The object's client UID.
unsetServerChange (line 815)

Unsets the server-client-map of server change identified by the change type and server ID.

void unsetServerChange (string $change, string $id)
  • string $change: The change type (add, replace, delete).
  • string $id: The object's server UID.
_retrieveChanges (line 603)

Retrieves and condenses the changes on the server side since the last synchronization.

void _retrieveChanges (string $syncDB,  &$adds,  &$replaces,  &$deletes, array $adds, array $replaces, array $deletes)
  • string $syncDB: The database being synchronized.
  • array $adds: Will be set with the server-client-uid mappings of added objects.
  • array $replaces: Will be set with the server-client-uid mappings of changed objects.
  • array $deletes: Will be set with the server-client-uid mappings of deleted objects.
  • &$adds
  • &$replaces
  • &$deletes
_taskToCalendar (line 825)

Converts a calendar databaseURI to a tasks databaseURI for devices with handleTasksInCalendar.

void _taskToCalendar ( $databaseURI)
  • $databaseURI

Documentation generated on Sun, 30 Jan 2011 05:22:32 +0000 by phpDocumentor 1.4.3