This Application claims the benefit of China Patent Application No. 201710341859.2, filed on May 16, 2017, the entirety of which is incorporated by reference herein.
The present invention relates to CWE (Collaborative Working Environment), and in particular, to methods for working collaboratively and systems using the same.
A CWE (collaborative working environment) supports people, such as e-professionals, in their cooperative operations. A successful CWS (collaborative working system) is the availability of group collaboration technology or groupware—hardware and software tools that help groups to access and share information. In a CWS, a command conflict may occur when two or more users edit the same electronic file. Thus, it is desirable to have methods for collaborative working and systems using the same to solve command conflicts in the CWE.
An embodiment of the invention introduces a method for working collaboratively, performed by a processing unit when loading and executing program code of a client, including: receiving a signal indicating an edit made to an electronic file by a user through an MMI (Man Machine Interface); generating and executing an editing command corresponding to the signal; increasing a client revision counter by one in response to the edit; issuing a synchronization request including the editing command to a server; receiving an acknowledgement including the editing command and a value of a server revision counter from the server; and when a value of the client revision counter corresponding to the editing command does not match the value of the server revision counter, determining that a command conflict has occurred and performing a conflict-resolution procedure to synchronize an execution order of the editing commands from all clients.
An embodiment of the invention introduces a method for working collaboratively, performed by a processing unit when loading and executing program code of a server, including: receiving a first synchronization request including an editing command from a first client; increasing a server revision counter by one in response to the receipt of the first synchronization request; transferring a second synchronization request including the editing command and a value of the server revision counter to a second client; and replying with an acknowledgement including the editing command and the value of the server revision counter to the first client.
An embodiment of the invention introduces a system for working collaboratively, including: a server apparatus. The server apparatus includes a memory storing a server revision counter, and a processing unit. The processing unit receives a first synchronization request including an editing command from a first client; increases the server revision counter by one in response to the receipt of the first synchronization request; transfers a second synchronization request including the editing command and a first value of the server revision counter to a second client; and replies with an acknowledgement including the editing command and the value of the server revision counter to the first client.
A detailed description is given in the following embodiments with reference to the accompanying drawings.
The present invention can be fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:
The following description is of the well-contemplated mode of carrying out the invention. This description is made for the purpose of illustrating the general principles of the invention and should not be taken in a limiting sense. The scope of the invention is best determined by reference to the appended claims.
The present invention will be described with respect to particular embodiments and with reference to certain drawings, but the invention is not limited thereto and is only limited by the claims. It will be further understood that the terms “comprises,” “comprising,” “includes” and/or “including,” when used herein, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
Use of ordinal terms such as “first”, “second”, “third”, etc., in the claims to modify a claim element does not by itself connote any priority, precedence, or order of one claim element over another or the temporal order in which acts of a method are performed, but are used merely as labels to distinguish one claim element having a certain name from another element having the same name (but for use of the ordinal term) to distinguish the claim elements.
In some embodiments, a NAS (Network-Attached Storage) system may run program codes of the server 110.
In order to avoid a possible command conflict when two or more users edit the same electronic file, embodiments of the invention enables the server 110 and the clients 120_1 to 120_n to maintain respective revision counters and any of the clients 120_1 to 120_n can inspect its own revision counter with the revision counter of the server 110 to determine whether a command conflict occurs. When a command conflict occurs, the client may perform a conflict-resolution procedure to synchronize an e-document access status of the client with that of the others.
The server 110 may be run on the processing unit 210 or 310 and the clients 120_1 to 120_n may be run on the processing unit 310. When the server 110 is initialized, the revision counter is initiated as 0. Once an editing command is received, the server 110 increases its revision counter (referred to as a server revision counter hereinafter) by one. Any of the clients 120_1 to 120_n when being initialized obtains the up-to-date value of a revision counter from the server 110 and sets its revision counter (referred to as a client revision counter hereinafter) to the obtained value.
Since editing commands to the same electronic file are generated out-of-order by the clients 120_1 to 120_n, it needs to synchronize the execution order of the editing commands among the clients 120_1 to 120_n by using the server 110.
The client 120_1 provides an MMI (Man Machine Interface) to facilitate an edit made to the electronic file by a user. The MMI includes software (such as, drivers, an operating system, etc.) and hardware (such as, a keyboard, a mouse, a touch panel, etc.) for receiving user input. After receiving a signal indicating an edit made to the electronic file by a user through the MMI (step S511), the client 120_1 generates and executes an editing command corresponding to the signal (step S512), increases its client revision counter by one (step S513) and issues a synchronization request to the server 110 (step S514). The signal indicating the editing to the electronic file may be a key press signal or a gesture signal, such as a single-click, a double-click, a single-finger drag, a multiple finger drag, etc. with two-dimensional coordinates. Specifically, the operating system with the drivers of lower layers may generate an application operating signal, for example, a single-click or double-click to a cell, a drag-and-drop of a UI (User Interface) object from coordinates A to B, an input of a letter, a symbol, an additional character or others, according to the signal indicating the editing to the electronic file. Subsequently, the client 120_1 generates an editing command, such as setting a formula of a cell of a spreadsheet, setting a value to a cell of a spreadsheet, drawing a rectangle or a triangle at a particular location, appending a record to a scheduler, removing a record from a scheduler, or others, according to the application operating signals. The editing commands generated by the client 120_1 can be interpreted and executed by each of the clients 120_n to 120_n. The synchronization request may include the identity information of the client 120_1 and the generated editing command to inform the server 110 that the editing command is generated by the client 120_1. The memory 350 may further store a mapping table to indicate that each of the editing commands generated in step S512 is related to what value of the client revision counter generated in step S513. In some embodiments recited in step S514, the synchronization request additionally includes the up-to-date value of the client revision counter. In some other embodiments recited in step S514, the synchronization request additionally includes the execution result of the editing command, thereby enabling the other clients 120_2 to 120_n to obtain the execution result from the synchronization request directly, instead of executing the editing command.
After receiving the synchronization request (step S531), the server 110 increases its server revision counter by one (step S533) and transfers the synchronization request to the other clients 120_2 to 120_n, thereby enabling the other clients 120_2 to 120_n to execute the editing command thereof (step S535). The transferred synchronization request may include the editing command generated by the client 120_1 and the up-to-date value of the server revision counter. In a regular situation (that is, no command conflict occurs), after receiving the synchronization request (step S551), each of the clients 120_2 to 120_n executes the editing command of the synchronization request (step S553) and sets its client revision counter of the memory 350 to the value of the server revision counter of the synchronization request (step S555).
After transferring the synchronization request to the other clients 120_2 to 120_n (step S535), the server 110 replies with an acknowledgment to the client 120_1 that includes the editing command and the up-to-date value of the server revision counter generated by the client 120_1, thereby enabling the client 120_1 to inspect whether a command conflict has occurred accordingly (step S537). It should be understood that, although the revision counters have been synchronized between the client 120_1 and the server 110 before step S511, the server 110 may receive an editing command from at least one of the other clients 120_2 to 120_n between moments at which step S511 is performed but step S531 has not been performed, resulting that the up-to-date value of the server revision counter generated in step S533 is greater than the up-to-date value of the client revision counter generated in step S513. In other words, when detecting that the replied up-to-date value of the server revision counter is greater than the value of the client revision counter corresponding to the last editing command generated in step S513, the client 120_1 determines that a command conflict has occurred. When detecting that the replied up-to-date value of the server revision counter is equal to the value of the client revision counter corresponding to the last editing command generated in step S513, the client 120_1 determines that no command conflict has occurred.
After receiving a reply (step S515), the client 120_1 determines whether the value of its client revision counter corresponding to the generated editing command matches the value of the server revision counter of the reply (step S516). It should be noted that the value of its client revision counter corresponding to the generated editing command may not up-to-date. That is, in some situations, one or more other editing commands may be generated in the time period between steps of S513 and S515 for one editing command. If they are matched, it means that no command conflict has occurred and the client 120_1 waits for a forthcoming signal indicating an edit made to the electronic file by a user (step S511). If they are not matched (the value of its client revision counter corresponding to the generated editing command is usually less than the value of the server revision counter of the reply), it means that a command conflict has occurred and a conflict-solving procedure (including steps S517 to S520) is performed. The client 120_1 may search the mapping table of the memory 350 to obtain the value of its client revision counter corresponding to the generated editing command. In the conflict-resolution procedure, specifically, the client 120_1 undoes the executed editing command (step S517), executes one or more editing commands transferred from the server 110 according to the values of the server revision counter sequentially (step S518), redoes the generated editing command (step S519) and sets its client revision counter of the memory 350 to the value of the server revision counter of the reply (step S520). Undoing the editing command in step S517 erases the last change done to the electronic file or reverts the electronic file to an older state. In other words, the undo will negate the last editing command done in step S512 to the electronic file. The redo in step S519 is the opposite of the undo of step S517. It should be understood that the conflict-solving procedure enables the client 120_1 to execute editing commands generated by the other clients according to the values of the server revision counter of the received synchronization requests before an execution of the editing command generated in step S512, so that the execution orders for all generated editing commands to the same electronic file are consistent among the clients 120_1 to 120_n. The editing commands transferred to the client 120_1 received from the server 110 between steps S511 and S515 may be pushed into a FIFO (First-In-First-Out) queue according to the values of the server revision counter of the synchronization requests and be sequentially popped out and executed in step S518.
The following introduces several use cases to explain how the method synchronizes with the execution order of all editing commands among the clients 120_1 to 120_n.
The use case C1 describes operations when the client 120_1 is initialized: At the moment t1, a server revision counter rev_s of the server 110 is 13. When the client 120_1 is initialized, the client 120_1 and the server 110 perform initialization operations as shown in
The use case C2 describes operations when a user edits a spreadsheet via an MMI of the client 120_1:
The use case C3 describes operations when two users edit two copies of the same spreadsheet via MMIs of the clients 120_1 and 120_2, respectively, and a command conflict occurs:
However, the server 110 receives the synchronization request “Req: Set A2=6 (rev_c2=15)” from the client 120_2 before receiving the synchronization request “Req: Set C1=A1+B1 (rev_c1=15)” from the client 120_1. After receiving the synchronization request “Req: Set A2=6 (rev_c2=15)”, the server 110, at the moment t8, increases the server revision counter rev_s by one and the server revision counter becomes 15. Subsequently, the server 110 transfers the synchronization request “Fwd: Set A2=6 (rev_c2=15)” to the other clients 120_1, 120_3 to 120_n, which includes the editing command “Set A2=6” and the up-to-date value “15” of the server revision counter rev_s, and replies with an acknowledgement “Ack: Set A2=6 (rev_s=15)” to the client 120_2, which includes the editing command “Set Set A2=6” and the up-to-date value “15” of the server revision counter rev_s.
Since an acknowledgement corresponding to the synchronization request “Req: Set C1=A1+B1 (rev_c1=15)” has not been received, the client 120_1 stores the editing command “Set A2=6” in the memory 350 after receiving the synchronization request “Fwd: Set A2=6 (rev_s=15)”.
After replying with an acknowledgement “Ack: Set A2=6 (rev_s=15)” to the client 120_2, the server 110, at the moment t8, increases the server revision counter rev_s by one and the server revision counter rev_s becomes 16 (step S533). Subsequently, the server 110 transfers the synchronization request “Fwd: Set C1=A1+B1 (rev_s=16)” to the other clients 120_2 to 120_n, which includes the editing command “Set C1=A1+B1” and the up-to-date value “16” of the server revision counter rev_s (step S535), and replies with an acknowledgement “Ack: Set C1=A1+B1 (rev_s=16)” to the client 120_1, which includes the editing command “Set C1=A1+B1” and the up-to-date value “16” of the server revision counter rev_s (step S537). In some embodiments, the synchronization request may be “Req: Set C1=A1+B1 (rev_c1=15) (res=11)” and the transferred synchronization request may be “Fwd: Set C1=A1+B1 (rev_s=16) (res=11)” and the two synchronization requests include an execution result “11” of the editing command “Set C1=A1+B1”, enabling any of the clients 120_2 to 120_n to obtain the execution result from the transferred synchronization request directly, instead of executing the editing command “Set C1=A1+B1”.
After receiving the acknowledgement from the server 110 (step S515), the client 120_1 observes that the value “16” of the server revision counter rev_s of the acknowledgement does not match the value “15” of its client revision counter rev_c1 corresponding to the editing command “Set C1=A1+B1”, and determines that a command conflict has occurred (the “No” path of step S516). The client 120_1 undoes the executed editing command “Set C1=A1+B1” (step S517). After executing the transferred editing commands “Set A2=6” received from the server 110 (step S518), the client 120_1 redoes the generated editing command “Set C1=A1+B1” (step S519) and, at the moment t10, sets its client revision counter rev_c1 to the up-to-date value “16” of the server revision counter rev_s of the acknowledgement (step S520).
Although the embodiment has been described as having specific elements in
While the invention has been described by way of example and in terms of the preferred embodiments, it is to be understood that the invention is not limited to the disclosed embodiments. On the contrary, it is intended to cover various modifications and similar arrangements (as would be apparent to those skilled in the art). Therefore, the scope of the appended claims should be accorded the broadest interpretation so as to encompass all such modifications and similar arrangements.
| Number | Date | Country | Kind |
|---|---|---|---|
| 201710341859.2 | May 2017 | CN | national |