Document operation method and device, equipment and storage medium
Patent Information
- Application Number
- CN202310972182.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-03
- Publication Date
- 2026-08-21
- Estimated Expiration
- 2043-08-03
AI Technical Summary
[0004]本申请提供一种文档操作方法、装置、设备及存储介质,用以解决网络资源占用过多,造成服务器与客户端之间的网络出现卡顿的技术问题
[0045]本申请提供的文档操作方法、装置、设备及存储介质,服务器接收客户端发送的操作指令,判断在所述操作指令中的第一版本号;判断与所述待操作文档在当前时刻下的第二版本号是否一致;若一致,则基于所述操作指令对所述待操作文档执行操作转化,并向所述客户端发送转化得到的操作数据与确认信号;若不一致,则基于所述第二版本号下所述待操作文档的文字环境和所述操作指令,对所述第二版本号下的所述待操作文档执行操作转化。基于本申请提供的方法,服务器基于文档的版本号,对文档的操作数据进行了管理维护,在接收到客户端的操作指令时,基于操作指令中的版本号与本地文档当前的版本号,向客户端反馈部分的操作数据,通过减少反馈的操作数据,节省了服务器的网络资源,避免了服务器与客户端之间的网络出现卡顿。
Smart Images

Figure CN116992828B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communications, and more particularly to a document manipulation method, apparatus, device, and storage medium. Background Technology
[0002] The real-time collaborative operation transformation (OT) algorithm enables multiple clients to perform online operations on local documents on the server and transforms these online operations. If a client goes offline from the server, other clients that are not offline can still perform online operations on local documents on the server.
[0003] Currently, when an offline client reconnects to the server, it retrieves all historical operation data of local documents on the server from other clients that were not offline during the offline period. This can lead to excessive consumption of server network resources and cause network lag between the server and the client. Summary of the Invention
[0004] This application provides a document operation method, apparatus, device, and storage medium to solve the technical problem of network lag caused by excessive network resource consumption between the server and the client.
[0005] Firstly, this application provides a document manipulation method applied to a server, the method comprising:
[0006] Receive an operation instruction sent by a client, the operation instruction including the first version number of the document to be operated on in the server when the client retrieves the document to be operated from the server;
[0007] Determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated on at the current time;
[0008] If they match, the operation conversion is performed on the document to be operated under the second version number based on the operation instruction, and the converted operation data and confirmation signal are sent to the client; if they do not match, the operation conversion is performed on the document to be operated under the second version number based on the text environment of the document to be operated under the second version number and the operation instruction.
[0009] In one example, the step of performing an operation transformation on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instructions includes:
[0010] If the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, then the operation conversion is performed on the document to be operated under the second version number based on the operation instruction, and the converted operation data and confirmation signal are sent to the client.
[0011] If the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number, then the operation instruction is ignored;
[0012] If the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, a retention suggestion value corresponding to the operation instruction is determined. If the retention suggestion value does not exceed a preset first threshold, the operation instruction is ignored. If the retention suggestion value exceeds the first threshold, multiple retention suggestions are generated and sent to the client. If a target retention operation is received from the client based on the multiple retention suggestions, an operation transformation is performed on the document to be operated under the second version number based on the target retention operation, and the transformed operation data and confirmation signal are sent to the client. The retention suggestion value is determined based on the degree of change in the text environment corresponding to the operation instruction.
[0013] In one example, the method further includes:
[0014] Determine the number of operation instructions, the amount of data, and the corresponding number of clients for the document to be operated on under the second version number, and obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients;
[0015] If the current weight is greater than the preset second threshold, the version number of the document to be operated on is updated in an incrementing manner.
[0016] Secondly, this application discloses a document manipulation method applied to a client, the method comprising:
[0017] Retrieve the document to be operated from the server at the current moment and generate an operation instruction. The operation instruction includes the first version number of the document to be operated from the server at the time of retrieval.
[0018] The operation instruction is sent to the server so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and when they are inconsistent, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction.
[0019] In one example, the generation operation instructions include:
[0020] Regularly monitor the connection status with the server;
[0021] If a disconnection from the server is detected, a reconnection request is periodically sent to the server, and all operations performed by the client on the document to be operated are recorded in the operation list; and when a reconnection to the server is detected, it is determined whether the version number of the document to be operated on the server at the current time has changed compared with the first version number.
[0022] If the version number has not changed, then obtain the operations of other clients on the document to be operated on in the server at the current time, deduplicate the operations of other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0023] If the version number changes, the initial content of the document to be operated on in the server at the current time is retrieved from the server, and the operations of other clients on the document to be operated on in the server at the current time are obtained from the server. The operations of other clients on the document to be operated and the operations in the operation list are deduplicated, and the deduplicated operations are converted into the operation instructions respectively.
[0024] Thirdly, this application provides a document manipulation device applied to a server, the device comprising:
[0025] The receiving module is used to receive operation instructions sent by the client, the operation instructions including the first version number of the document to be operated in the server when the client retrieves the document to be operated from the server;
[0026] The judgment module is used to determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated at the current time.
[0027] The processing operation is configured to, if consistent, perform an operation conversion on the document to be operated under the second version number based on the operation instruction, and send the converted operation data and confirmation signal to the client; if inconsistent, perform an operation conversion on the document to be operated under the second version number based on the text environment of the document to be operated under the second version number and the operation instruction.
[0028] In one example, the processing module is specifically used to perform an operation transformation on the document to be operated under the second version number if the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, and send the transformed operation data and confirmation signal to the client.
[0029] The processing module is further configured to ignore the operation instruction if the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number.
[0030] The processing module is further configured to: if the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, determine the retention suggestion value corresponding to the operation instruction; if the retention suggestion value does not exceed a preset first threshold, ignore the operation instruction; if the retention suggestion value exceeds the first threshold, generate multiple retention suggestions and send them to the client; if the target retention operation returned by the client based on the multiple retention suggestions is received, perform operation transformation on the document to be operated under the second version number based on the target retention operation, and send the transformed operation data and confirmation signal to the client, wherein the retention suggestion value is determined based on the degree of change of the text environment corresponding to the operation instruction.
[0031] In one example, the device further includes:
[0032] The determination module is used to determine the number of operation instructions, the amount of data, and the number of corresponding clients for the document to be operated on under the second version number, and to obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients;
[0033] The update module is used to update the version number of the document to be operated on in an incrementing manner if the current weight is greater than a preset second threshold.
[0034] Fourthly, this application provides a document manipulation device for use on a client side, the device comprising:
[0035] The extraction module is used to extract the document to be operated on from the server at the current time and generate an operation instruction. The operation instruction includes the first version number of the document to be operated on in the server at the time of extraction.
[0036] The sending module is configured to send the operation instruction to the server, so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and when they are inconsistent, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction.
[0037] In one example, the extraction module is specifically used to periodically monitor the connection status with the server;
[0038] The extraction module is further configured to periodically send a reconnection request to the server if a disconnection with the server is detected, and simultaneously record all operations performed by the client on the document to be operated on in the operation list; and, when a reconnection with the server is detected, determine whether the version number of the document to be operated on in the server at the current time has changed compared with the first version number.
[0039] The extraction module is further configured to, if the version number has not changed, obtain operations from other clients on the document to be operated on in the server at the current time, deduplicate the operations of other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0040] The extraction module is further configured to, if the version number changes, re-extract the initial content of the document to be operated on from the server at the current time, obtain the operations of other clients on the document to be operated on from the server at the current time, deduplicate the operations of the other clients on the document to be operated on and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0041] Fifthly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;
[0042] The memory stores computer-executed instructions;
[0043] The processor executes computer execution instructions stored in the memory to implement the method described above.
[0044] Sixthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the method described above.
[0045] The document operation method, apparatus, device, and storage medium provided in this application involve a server receiving an operation instruction from a client, determining a first version number in the operation instruction, and determining whether it matches a second version number of the document to be operated on at the current time. If they match, the server performs an operation conversion on the document to be operated on based on the operation instruction and sends the converted operation data and a confirmation signal to the client. If they do not match, the server performs an operation conversion on the document to be operated on based on the text environment of the document under the second version number and the operation instruction. Based on the method provided in this application, the server manages and maintains document operation data based on the document's version number. When receiving an operation instruction from the client, the server feeds back some operation data to the client based on the version number in the operation instruction and the current version number of the local document. By reducing the amount of operation data fed back, server network resources are saved, and network lag between the server and the client is avoided. Attached Figure Description
[0046] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0047] Figure 1 This is a schematic diagram illustrating an application scenario for this application.
[0048] Figure 2 A flowchart illustrating a document manipulation method provided in Embodiment 1 of this application;
[0049] Figure 3 A flowchart illustrating another document manipulation method provided in Embodiment 1 of this application;
[0050] Figure 4 A flowchart illustrating yet another document manipulation method provided in Embodiment 1 of this application;
[0051] Figure 5 This is a flowchart illustrating a document manipulation method provided in Embodiment 2 of this application;
[0052] Figure 6 A flowchart illustrating another document manipulation method provided in Embodiment 2 of this application;
[0053] Figure 7 This is a schematic diagram of the structure of a document manipulation device provided in Embodiment 3 of this application;
[0054] Figure 8 This is a schematic diagram of the structure of a document manipulation device provided in Embodiment 4 of this application;
[0055] Figure 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application.
[0056] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0057] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims.
[0058] Figure 1 This is a schematic diagram illustrating an application scenario for this application. The application maintains online-editable documents on a server. The server connects to multiple clients, allowing users to edit the documents online. These online edits are converted using an OT (Operational Technology) algorithm, and the converted data is transmitted to the server. The server receives the client's data, modifies the document, and synchronizes the data to each client, rendering the document on the client's screen. Even if one client goes offline, the user can still edit the document online using other active clients, updating the document version after a certain number of modifications have been made.
[0059] Currently, when a client that has gone offline reconnects to the server, it retrieves all historical operation data of other clients that were not offline during the offline period from the server's local documents. This causes excessive network resource consumption on the server, resulting in network lag between the server and the client.
[0060] After the client and server reconnect following an offline event, this application, based on the method provided, allows the server to manage and maintain document operation data based on the document's version number. Upon receiving an operation instruction from the client, the server returns partial operation data to the client based on the version number in the operation instruction and the current version number of the local document. By reducing the amount of operation data returned, server network resources are saved, and network lag between the server and client is avoided.
[0061] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0062] Example 1
[0063] Figure 2 This is a flowchart illustrating a document manipulation method provided in Embodiment 1 of this application, as shown below. Figure 2 As shown, the method is applied to a server and includes:
[0064] Step 201: Receive an operation instruction sent by the client, the operation instruction including the first version number of the document to be operated on the server when the client retrieves the document to be operated from the server;
[0065] Step 202: Determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated on at the current time;
[0066] Step 203: If they match, perform an operation conversion on the document to be operated on under the second version number based on the operation instruction, and send the converted operation data and confirmation signal to the client; if they do not match, perform an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction.
[0067] In this embodiment, the execution entity is the server. Using a scenario example, a user operates on a document stored locally on the server via a client. The client generates an operation command based on the user's actions. For instance, if a portion of the document contains "abccdef" and the user wants to delete one of the "c" characters, the client can generate an operation command based on the user's deletion of the "c" and send the deletion command to the server. It's worth noting that the operation command includes a first version number of the operation command. This version number is updated by the server. The server decides whether to update the version number based on the extent of modifications made to the document. If too much content has been modified in the current version of the document, the server will choose to update the version number. The first version number is the version number of the document currently displayed on the client, i.e., the current version number of the document when the client retrieves the document from the server. After receiving the operation command from the client, the server compares the first version number carried in the operation command with a locally maintained second version number to determine if the first version number matches the second version number. The second version number is the version number maintained locally by the server when it receives the operation command.
[0068] If the first version number and the second version number are the same, it indicates that the modification level of the document to be operated on is small between the client fetching the document from the server and the server receiving the operation instruction. The server can directly perform operation transformation on the document to be operated on using the OT algorithm according to the operation instruction. For example, if the operation instruction received by the server is to delete a "c", then based on the operation instruction, one "c" will be deleted from "abccdef", becoming "abcdef". After the operation transformation of the operation instruction is completed, the obtained operation data and confirmation signal are sent to the client so that the client can render the document to be operated on according to the operation data and confirmation signal, that is, render "abccdef" as the modified "abcdef" at the client. If the first version number and the second version number are inconsistent, it indicates that the modification level of the document to be operated on is large between the client fetching the document from the server and the server receiving the operation instruction. It is necessary to judge whether to execute the operation instruction based on the text environment of the document to be operated on at the current local dimension of the server. Specifically, for the document to be operated on with a second version number, the text content related to the operation instruction and its context are judged. The text environment is mainly divided into unchanged, non-existent, and changed. For example, if the content related to the operation instruction has been deleted after receiving the operation instruction (e.g., the "c" is no longer present), then the text environment is considered non-existent. An unchanged operation environment means that the text environment related to the operation instruction has not changed. If the text environment related to the operation instruction exists but has undergone some changes, then it is considered a changed environment. In this case, corresponding operations can be taken according to different text environment types. In this example, the server first determines whether the version number corresponding to the operation instruction is consistent with the current local version number. Operation schemes are provided for consistent and inconsistent version numbers, which can save operation resources and improve the flexibility and efficiency of processing operation instructions.
[0069] Example, Figure 3 A flowchart illustrating another document manipulation method provided in Embodiment 1 of this application is shown below. Figure 3 As shown, in step 203, based on the text environment of the document to be operated on under the second version number and the operation instructions, the document to be operated on under the second version number is subjected to operation conversion, including:
[0070] Step 301: If the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, then perform operation conversion on the document to be operated under the second version number based on the operation instruction, and send the converted operation data and confirmation signal to the client.
[0071] Step 302: If the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number, then the operation instruction is ignored;
[0072] Step 303: If the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, then determine the retention suggestion value corresponding to the operation instruction. If the retention suggestion value does not exceed a preset first threshold, then ignore the operation instruction. If the retention suggestion value exceeds the first threshold, then generate multiple retention suggestions and send them to the client. If the client returns a target retention operation based on the multiple retention suggestions, then perform an operation transformation on the document to be operated under the second version number based on the target retention operation, and send the transformed operation data and confirmation signal to the client. The retention suggestion value is determined based on the degree of change of the text environment corresponding to the operation instruction.
[0073] Based on the scenario example, if the text context involved in the operation instruction remains unchanged, the operation instruction can be processed using the same methods as the first and second version numbers. Specifically, the "c" in "abccdef" is deleted, resulting in "abcdef", and the resulting operation data and confirmation signal are sent to the client. If the text context involved in the operation instruction does not exist, the operation instruction can be ignored. If the text context involved in the operation instruction exists but has changed, a retention suggestion value corresponding to the operation instruction is calculated. Specifically, the principle for calculating the retention suggestion value is as follows: the content corresponding to the operation instruction is taken as the current position, i.e., "c" is taken as the current position, and the position where the text changes is taken as the changed position. The closer the changed position is to the current position, the higher its weight; the less likely the changed position is skipped, the higher its weight. The environmental change score for the current position is calculated based on the amount of operational data and weights related to text changes. The environmental change score before and after the current position is then added to obtain the environmental change score of the operation instruction. Next, the operation score of the operation instruction is calculated based on the data operation type and data size. This operation score is then compared to the environmental change score to obtain a retention recommendation value, which can be in percentage form. A first threshold for the retention recommendation value is preset. The retention recommendation value corresponding to the operation instruction is compared to this first threshold. If it does not exceed the first threshold, it indicates that the operation corresponding to the operation instruction is not recommended to be retained, and the operation instruction can be ignored. Conversely, if it does not exceed the first threshold, it indicates that the operation corresponding to the operation instruction can be retained, but since there is environmental change, multiple retention recommendations can be generated and sent to the client. For example, if the operation instruction is to delete a "c", but the text context corresponding to "c" changes, for example, to "abcdcef", then the operation to delete "c" can send a suggested retention operation of "abcdef" or "abdcef" to the client. The user can choose the final retention target operation based on the suggested retention operation received by the client. For example, if "abcdef" is chosen as the target retention operation, then "abcdef" is returned to the server. After the server receives the target retention operation, it performs an operation transformation on the current local document to be operated on based on the target retention operation, that is, changes "abcdcef" to "abcdef". After the operation transformation is completed, the operation data and confirmation signal are sent to the client, so that the client can render the modified content based on the operation data. This example, by analyzing the text context type involved in the operation instruction and adopting different operation methods, can make the operation instruction effectively processed.
[0074] Optional, Figure 4 This is a flowchart illustrating another document manipulation method provided in Embodiment 1 of this application, as shown below. Figure 4 As shown, the method further includes:
[0075] Step 401: Determine the number of operation instructions, the amount of data, and the corresponding number of clients for the document to be operated on under the second version number; and obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients.
[0076] Step 402: If the current weight is greater than the preset second threshold, then update the version number of the document to be operated on in an incremental update manner.
[0077] In a scenario example, when a document to be operated on is created, its version number can be initialized and used as the initial version number. When updating the version number of the document, the initial version number is used as the starting point, and subsequent version numbers are incremented from the previous version number to obtain the current version number. The triggering condition for version number updates can be determined based on the number of operation commands, the amount of data, and the number of corresponding clients. For example, taking a document with the second version number currently maintained locally as an example, all client operation commands for the document are received. The operation commands, the corresponding data amount, and the number of clients issuing the operation commands are determined. A first weight corresponding to the number of operation commands is obtained based on the operation commands, the corresponding data amount, and the number of clients issuing the operation commands. A second weight corresponding to the amount of data and a third weight corresponding to the number of clients are then used. A weighted sum is calculated based on the operation commands, the corresponding data amount, and the number of clients issuing the operation commands, along with their respective weights, to obtain the current weight. A second threshold corresponding to the preset weight is used. The current weight is compared with the second weight. If the current weight exceeds the second threshold, the number corresponding to the second version number is incremented based on the second version number to obtain the updated version number. In this example, by calculating the current threshold to determine whether to increment the version number of the document to be operated on, the version number of the document to be operated on can be updated in a timely and accurate manner.
[0078] The document operation method provided in this embodiment is applied to a server. First, it receives an operation instruction sent by a client. The operation instruction includes the first version number of the document to be operated on the server when the client retrieves the document from the server. Then, it determines whether the first version number in the operation instruction is consistent with the second version number of the document to be operated on at the current moment. If they are consistent, the server performs an operation transformation on the document under the second version number based on the operation instruction and sends the transformed operation data and confirmation signal to the client. If they are inconsistent, the server performs an operation transformation on the document under the second version number based on the text environment of the document under the second version number and the operation instruction. In this embodiment, the server first determines whether the version number corresponding to the operation instruction is consistent with the current local version number, and provides operation schemes for both consistent and inconsistent version numbers, which can save operation resources and improve the flexibility and efficiency of processing operation instructions.
[0079] Example 2
[0080] Figure 5 This is a flowchart illustrating a document manipulation method provided in Embodiment 2 of this application, as shown below. Figure 5 As shown, the method is applied to the client and includes:
[0081] Step 501: Extract the document to be operated from the server at the current time and generate an operation instruction. The operation instruction includes the first version number of the document to be operated in the server at the time of extraction.
[0082] Step 502: Send the operation instruction to the server so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and when they are inconsistent, it performs operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction.
[0083] In this embodiment, the execution entity is the client. Using a scenario example, the client retrieves the document currently maintained locally by the server and renders it on the client's screen. Based on the user's actions on the document, an operation command is generated. For example, if part of the document contains "abccdef" and the user wants to delete one of the "c"s, the client can generate an operation command based on the user's deletion of the "c" and send the deletion command to the server. When the client retrieves the document, it can simultaneously obtain the first version number of the document at the time of retrieval, the retrieval time, and the name of the document. The first version number, retrieval time, and the name of the document constitute the identity document (ID) of the operation command. After receiving the operation command, the server can obtain the first version number based on the ID of the operation command and compare it with the second version number maintained locally at that time. Specifically, the IDs of the operation commands can be formed into an optimized B+ tree, with all IDs located at leaf nodes, and the leaf nodes forming a doubly linked list. The operation command ID and operation command data are linked using a dual-list approach. For each successfully pushed operation command data, the operation command ID is linked to another optimized B+ tree. By mapping data IDs and operation content through the dual-list set, it is easy to quickly find operations following offline operations and rapidly locate the corresponding operation content.
[0084] When the server determines that the first version number and the second version number are the same, it performs operation transformation on the document to be operated based on the operation instruction, and transmits the operation data and confirmation signal obtained after the operation to the client. After the client confirms that there are no errors, it renders the document to be operated based on the operation data.
[0085] Optional, Figure 6 This is a flowchart illustrating another document manipulation method provided in Embodiment 2 of this application, as shown below. Figure 6 As shown, in step 501, the generation operation instruction includes:
[0086] Step 601: Regularly monitor the connection status with the server;
[0087] Step 602: If a disconnection with the server is detected, a reconnection request is periodically sent to the server, and all operations performed by the client on the document to be operated are recorded in the operation list; and when a reconnection with the server is detected, it is determined whether the version number of the document to be operated in the server at the current time has changed compared with the first version number.
[0088] Step 603: If the version number has not changed, obtain the operations of other clients on the document to be operated on in the server at the current time, deduplicate the operations of other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0089] Step 604: If the version number changes, the initial content of the document to be operated on in the server at the current time is retrieved from the server, and the operations of other clients on the document to be operated on in the server at the current time are obtained from the server. The operations of other clients on the document to be operated and the operations in the operation list are deduplicated, and the deduplicated operations are converted into the operation instructions respectively.
[0090] In this scenario, the client continuously monitors its connection to the server via a monitoring module. When a connection loss is detected, a reconnection request is promptly sent to the server. During the disconnection period, the document to be operated on displayed on the client will not be updated and will remain at its initial version number before the disconnection. In this situation, user actions on the document through the client will not be received by the server, preventing the conversion of operations. Therefore, an operation list can be created, and all user operation records can be sequentially recorded in this list according to the operation order.
[0091] Upon detecting a reconnection to the server, the system first retrieves the second version number of the document to be operated on, which is currently maintained on the server. Since other clients can still operate on the document during the disconnection period, the server continues to update the document's version. After the disconnected client reconnects, the document with the first version number displayed on the disconnected client may differ from the document with the second version number currently maintained on the server. Therefore, the second version number is compared with the first version number. If they are the same, it indicates that no version number update was performed on the server. In this case, all operations on the document with that version number are retrieved from the server, and duplicate operations are deduplicated from the operations recorded in the operation list. The remaining operations after deduplication are then converted into operation instructions. For example, if the operation list records an operation to delete a "c" in "abccdef", but other clients extracting the same operation include the same operation, meaning that a "c" has already been deleted from "abccdef", then the operations recorded in the operation list are deduplicated first.
[0092] If the first version number and the second version number of the document to be operated on are inconsistent, it means that the version has been updated locally on the server. At this time, the version number of the document to be operated on the client is inconsistent with the version number of the document to be operated on the server. Therefore, the initial state of the document to be operated on at the second version number is first extracted from the server and rendered. At the same time, all operations corresponding to the second version number are extracted from the server. Then, the duplicates are removed from the operations recorded in the operation list. Finally, the remaining operations after deduplication are converted into operation instructions.
[0093] The deduplication and transformation instructions are sequentially sent to the server. The server then pushes the transformed documents to all clients according to the offline version synchronization strategy. This offline version synchronization strategy includes attributes such as the number of instructions, the earliest operation time, the corresponding data size, and the number of clients corresponding to each instruction. The higher the number of these attributes, the more important the corresponding operation information, and the earlier it needs to take effect. A corresponding weight can be set for each type. Furthermore, the weight of the corresponding historical version should increase over time. The online status of the users performing the historical offline data operations is also considered; online users have higher weights. Synchronization is determined based on the final calculated score to prevent synchronization starvation of historical offline version data.
[0094] It's worth noting that after a client that hasn't gone offline receives operation data from other clients, it checks if the version of the received operation data matches the version displayed on the page. If they match, it merges the user's currently unsubmitted operations and submitted but not yet returned operations, renders the merged operations, converts the unsubmitted operations, and sends the converted operations to the server. If they don't match, it retrieves the initial state of the document to be operated on at version number two from the server, renders it, and simultaneously retrieves all operations corresponding to version number two from the server. Then, it similarly deduplicates these operations with those recorded in the operation list, and finally converts the remaining deduplicated operations into operation instructions.
[0095] The document operation method provided in this embodiment extracts the document to be operated on from the server at the current moment and generates an operation instruction. The operation instruction includes a first version number of the document to be operated on the server at the time of extraction. The operation instruction is sent to the server so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current moment, it performs an operation transformation on the document to be operated on under the second version number based on the operation instruction and sends the transformed operation data and confirmation signal to the client. When they are inconsistent, the server performs an operation transformation on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction. This embodiment solves the technical problem of network lag between the server and client caused by excessive network resource consumption by only fetching the latest version of the operation data, thus reducing the amount of content fetched.
[0096] Example 3
[0097] Figure 7 This is a schematic diagram of the structure of a document manipulation device provided in Embodiment 3 of this application, as shown below. Figure 7 As shown, the device includes:
[0098] The receiving module 71 is used to receive an operation instruction sent by the client, the operation instruction including the first version number of the document to be operated in the server when the client retrieves the document to be operated from the server;
[0099] The judgment module 72 is used to determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated at the current time;
[0100] Processing operation 73 is used to perform operation conversion on the document to be operated under the second version number based on the operation instruction if they are consistent, and send the converted operation data and confirmation signal to the client; if they are inconsistent, perform operation conversion on the document to be operated under the second version number based on the text environment of the document to be operated under the second version number and the operation instruction.
[0101] In a scenario example, a user interacts with a document stored locally on the server via a client. The client generates an operation command based on the user's actions. For instance, if a portion of the document contains the string "abccdef" and the user wants to delete the letter "c", the client can generate an operation command based on the user's deletion of "c" and send the command to the server. Notably, the operation command includes a first version number, which is updated by the server. The server decides whether to update the version number based on the extent of modifications made to the document; if too much content has been modified in the current version, the server will update the version number. This first version number is the version number of the document currently displayed on the client, i.e., the version number of the document when the client retrieved it from the server. After the receiving module 71 receives the operation command from the client, the judging module 72 compares the first version number carried in the operation command with a locally maintained second version number to determine if they match. The second version number is the version number maintained locally by the server when it receives the operation command.
[0102] If the first version number and the second version number are the same, it indicates that the modification degree of the document to be operated on is small during the period from when the client retrieves the document from the server to when the server receives the operation instruction. Processing operation 73 can directly perform operation transformation on the document according to the operation instruction using the OT algorithm. For example, if the operation instruction received by the server is to delete a "c", then based on the operation instruction, one "c" is deleted from "abccdef", becoming "abcdef". After completing the operation transformation of the operation instruction, processing operation 73 sends the obtained operation data and confirmation signal to the client, so that the client can render the document according to the operation data and confirmation signal, that is, render "abccdef" as the modified "abcdef" at the client. If the first version number and the second version number are inconsistent, it indicates that the modification degree of the document to be operated on is large during the period from when the client retrieves the document from the server to when the server receives the operation instruction. Processing operation 73 needs to judge whether to execute the operation instruction based on the text environment of the document in the local dimension of the server at the current time. Specifically, for the document to be operated on with a second version number, the text content related to the operation instruction and the context of that text content are judged. The text environment is mainly divided into unchanged, non-existent, and changed. For example, if the content related to the operation instruction has been deleted after receiving the operation instruction, such as the "c" is no longer present, then the text environment is non-existent. Unchanged operation environment means that the text environment related to the operation instruction has not changed. If the text environment related to the operation instruction exists but has undergone some changes, then it is considered changed. In this case, corresponding operations can be taken according to different text environment types. In this example, after the receiving module 71 receives the operation instruction, the judging module 72 first judges whether the version number corresponding to the operation instruction is consistent with the current local version number. The processing operation 73 provides operation schemes for consistent and inconsistent version numbers, which can save operation resources and improve the flexibility and efficiency of processing operation instructions.
[0103] Optionally, processing operation 73 is specifically used to perform operation transformation on the document to be operated under the second version number based on the operation instruction if the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, and send the transformed operation data and confirmation signal to the client.
[0104] Processing operation 73 is further used to ignore the operation instruction if the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number.
[0105] Processing operation 73 is further configured to: if the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, determine the retention suggestion value corresponding to the operation instruction; if the retention suggestion value does not exceed a preset first threshold, ignore the operation instruction; if the retention suggestion value exceeds the first threshold, generate multiple retention suggestion operations and send them to the client; if the client returns a target retention operation based on the multiple retention suggestion operations, perform operation transformation on the document to be operated under the second version number based on the target retention operation, and send the transformed operation data and confirmation signal to the client, wherein the retention suggestion value is determined based on the degree of change of the text environment corresponding to the operation instruction.
[0106] In the context of the scenario, if the textual context involved in the operation instruction remains unchanged, processing operation 73 can process the operation instruction using the same methods as the first version number and the second version number. Specifically, it can delete the "c" from "abccdef" to become "abcdef", and then send the resulting operation data and confirmation signal to the client. If the textual context involved in the operation instruction does not exist, processing operation 73 can ignore the operation instruction. If the textual context involved in the operation instruction exists but has changed, a retention suggestion value corresponding to the operation instruction is calculated. Specifically, the principle for calculating the retention suggestion value is as follows: the content corresponding to the operation instruction is taken as the current position, i.e., "c" is taken as the current position, and the position where the text changes is taken as the changed position. The closer the changed position is to the current position, the higher its weight; the less likely the changed position has been skipped, the higher its weight. Processing operation 73 calculates the environmental change score before and after the current position based on the amount of operation data and weight of the text change, and adds the environmental change score before and after the current position to obtain the environmental change score of the operation instruction. Then, it calculates the operation score of the operation instruction based on the data operation type and operation data size in the operation instruction, and compares the operation score with the environmental change score to obtain a retention suggestion value, which can be in percentage form. A first threshold is preset for the retention suggestion value. The retention suggestion value corresponding to the operation instruction is compared with the first threshold. If it does not exceed the first threshold, it means that the operation corresponding to the operation instruction is not recommended to be retained, and the operation instruction can be ignored; otherwise, it means that the operation corresponding to the operation instruction can be retained, but since there is environmental change, multiple retention suggestions can be generated and sent to the client. For example, if the operation instruction is to delete a "c", but the text context corresponding to "c" changes, for example, to "abcdcef", then the operation to delete "c" can send a suggested retention operation of "abcdef" or "abdcef" to the client. The user can choose the final retention target operation based on the suggested retention operation received by the client. For example, if "abcdef" is chosen as the target retention operation, then "abcdef" is returned to the server. After the server receives the target retention operation, it performs an operation transformation on the current local document to be operated on based on the target retention operation, that is, changes "abcdcef" to "abcdef". After the operation transformation is completed, the operation data and confirmation signal are sent to the client, so that the client can render the modified content based on the operation data.This example processing operation 73 analyzes the text environment type involved in the operation instruction and adopts different operation methods to enable the operation instruction to be processed effectively.
[0107] Optionally, the device further includes:
[0108] The determination module is used to determine the number of operation instructions, the amount of data, and the number of corresponding clients for the document to be operated on under the second version number, and to obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients;
[0109] The update module is used to update the version number of the document to be operated on in an incrementing manner if the current weight is greater than a preset second threshold.
[0110] In a scenario example, when a document to be operated on is created, its version number can be initialized and used as the initial version number. When updating the version number of the document, the initial version number is used as the starting point, and subsequent version numbers are incremented from the previous version number to obtain the current version number. The triggering condition for version number updates can be determined based on the number of operation commands, the amount of data, and the number of corresponding clients. For example, taking a document with the second version number currently maintained locally as an example, all client operation commands for the document are received. The module determines the operation command, the corresponding data amount, and the number of clients issuing the operation command. Based on the operation command, the corresponding data amount, and the number of clients issuing the operation command, a first weight corresponding to the number of operation commands is obtained. A second weight corresponding to the data amount and a third weight corresponding to the number of clients are then used. A weighted sum is calculated based on the operation command, the corresponding data amount, and the number of clients issuing the operation command, along with their respective weights, to obtain the current weight. A second threshold corresponding to the preset weight is used. The current weight is compared with the second weight. If the current weight exceeds the second threshold, the update module increments the number corresponding to the second version number based on the second version number to obtain the updated version number. In this example, by calculating the current threshold to determine whether to increment the version number of the document to be operated on, the version number of the document to be operated on can be updated in a timely and accurate manner.
[0111] In this embodiment, the receiving module first receives an operation instruction sent by the client. The operation instruction includes the first version number of the document to be operated on the server when the client retrieves the document from the server. Then, the judging module determines whether the first version number in the operation instruction matches the second version number of the document to be operated on at the current moment. If they match, the processing module performs an operation transformation on the document to be operated on under the second version number based on the operation instruction and sends the transformed operation data and confirmation signal to the client. If they do not match, the processing module performs an operation transformation on the document to be operated on under the second version number based on the text environment of the document under the second version number and the operation instruction. In this embodiment, the server first determines whether the version number corresponding to the operation instruction matches the current local version number, and provides operation schemes for both consistent and inconsistent version numbers, which can save operation resources and improve the flexibility and efficiency of processing operation instructions.
[0112] Example 4
[0113] Figure 8 This is a schematic diagram of the structure of a document manipulation device provided in Embodiment 4 of this application, as shown below. Figure 8 As shown, the device includes:
[0114] Extraction module 81 is used to extract the document to be operated on from the server at the current time and generate an operation instruction. The operation instruction includes the first version number of the document to be operated on in the server at the time of extraction.
[0115] The sending module 82 is configured to send the operation instruction to the server, so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and when they are inconsistent, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction.
[0116] In a scenario example, extraction module 81 retrieves the currently maintained documents to be operated on from the server and renders them on the client's screen. It then generates an operation command based on the user's actions on the document. For instance, if part of the document contains "abccdef" and the user wants to delete one of the "c" characters, sending module 82 can generate an operation command based on the user's deletion of the "c" and send the deletion command to the server. When the client extracts the document to be displayed, it can simultaneously obtain the first version number of the document at the time of extraction, the extraction time, and the name of the document. The first version number, extraction time, and the name of the document constitute the identity document (ID) of the operation command. After receiving the operation command, the server can obtain the first version number based on the ID of the operation command and compare it with the second version number maintained locally at that time. Specifically, the IDs of the operation commands can be formed into an optimized B+ tree, with all IDs located at leaf nodes, and the leaf nodes forming a doubly linked list. The operation command ID and operation command data are linked using a dual-list approach. For each successfully pushed operation command data, the operation command ID is linked to another optimized B+ tree. By mapping data IDs and operation content through the dual-list set, it is easy to quickly find operations following offline operations and rapidly locate the corresponding operation content.
[0117] When the server determines that the first version number and the second version number are the same, it performs operation transformation on the document to be operated based on the operation instruction, and transmits the operation data and confirmation signal obtained after the operation to the client. After the client confirms that there are no errors, it renders the document to be operated based on the operation data.
[0118] Optionally, the extraction module 81 is specifically used to periodically monitor the connection status with the server;
[0119] The extraction module 81 is further configured to periodically send a reconnection request to the server if a disconnection with the server is detected, and simultaneously record all operations performed by the client on the document to be operated on in the operation list; and, when a reconnection with the server is detected, determine whether the version number of the document to be operated on in the server at the current time has changed compared with the first version number.
[0120] The extraction module 81 is further configured to, if the version number has not changed, obtain from the server the operations of other clients on the document to be operated on the server at the current time, deduplicate the operations of the other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0121] The extraction module 81 is further configured to, if the version number changes, re-extract the initial content of the document to be operated on from the server at the current time, obtain the operations of other clients on the document to be operated on from the server at the current time, deduplicate the operations of the other clients on the document to be operated on and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
[0122] Based on the scenario example, the extraction module 81 continuously monitors the connection status with the server. When it detects a disconnection, it promptly sends a reconnection request to the server. During the disconnection period, the document to be operated on displayed on the client will not be updated and will always remain the document with the first version number before the disconnection. At this time, user operations on the document to be operated on through the client will not be received by the server, so the operation conversion cannot be completed. Therefore, an operation list can be created, and all user operation records can be sequentially recorded in the operation list according to the operation order.
[0123] After detecting a reconnection with the server, the extraction module 81 first extracts the second version number of the document to be operated on currently being maintained on the server. Since other clients that are not disconnected can still operate on the document to be operated on during the period when the client is disconnected from the server, the server will still update the version of the document to be operated on. After the disconnected client reconnects to the server, the document to be operated on with the first version number displayed on the disconnected client may be different from the document to be operated on with the second version number currently being maintained on the server. Therefore, the second version number is compared with the first version number. If the second version number is the same as the first version number, it means that the version number has not been updated on the server. At this time, all operations on the document to be operated on with that version number are extracted from the server, and duplicates are removed from the operations recorded in the operation list. The remaining operations after deduplication are then converted into operation instructions. For example, if the operation list records an operation to delete a "c" in "abccdef", but other clients extracting the same operation include the same operation, meaning that a "c" has already been deleted from "abccdef", then the operations recorded in the operation list are deduplicated first.
[0124] If the first version number and the second version number of the document to be operated on are inconsistent, it means that the version has been updated locally on the server. At this time, the version number of the document to be operated on the client is inconsistent with the version number of the document to be operated on the server. Therefore, the initial state of the document to be operated on at the second version number is first extracted from the server and rendered. At the same time, all operations corresponding to the second version number are extracted from the server. Then, the duplicates are removed from the operations recorded in the operation list. Finally, the remaining operations after deduplication are converted into operation instructions.
[0125] The deduplication and transformation instructions are sequentially sent to the server. The server then pushes the transformed documents to all clients according to the offline version synchronization strategy. This offline version synchronization strategy includes attributes such as the number of instructions, the earliest operation time, the corresponding data size, and the number of clients corresponding to each instruction. The higher the number of these attributes, the more important the corresponding operation information, and the earlier it needs to take effect. A corresponding weight can be set for each type. Furthermore, the weight of the corresponding historical version should increase over time. The online status of the users performing the historical offline data operations is also considered; online users have higher weights. Synchronization is determined based on the final calculated score to prevent synchronization starvation of historical offline version data.
[0126] It's worth noting that after a client that hasn't gone offline receives operation data from other clients, it checks if the version of the received operation data matches the version displayed on the page. If they match, it merges the user's currently unsubmitted operations and submitted but not yet returned operations, renders the merged operations, converts the unsubmitted operations, and sends the converted operations to the server. If they don't match, it retrieves the initial state of the document to be operated on at version number two from the server, renders it, and simultaneously retrieves all operations corresponding to version number two from the server. Then, it similarly deduplicates these operations with those recorded in the operation list, and finally converts the remaining deduplicated operations into operation instructions.
[0127] The document operation method provided in this embodiment includes an extraction module that extracts the document to be operated on from the server at the current moment and generates an operation instruction. The operation instruction includes the first version number of the document to be operated on the server at the time of extraction. A sending module sends the operation instruction to the server, so that when the server detects that the first version number matches the second version number of the document to be operated on at the current moment, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction and sends the converted operation data and a confirmation signal to the client. Conversely, when they do not match, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction. This embodiment solves the technical problem of network lag between the server and client caused by excessive network resource consumption by only fetching the latest version of the operation data, thus reducing the amount of content fetched.
[0128] Example 5
[0129] Figure 9 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of this application, as shown below. Figure 9 As shown, the electronic device includes:
[0130] The server includes a processor 291 and a memory 292; it may also include a communication interface 293 and a bus 294. The processor 291, memory 292, and communication interface 293 can communicate with each other via the bus 294. The communication interface 293 can be used for information transmission. The processor 291 can invoke logical instructions stored in the memory 292 to execute the methods described in the above embodiments.
[0131] Furthermore, the logic instructions in the aforementioned memory 292 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.
[0132] The memory 292, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this application. The processor 291 executes functional applications and data processing by running the software programs, instructions, and modules stored in the memory 292, that is, it implements the methods of the above embodiments.
[0133] The memory 292 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 292 may include high-speed random access memory and may also include non-volatile memory.
[0134] This application provides a non-transitory computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the methods described in the foregoing embodiments.
[0135] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0136] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0137] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0138] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0139] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0140] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0141] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as the combination of these technical features does not contradict each other, it should be considered within the scope of this specification.
[0142] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0143] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A document manipulation method, characterized in that, Applied to a server, the method includes: Receive an operation instruction sent by a client, the operation instruction including the first version number of the document to be operated on in the server when the client retrieves the document to be operated from the server; Determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated on at the current time; If they match, the operation conversion is performed on the document to be operated under the second version number based on the operation instruction, and the converted operation data and confirmation signal are sent to the client; if they do not match, the operation conversion is performed on the document to be operated under the second version number based on the text environment of the document to be operated under the second version number and the operation instruction. The step of performing operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instructions includes: If the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, then the operation conversion is performed on the document to be operated under the second version number based on the operation instruction, and the converted operation data and confirmation signal are sent to the client. If the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number, then the operation instruction is ignored; If the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, a retention suggestion value corresponding to the operation instruction is determined. If the retention suggestion value does not exceed a preset first threshold, the operation instruction is ignored. If the retention suggestion value exceeds the first threshold, multiple retention suggestions are generated and sent to the client. If a target retention operation is received from the client based on the multiple retention suggestions, an operation transformation is performed on the document to be operated under the second version number based on the target retention operation, and the transformed operation data and confirmation signal are sent to the client. The retention suggestion value is determined based on the degree of change in the text environment corresponding to the operation instruction.
2. The method according to claim 1, characterized in that, The method further includes: Determine the number of operation instructions, the amount of data, and the corresponding number of clients for the document to be operated on under the second version number, and obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients; If the current weight is greater than the preset second threshold, the version number of the document to be operated on is updated in an incrementing manner.
3. A document manipulation method, characterized in that, Applied to a client, the method includes: Retrieve the document to be operated from the server at the current moment and generate an operation instruction. The operation instruction includes the first version number of the document to be operated from the server at the time of retrieval. The operation instruction is sent to the server, so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and when they are inconsistent, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction; wherein, performing an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction includes: if the text environment corresponding to the operation instruction exists and has not changed in the document to be operated on under the second version number, then performing an operation conversion on the document to be operated on under the second version number based on the operation instruction, and The system sends the converted operation data and confirmation signal to the client. If the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number, the operation instruction is ignored. If the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, a retention suggestion value corresponding to the operation instruction is determined. If the retention suggestion value does not exceed a preset first threshold, the operation instruction is ignored. If the retention suggestion value exceeds the first threshold, multiple retention suggestions are generated and sent to the client. If a target retention operation is received from the client based on the multiple retention suggestions, the system performs an operation conversion on the document to be operated under the second version number based on the target retention operation and sends the converted operation data and confirmation signal to the client. The retention suggestion value is determined based on the degree of change in the text environment corresponding to the operation instruction.
4. The method according to claim 3, characterized in that, The generation operation instructions include: Regularly monitor the connection status with the server; If a disconnection from the server is detected, a reconnection request is periodically sent to the server, and all operations performed by the client on the document to be operated are recorded in the operation list; and when a reconnection to the server is detected, it is determined whether the version number of the document to be operated on the server at the current time has changed compared with the first version number. If the version number has not changed, then obtain the operations of other clients on the document to be operated on in the server at the current time, deduplicate the operations of other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively. If the version number changes, the initial content of the document to be operated on in the server at the current time is retrieved from the server, and the operations of other clients on the document to be operated on in the server at the current time are obtained from the server. The operations of other clients on the document to be operated and the operations in the operation list are deduplicated, and the deduplicated operations are converted into the operation instructions respectively.
5. A document manipulation device, characterized in that, Applied to a server, the device includes: The receiving module is used to receive operation instructions sent by the client, the operation instructions including the first version number of the document to be operated in the server when the client retrieves the document to be operated from the server; The judgment module is used to determine whether the first version number in the operation instruction is consistent with the second version number of the document to be operated at the current time. The processing module is configured to, if consistent, perform an operation conversion on the document to be operated under the second version number based on the operation instruction, and send the converted operation data and confirmation signal to the client; if inconsistent, perform an operation conversion on the document to be operated under the second version number based on the text environment of the document to be operated under the second version number and the operation instruction. The processing module is specifically used to perform an operation transformation on the document to be operated under the second version number if the text environment corresponding to the operation instruction exists and has not changed in the document to be operated under the second version number, and send the transformed operation data and confirmation signal to the client. The processing module is further configured to ignore the operation instruction if the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number. The processing module is further configured to: if the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number, determine the retention suggestion value corresponding to the operation instruction; if the retention suggestion value does not exceed a preset first threshold, ignore the operation instruction; if the retention suggestion value exceeds the first threshold, generate multiple retention suggestions and send them to the client; if the target retention operation returned by the client based on the multiple retention suggestions is received, perform operation transformation on the document to be operated under the second version number based on the target retention operation, and send the transformed operation data and confirmation signal to the client, wherein the retention suggestion value is determined based on the degree of change of the text environment corresponding to the operation instruction.
6. The apparatus according to claim 5, characterized in that, The device further includes: The determination module is used to determine the number of operation instructions, the amount of data, and the number of corresponding clients for the document to be operated on under the second version number, and to obtain the current weight based on the number of operation instructions, the amount of data, and the number of clients; The update module is used to update the version number of the document to be operated on in an incrementing manner if the current weight is greater than a preset second threshold.
7. A document manipulation device, characterized in that, Applied to a client, the device includes: The extraction module is used to extract the document to be operated on from the server at the current time and generate an operation instruction. The operation instruction includes the first version number of the document to be operated on in the server at the time of extraction. The sending module is configured to send the operation instruction to the server, so that when the server detects that the first version number is consistent with the second version number of the document to be operated on at the current time, it performs an operation conversion on the document to be operated on under the second version number based on the operation instruction, and sends the converted operation data and confirmation signal to the client; and, when they are inconsistent, it performs an operation conversion on the document to be operated on under the second version number based on the text environment of the document to be operated on under the second version number and the operation instruction; the sending module is specifically configured to perform an operation conversion on the document to be operated on under the second version number based on the operation instruction if the text environment corresponding to the operation instruction exists and has not changed in the document to be operated on under the second version number, and send the converted operation data and confirmation signal to the client; the sending module is further configured to... If the text environment corresponding to the operation instruction does not exist in the document to be operated under the second version number, the operation instruction is ignored; the sending module is further configured to determine the retention suggestion value corresponding to the operation instruction if the text environment corresponding to the operation instruction exists and changes in the document to be operated under the second version number; if the retention suggestion value does not exceed a preset first threshold, the operation instruction is ignored; if the retention suggestion value exceeds the first threshold, multiple retention suggestion operations are generated and sent to the client; if the target retention operation returned by the client based on the multiple retention suggestion operations is received, the operation conversion is performed on the document to be operated under the second version number based on the target retention operation, and the converted operation data and confirmation signal are sent to the client, wherein the retention suggestion value is determined based on the degree of change of the text environment corresponding to the operation instruction.
8. The apparatus according to claim 7, characterized in that, The extraction module is specifically used to periodically monitor the connection status with the server; The extraction module is further configured to periodically send a reconnection request to the server if a disconnection with the server is detected, and simultaneously record all operations performed by the client on the document to be operated on in the operation list; and, when a reconnection with the server is detected, determine whether the version number of the document to be operated on in the server at the current time has changed compared with the first version number. The extraction module is further configured to, if the version number has not changed, obtain operations from other clients on the document to be operated on in the server at the current time, deduplicate the operations of other clients on the document to be operated and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively. The extraction module is further configured to, if the version number changes, re-extract the initial content of the document to be operated on from the server at the current time, obtain the operations of other clients on the document to be operated on from the server at the current time, deduplicate the operations of the other clients on the document to be operated on and the operations in the operation list, and convert the deduplicated operations into the operation instructions respectively.
9. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in claim 1 or 2.
10. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in claim 3 or 4.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in claim 1 or 2.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in claim 3 or 4.
Citation Information
Patent Citations
Shared file management method, shared file management device, server, and storage medium
CN108512930A
Online document submitting method and device, computer equipment and storage medium
CN112257391A