sdk/src/sync/operations.js
function lockOperation(id) {
        return runner.run(function() {
            // Locking a locked operation should have no effect
            if (lockedOperationId === id) {
                return;
            }
            
            if (!lockedOperationId) {
                lockedOperationId = id;
                return;
            }

            throw new Error('Only one operation can be locked at a time');
        });
    }
function lockOperation(id) {
        return runner.run(function() {
            // Locking a locked operation should have no effect
            if (lockedOperationId === id) {
                return;
            }
            
            if (!lockedOperationId) {
                lockedOperationId = id;
                return;
            }

            throw new Error('Only one operation can be locked at a time');
        });
    }
function lockOperation ( id ) { return runner . run ( function ( ) { // Locking a locked operation should have no effect if ( lockedOperationId === id ) { return ; } if ( ! lockedOperationId ) { lockedOperationId = id ; return ; } throw new Error ( 'Only one operation can be locked at a time' ) ; } ) ; }
Locks the operation with the specified id.

TODO: Lock state and the value of the locked operation should be persisted.
That way we can handle the following scenario: insert -> initiate push -> connection failure after item inserted in server table
-> client crashes or cancels push -> client app starts again -> delete -> condense.
In the above scenario if we condense insert and delete into nothing, we end up not deleting the item we sent to server.
And if we do not condense, insert will have no corresponding data in the table to send to the server while pushing as
the record would have been deleted.
Locks the operation with the specified id .