lib/delta/delta.js
function applyGroupedDelta(groupedDelta, callback) {
  var createdCandidates = [];
  logger.debug('Applying grouped delta', {category: 'sync-delta'});

  async.eachSeries(groupedDelta, (node, cb) => {

    if(node.actions.create && utility.isExcludeFile(utility.getNameFromPath(node.actions.create.path))) {
      //do not process files which match exclude pattern.
      return cb(null);
    }

    syncDb.findByRemoteId(node.id, (err, oldLocalNode) => {
      if(err) return cbDeltaActions(err);

      if(node.actions.create && node.actions.delete) delete node.actions.delete;

      if(!oldLocalNode) {
        //node localy not found by remote id -> process later to avoid conflicts
        //nodes which don't have a create action can be ignored (deleted nodes not present localy)
        if(node.actions.create) createdCandidates.push(node);
        cb(null);
      } else {
        applyDeltaActions(node, oldLocalNode, (err, syncedNode) => {
          resolveConflicts(err, syncedNode, cb);
        });
      }
    });
  }, (err, results) => {
    if(err) return callback(err);
    async.eachSeries(createdCandidates, (node, cb) => {
      applyDeltaActions(node, undefined, (err, syncedNode) => {
        resolveConflicts(err, syncedNode, cb);
      });
    }, callback);
  });
}
function applyGroupedDelta(groupedDelta, callback) {
  var createdCandidates = [];
  logger.debug('Applying grouped delta', {category: 'sync-delta'});

  async.eachSeries(groupedDelta, (node, cb) => {

    if(node.actions.create && utility.isExcludeFile(utility.getNameFromPath(node.actions.create.path))) {
      //do not process files which match exclude pattern.
      return cb(null);
    }

    syncDb.findByRemoteId(node.id, (err, oldLocalNode) => {
      if(err) return cbDeltaActions(err);

      if(node.actions.create && node.actions.delete) delete node.actions.delete;

      if(!oldLocalNode) {
        //node localy not found by remote id -> process later to avoid conflicts
        //nodes which don't have a create action can be ignored (deleted nodes not present localy)
        if(node.actions.create) createdCandidates.push(node);
        cb(null);
      } else {
        applyDeltaActions(node, oldLocalNode, (err, syncedNode) => {
          resolveConflicts(err, syncedNode, cb);
        });
      }
    });
  }, (err, results) => {
    if(err) return callback(err);
    async.eachSeries(createdCandidates, (node, cb) => {
      applyDeltaActions(node, undefined, (err, syncedNode) => {
        resolveConflicts(err, syncedNode, cb);
      });
    }, callback);
  });
}
function applyGroupedDelta ( groupedDelta , callback ) { var createdCandidates = [ ] ; logger . debug ( 'Applying grouped delta' , { category : 'sync-delta' } ) ; async . eachSeries ( groupedDelta , ( node , cb ) => { if ( node . actions . create && utility . isExcludeFile ( utility . getNameFromPath ( node . actions . create . path ) ) ) { //do not process files which match exclude pattern. return cb ( null ) ; } syncDb . findByRemoteId ( node . id , ( err , oldLocalNode ) => { if ( err ) return cbDeltaActions ( err ) ; if ( node . actions . create && node . actions . delete ) delete node . actions . delete ; if ( ! oldLocalNode ) { //node localy not found by remote id -> process later to avoid conflicts //nodes which don't have a create action can be ignored (deleted nodes not present localy) if ( node . actions . create ) createdCandidates . push ( node ) ; cb ( null ) ; } else { applyDeltaActions ( node , oldLocalNode , ( err , syncedNode ) => { resolveConflicts ( err , syncedNode , cb ) ; } ) ; } } ) ; } , ( err , results ) => { if ( err ) return callback ( err ) ; async . eachSeries ( createdCandidates , ( node , cb ) => { applyDeltaActions ( node , undefined , ( err , syncedNode ) => { resolveConflicts ( err , syncedNode , cb ) ; } ) ; } , callback ) ; } ) ; }
Applies grouped remote delta to database

@see ./remote-delta.js groupDelta
@param {Object} groupedDelta - grouped remote delta
@param {Function} callback - callback function
@returns {void} - no return value
Applies grouped remote delta to database