Sushant Raikar
2014-06-23 16:43:02 UTC
Link to Patch:
https://gist.github.com/HotSushi/1b8b5086405be091ee86
Introducing Version : This patch introduces version-ing in document.
Date: 23-June-2014
Previous Patch: vehicle.patch (Updated to provide features below)
Author: Sushant Raikar
Note: Ignore all printf's, they are added temporarily for debugging
purpose, and will be removed once the patch is finalized.
Working:
If there is a laggy connection, the documents at the 2 ends may not always
be in the same state. So a LFUN, by the time it reaches the other end, may
have to be dispatched on a different state of document, hence leading to
ambiguity. In order to handle this, a document is given a version. And each
LFUN is targeted at a specific version of document.
A history table is maintained which tracks cursor change after any LFUN
dispatch. When a remote LFUN is received, it is adjusted based on the
history (to predict where the cursor should be in the latest revision).
Naturally,if one cursor position is behind another 'editing' cursor
position, it is unchanged. If it is in front, then it has to be adjusted.
Another important point to note is that, the LFUNs for cursor
movements(move-right, move-left) are not sent to remote, only the important
editing LFUNs (ex character insert, delete, table insert etc) are sent
along with the cursor position where they are dispatched. This approach
provides several advantages:
- unnecessary version change
- less network traffic
- immune to different window sizes (LFUNs for mouse_click,home, end, pageup
etc. will work)
Features:
* local cursor moves based on remote dispatch (unlike in previous patch
where local cursor was staying stationary)
* History queue added, each LFUN sent over dispatches on the targeted
version of the document (consistency)
* adjusting of cursor based on history queue (neglect changes due to self)
* 2 DocIterator's can be subtracted and added back.
* each client is identified by a client_id
Shortcomings:
* no version synchronization. When client connects their buffer is in
'version 0'. All incoming LFUNs are adjusted from version 0.
How to handle, at certain time the two ends should synchronize, and the
cursor will have to be adjusted from version i, instead of 0. (less looping)
* doesn't handle when editing takes place at same cursor location at both
ends.
How to handle, each client is prioritized, higher priority client stays in
its location, lower priority client moves.
https://gist.github.com/HotSushi/1b8b5086405be091ee86
Introducing Version : This patch introduces version-ing in document.
Date: 23-June-2014
Previous Patch: vehicle.patch (Updated to provide features below)
Author: Sushant Raikar
Note: Ignore all printf's, they are added temporarily for debugging
purpose, and will be removed once the patch is finalized.
Working:
If there is a laggy connection, the documents at the 2 ends may not always
be in the same state. So a LFUN, by the time it reaches the other end, may
have to be dispatched on a different state of document, hence leading to
ambiguity. In order to handle this, a document is given a version. And each
LFUN is targeted at a specific version of document.
A history table is maintained which tracks cursor change after any LFUN
dispatch. When a remote LFUN is received, it is adjusted based on the
history (to predict where the cursor should be in the latest revision).
Naturally,if one cursor position is behind another 'editing' cursor
position, it is unchanged. If it is in front, then it has to be adjusted.
Another important point to note is that, the LFUNs for cursor
movements(move-right, move-left) are not sent to remote, only the important
editing LFUNs (ex character insert, delete, table insert etc) are sent
along with the cursor position where they are dispatched. This approach
provides several advantages:
- unnecessary version change
- less network traffic
- immune to different window sizes (LFUNs for mouse_click,home, end, pageup
etc. will work)
Features:
* local cursor moves based on remote dispatch (unlike in previous patch
where local cursor was staying stationary)
* History queue added, each LFUN sent over dispatches on the targeted
version of the document (consistency)
* adjusting of cursor based on history queue (neglect changes due to self)
* 2 DocIterator's can be subtracted and added back.
* each client is identified by a client_id
Shortcomings:
* no version synchronization. When client connects their buffer is in
'version 0'. All incoming LFUNs are adjusted from version 0.
How to handle, at certain time the two ends should synchronize, and the
cursor will have to be adjusted from version i, instead of 0. (less looping)
* doesn't handle when editing takes place at same cursor location at both
ends.
How to handle, each client is prioritized, higher priority client stays in
its location, lower priority client moves.