Documentation

Horde_SyncMl_Sync
in package

Copyright 2003-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Tags
author

Anthony Mills amills@pyramid6.com

Table of Contents

STATE_COMPLETED  = 3
STATE_INIT  = 0
STATE_MAP  = 2
STATE_SYNC  = 1
$_client_add_count  : int
Number of objects that have been sent to the server for adding.
$_client_addreplaces  : int
Add due to client replace request when map entry is not found. Happens during SlowSync.
$_client_delete_count  : int
Number of objects that have been sent to the server for deletion.
$_client_replace_count  : int
Number of objects that have been sent to the server for replacement.
$_clientAnchorNext  : int
Sync Anchors determine the interval from which changes are retrieved.
$_errors  : int
Number of failed actions, for logging purposes only.
$_expectingMapData  : bool
Map data is expected whenever an add is sent to the client.
$_server_add_count  : int
Number of objects that have been sent to the client for adding.
$_server_adds  : array<string|int, mixed>
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.
$_server_delete_count  : int
Number of objects that have been sent to the client for deletion.
$_server_deletes  : array<string|int, mixed>
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.
$_server_largeobj  : array<string|int, mixed>
Array holding the remaining content when splitting a large object into multiple messages. Keys are numeric, values are: command, chunkContent, clientContentType, clientEncodingType, cuid, suid
$_server_replace_count  : int
Number of objects that have been sent to the client for replacement.
$_server_replaces  : array<string|int, mixed>
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.
$_server_task_adds  : array<string|int, mixed>
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.
$_serverAnchorLast  : mixed
$_serverAnchorNext  : mixed
$_sourceLocURI  : string
Source (server) URI (database).
$_state  : constant
State of the current sync.
$_syncsReceived  : int
Counts the <Sync>s received by the server. Currently unused.
$_syncsSent  : int
Counts the <Sync>s sent by the server.
$_syncType  : int
The synchronization method, one of the Horde_SyncMl::ALERT_* constants.
$_targetLocURI  : string
Target (client) URI (database).
__construct()  : mixed
addSyncReceived()  : mixed
closeSync()  : mixed
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.
createSyncOutput()  : mixed
Creates a <Sync> output containing the server changes.
createUidMap()  : mixed
getClientAnchorNext()  : mixed
getClientLocURI()  : mixed
getServerAnchorLast()  : mixed
getServerAnchorNext()  : mixed
getServerChange()  : string
Returns the client ID of server change identified by the change type and server ID.
getServerLocURI()  : mixed
getSyncsReceived()  : mixed
handleClientSyncItem()  : mixed
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.
handleFinal()  : mixed
Notifies the sync that a final has been received by the client.
hasPendingElements()  : mixed
Returns true if there are still outstanding server sync items to be sent to the client.
isComplete()  : mixed
setServerChange()  : mixed
Sets the client ID of server change identified by the change type and server ID.
unsetServerChange()  : mixed
Unsets the server-client-map of server change identified by the change type and server ID.
_getServerLargeObjChunk()  : string
Get the next chunk from the cached large object with maximum length of chunkLength or return false.
_retrieveChanges()  : mixed
Retrieves and condenses the changes on the server side since the last synchronization.
_taskToCalendar()  : mixed
Converts a calendar databaseURI to a tasks databaseURI for devices with handleTasksInCalendar.

Constants

STATE_COMPLETED

public mixed STATE_COMPLETED = 3

STATE_INIT

public mixed STATE_INIT = 0
Tags
see
Horde_SyncMl_Sync::_state

STATE_MAP

public mixed STATE_MAP = 2

STATE_SYNC

public mixed STATE_SYNC = 1

Properties

$_client_add_count

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

protected int $_client_add_count = 0

$_client_addreplaces

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

protected int $_client_addreplaces = 0

$_client_delete_count

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

protected int $_client_delete_count = 0

$_client_replace_count

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

protected int $_client_replace_count = 0

$_clientAnchorNext

Sync Anchors determine the interval from which changes are retrieved.

protected int $_clientAnchorNext

$_errors

Number of failed actions, for logging purposes only.

protected int $_errors = 0

$_expectingMapData

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

protected bool $_expectingMapData = alse

$_server_add_count

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

protected int $_server_add_count = 0

$_server_adds

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.

protected array<string|int, mixed> $_server_adds

$_server_delete_count

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

protected int $_server_delete_count = 0

$_server_deletes

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.

protected array<string|int, mixed> $_server_deletes

$_server_largeobj

Array holding the remaining content when splitting a large object into multiple messages. Keys are numeric, values are: command, chunkContent, clientContentType, clientEncodingType, cuid, suid

protected array<string|int, mixed> $_server_largeobj

