2024 October Release

Sync ProcedurePermanent link for this heading

OutlinePermanent link for this heading

The following algorithm outlines the interaction with the Fabasoft Cloud repository. The initial folder traversal collects data. Based on this information, queries for a time based delta can be made.

Outline

var SYNC_DB={};

var SYNC_refdate;

function Init(href)

{

  SYNC_refdate = read initial refdate from GetChangedObjects web service …

  while ( … have folders … ) {

    LoadFolder(href…);

  }

}

function LoadFolder(href…)

{

  var entities = … use WebDAV-PROPFIND href with “Depth: 1” …

  for (var entity of entities) {

    var key = entity.objaddress;

    … store information for key …

    SYNC_DB[key].href = entity.href;

    SYNC_DB[key].etag = entity.getetag;

    … load files …

    … push back folders …

  }

}

function Delta()

{

  var query = {

    refdate: SYNC_refdate;

    objects: [list of all SYNC_DB keys / all objaddress values];

  }

  var response = … post query as JSON to GetChangedObjects web service …

  var result = JSON.parse(response);

  for (var idx = 0, cnt = result.objects.length; idx < cnt; idx++) {

    var key = result.objects[idx];

    var href = SYNC_DB[key].href;

    var etag = SYNC_DB[key].etag;

    … Update required, call LoadFolder or load file using etag

  }

  SYNC_refdate = result.refdate;

}

Initial Folder TraversalPermanent link for this heading

For optimized updates for WebDAV the client has to read the start date of the traversal (SYNC_refdate) from the the GetChangedObjects web service.

Using a series of standard WebDAV PROPFIND request, information about files and folders is collected. In addition to the standard WebDAV attributes of every response entity (href, getetag, getlastmodified, …) a unique ID is returned (objaddress).

For optimized updates for WebDAV the client has to store at least the unique ID of every entity (objaddress) together with some entity information (href, getetag, …).

Query for ChangesPermanent link for this heading

Based on the start date of the initial traversal (SYNC_refdate) and the unique IDs of all response entities (objaddress) the client may query for changed objects.

The result of the query is a list of changed objects (objects) along with their last modification date (changedates) and a new reference date (refdate).

If a folder is in the result list the folder may have changed (e.g. the name changed or a child was added or deleted) and must be checked / loaded based on the entity tag (getetag).

If a file is in the result list it may have changed (e.g. the name changed or the content was changed) and must be checked / loaded based on the entity tag (getetag).

Changed entities have to be handled just as it happened during the initial folder traversal (keep href, getetag and objaddress for new entities.

To repeat the query for changes, the client simply updates the SYNC_refdate with the recent refdate value.