$_server_replace_count

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

protected int $_server_replace_count = 0

$_server_replaces

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.

protected array<string|int, mixed> $_server_replaces

$_server_task_adds

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.

protected array<string|int, mixed> $_server_task_adds

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.

$_serverAnchorLast

protected mixed $_serverAnchorLast

$_serverAnchorNext

protected mixed $_serverAnchorNext

$_sourceLocURI

Source (server) URI (database).

protected string $_sourceLocURI

$_state

State of the current sync.

protected constant $_state = Horde_SyncMl_Sync::STATE_INIT

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

$_syncsReceived

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

protected int $_syncsReceived = 0

$_syncsSent

Counts the <Sync>s sent by the server.

protected int $_syncsSent = 0

$_syncType

The synchronization method, one of the Horde_SyncMl::ALERT_* constants.

protected int $_syncType

$_targetLocURI

Target (client) URI (database).

protected string $_targetLocURI

Methods

__construct()

public __construct(string $syncType, string $serverURI, string $clientURI, int $serverAnchorLast, int $serverAnchorNext, string $clientAnchorNext) : mixed
Parameters
$syncType : string
$serverURI : string
$clientURI : string
$serverAnchorLast : int
$serverAnchorNext : int
$clientAnchorNext : string
Return values
mixed

addSyncReceived()

public addSyncReceived() : mixed
Return values
mixed

closeSync()

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.

public closeSync() : mixed
Return values
mixed

createSyncOutput()

Creates a <Sync> output containing the server changes.

public createSyncOutput(mixed &$output) : mixed
Parameters
$output : mixed
Tags
todo

Check for Mem/FreeMem and Mem/FreeID when checking MaxObjSize

Return values
mixed

createUidMap()

public createUidMap(mixed $databaseURI, mixed $cuid, mixed $suid) : mixed
Parameters
$databaseURI : mixed
$cuid : mixed
$suid : mixed
Return values
mixed

getClientAnchorNext()

public getClientAnchorNext() : mixed
Return values
mixed

getClientLocURI()

public getClientLocURI() : mixed
Return values
mixed

getServerAnchorLast()

public getServerAnchorLast() : mixed
Return values
mixed

getServerAnchorNext()

public getServerAnchorNext() : mixed
Return values
mixed

getServerChange()

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

public getServerChange(string $change, string $id) : string
Parameters
$change : string

The change type (add, replace, delete).

$id : string

The object's server UID.

Return values
string

The matching client ID or null if none found.

getServerLocURI()

public getServerLocURI() : mixed
Return values
mixed

getSyncsReceived()

public getSyncsReceived() : mixed
Return values
mixed

handleClientSyncItem()

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.

public handleClientSyncItem( &$output, Horde_SyncMl_SyncElement &$item) : mixed
Parameters
$output :
$item : Horde_SyncMl_SyncElement
Tags
todo

maybe this should be moved to SyncItem

Return values
mixed

handleFinal()

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

public handleFinal(mixed &$output[, mixed $debug = false ]) : mixed

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.

Parameters
$output : mixed
$debug : mixed = false
Return values
mixed

hasPendingElements()

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

public hasPendingElements() : mixed

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

Return values
mixed

isComplete()

public isComplete() : mixed
Return values
mixed

setServerChange()

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

public setServerChange(string $change, string $sid, string $cid) : mixed
Parameters
$change : string

The change type (add, replace, delete).

$sid : string

The object's server UID.

$cid : string

The object's client UID.

Return values
mixed

unsetServerChange()

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

public unsetServerChange(string $change, string $id) : mixed
Parameters
$change : string

The change type (add, replace, delete).

$id : string

The object's server UID.

Return values
mixed

_getServerLargeObjChunk()

Get the next chunk from the cached large object with maximum length of chunkLength or return false.

protected _getServerLargeObjChunk(int $chunkLength) : string
Parameters
$chunkLength : int

The maximum length of the chunk.

Return values
string

The next chunk of the cached large object.

_retrieveChanges()

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

protected _retrieveChanges(string $syncDB, array<string|int, mixed> &$adds, array<string|int, mixed> &$replaces, array<string|int, mixed> &$deletes) : mixed
Parameters
$syncDB : string

The database being synchronized.

$adds : array<string|int, mixed>

Will be set with the server-client-uid mappings of added objects.

$replaces : array<string|int, mixed>

Will be set with the server-client-uid mappings of changed objects.

$deletes : array<string|int, mixed>

Will be set with the server-client-uid mappings of deleted objects.

Return values
mixed

_taskToCalendar()

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

protected _taskToCalendar(mixed $databaseURI) : mixed
Parameters
$databaseURI : mixed
Return values
mixed

Search results