Document synchronization method, apparatus, device, and medium
By using document version identifiers to uniformly monitor document update status and provide updated content, the problem of low synchronization efficiency in online collaborative document processing is solved, server load is reduced, and efficient document synchronization is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2021-03-01
- Publication Date
- 2026-04-28
AI Technical Summary
Existing technologies struggle to effectively synchronize and update various documents when enabling online collaborative document processing, and the server-side monitoring load is high, resulting in low synchronization efficiency.
The update status of documents is monitored uniformly by using the document version identifier of document nodes. When an update to the content object of a room is detected, the updated content is provided to the clients that have subscribed to the content object, thereby reducing the monitoring pressure on the server.
It effectively achieves synchronized updates of online documents while reducing server-side monitoring pressure, improves synchronization efficiency, and implements deduplication and loss prevention through a version mechanism.
Smart Images

Figure CN114996230B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to computer document data processing technology, and more particularly to a document synchronization method, apparatus, device, and medium. Background Technology
[0002] Currently, people use computer software extensively for document processing, and with the increasing demand for collaborative office work, the technology of online collaborative document processing has gradually developed.
[0003] Documents processed collaboratively online may involve complex needs where multiple users need to view, edit, or reference each other's content. How to effectively achieve synchronized updates of various documents while taking into account the implementation costs of front-end and back-end collaboration is one of the research directions of existing technologies. Summary of the Invention
[0004] This disclosure provides a document synchronization method, apparatus, device, and medium that enables the synchronous updating of various documents.
[0005] In a first aspect, embodiments of this disclosure provide a document synchronization method, the method comprising:
[0006] The update status of a document is monitored based on the document version identifier of the document node in the document's tree structure; wherein, the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document;
[0007] When an update to the content object of a room is detected, it is determined that a client has subscribed to the content object in the room; wherein, the content object includes a document;
[0008] Based on the updated content of the content objects in the room, the updated content is provided to the client so that the client can update the content objects.
[0009] Secondly, this disclosure also provides a document synchronization method, the method comprising:
[0010] For the currently processed document on the client, a content update request is sent to the server to request the server to determine the document content based on the document version identifier of the content update request; wherein, the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, and the document version identifier is used to represent the update of the content block belonging to the document;
[0011] Obtain the document version identifier and the content block version identifier belonging to the document, which are fed back by the server.
[0012] Based on the document version identifier and content block version identifier, the entity content is retrieved and sent to the client.
[0013] Thirdly, embodiments of this disclosure also provide a document synchronization device, including:
[0014] The first monitoring module is used to monitor the update status of a document based on the document version identifier of the document node in the document's tree structure; wherein, the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, and the document version identifier is used to represent the update of the content block belonging to the document;
[0015] The first determining module is used to determine, when an update of the content object in a room is detected, a client that has subscribed to the content object in the room; wherein, the content object includes a document;
[0016] The sending module is used to provide the updated content to the client based on the updated content of the content object in the room, so that the client can update the content object.
[0017] Fourthly, embodiments of this disclosure also provide a document synchronization device, the device comprising:
[0018] The request sending module is used to send a content update request to the server for the currently processed document on the client, so as to request the server to determine the document content based on the document version identifier of the content update request; wherein, the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document;
[0019] The version identifier acquisition module is used to acquire the document version identifier and the content block version identifier belonging to the document, which are fed back by the server.
[0020] The content acquisition module is used to acquire entity content to the client based on the document version identifier and content block version identifier.
[0021] Fifthly, embodiments of this disclosure also provide a document synchronization device, including:
[0022] One or more processors;
[0023] Memory, used to store one or more programs;
[0024] When the one or more programs are executed by the one or more processors, the one or more processors implement the document synchronization method as described in any one of the embodiments of this disclosure.
[0025] Sixthly, embodiments of this disclosure also provide a medium storing a computer program that, when executed by a processor, implements the document synchronization method as described in any one of the embodiments of this disclosure.
[0026] The technical solution of this disclosure embodiment uses the document version identifier of the document node to uniformly monitor the update status of the document. When an update of the content object in the room is detected, the updated content of the content object in the room is provided to all clients in the room that have subscribed to the content object, so that the clients can update the content object. Compared with monitoring multiple content blocks in the document separately using the content block version identifier, this effectively reduces the monitoring pressure on the server, thereby achieving effective synchronous updates of online documents while reducing the monitoring pressure on the server. Attached Figure Description
[0027] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0028] Figure 1 This is a schematic diagram of a document tree structure provided in an embodiment of this disclosure;
[0029] Figure 2 This is a flowchart of a document synchronization method provided in an embodiment of this disclosure;
[0030] Figure 3 This is a flowchart of another document synchronization method provided in this embodiment of the disclosure;
[0031] Figure 4 This is a flowchart of yet another document synchronization method provided in this disclosure embodiment;
[0032] Figure 5 This is a schematic diagram of a process for achieving document synchronization using room updates, provided by an embodiment of this disclosure;
[0033] Figure 6 This is a flowchart of another document synchronization method provided in this disclosure embodiment;
[0034] Figure 7 This is a schematic diagram of a process for achieving document synchronization using heartbeats, provided by an embodiment of this disclosure;
[0035] Figure 8 This is a schematic diagram of another process for achieving document synchronization using heartbeats, provided in an embodiment of this disclosure;
[0036] Figure 9 This is a flowchart of another document synchronization method provided in this disclosure embodiment;
[0037] Figure 10 This is a schematic diagram of a process for updating a document using interpolation, provided in an embodiment of this disclosure.
[0038] Figure 11 This is a structural block diagram of a document synchronization device provided in an embodiment of this disclosure;
[0039] Figure 12 This is a structural block diagram of a document synchronization device provided in an embodiment of this disclosure. Detailed Implementation
[0040] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0041] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0042] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0043] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0044] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0045] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0046] This disclosure applies to the processing of online documents, which can be performed by a document synchronization device, implemented in hardware and / or software. The device can be configured in an electronic device with storage and computing capabilities, for example, integrated into a server, where the server processes the online documents to respond to user editing operations via the client. It is preferably suitable for scenarios where a server provides online document editing and viewing services to multiple clients, with the document's physical content and tree structure stored on the server.
[0047] To clearly illustrate the technical solutions of the embodiments of this disclosure, the tree structure of the document to which the embodiments of this disclosure apply is first described. A document (Page) may include various forms of document content, such as text, images, tables, links, and other multimedia entity content, all of which belong to the document. To facilitate the referencing of certain entity content in multiple places, the entity content is separated into content blocks, which can be conveniently referenced by other documents or content blocks on a per-block basis. A content block is a piece of data with independent, collaborative, and recordable capabilities. A referencing relationship refers to the relationship where a source content block in a source document is referenced by another destination document or destination content block. In the destination document or destination content block, the content of the source content block can be copied, and optionally, a tag may be included to display this referencing relationship to the user. Content blocks can be defined in advance by the online document software or by the user. For example, content blocks can be distinguished based on content type, such as text, images, and tables; content blocks can also be distinguished based on preset separators, such as "carriage return", "paragraph separator", and "section break"; and the user can also set the separation boundaries of content blocks.
[0048] Each document corresponds to a tree structure, which the server uses to manage documents. The tree structures of multiple documents can be combined through references and other relationships. Figure 1 This is a schematic diagram of a document tree structure provided in an embodiment of this disclosure. (Reference) Figure 1The image illustrates a simplified tree structure of a document. This document comprises two content blocks: a root content block and other content blocks (non-root nodes). The root content block is the basic content generated during document creation; a document can have only one root content block. Other content blocks are non-root content blocks belonging to the document. They can be generated during creation along with the root content block based on a template, or they can be added by the user after creation. For example... Figure 1 As shown, the tree structure includes two types of nodes: document nodes and content block nodes. A document node (R node) corresponds to the document and also to the root content block of the document. A content block node (A node) corresponds to content block A.
[0049] In a tree structure, the parent-child relationship between document nodes and content block nodes represents the hierarchical relationship between a document and a content block. That is, the parent node of node A is node R, and the child node of node R is node A; there is a parent-child relationship between them.
[0050] Document nodes record a sequence of document version identifiers, and content block nodes record a sequence of content block version identifiers; the document version identifier is used to characterize the update of each content block belonging to the document. Specifically, as follows... Figure 1 As shown, node A includes a content block version identifier sequence, also known as the RV sequence. The content block version identifier, also called a version record (RV), is used to record the various versions of the content block whose content has changed. The content blocks belonging to the document include a root content block, and the document node also records the content block version identifier sequence of the root content block. If node R includes a root content block, it can also include the RV sequence. However, if the document node does not include a root content block, but treats the basic content block as a child node, then the document node may not include the RV sequence. For example... Figure 1 As shown, document nodes also record a document version identifier sequence, or TV sequence, which represents an update of a content block belonging to that document. For example, adding an RV to each content block node can result in adding a TV.
[0051] In the tree structure, edit operation identifiers (TIDs, Transaction IDs) can be further recorded. An edit operation represents a transaction operation that can cause changes to the content of a content block or other changes to the tree structure. As shown in Figure 1, optionally, document nodes and content block nodes also record a sequence of edit operation identifiers, which are used to characterize the edit operation that updates the content block. A TV can be recorded in a one-to-one correspondence with the RV of each node; alternatively, when an edit operation causes changes to the RVs of multiple content blocks, a TV can record multiple RVs corresponding to a single TID.
[0052] Within the tree structure, a table can be created that records tree structure snapshots. Specifically, for each TV (TV), the latest RV (Real Document Count) for all content blocks in that document is recorded under that TV's state. The tree structure snapshot can also record newly added RVs corresponding to that TV.
[0053] In addition to recording the relationship between content blocks and documents, as well as version changes, the nodes in the tree structure also record the entity content of the content blocks. Each content block node can record the entity changes of the content block that correspond to each RV, which is equivalent to the previous RV.
[0054] Figure 2 This is a flowchart illustrating a document synchronization method provided in an embodiment of this disclosure. The method can be executed by a document synchronization device configured in an electronic device. This electronic device can be a terminal device, preferably a server device. For online collaborative document processing, it is preferable that the server stores the content and tree structure of each document and provides update services to each client. Figure 2 As shown, the method in this embodiment includes the following steps:
[0055] S110. Monitor the update status of the document based on the document version identifier of the document node in the document's tree structure.
[0056] A document comprises at least one content block. The tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. Each document node records a document version identifier sequence, which is used to represent updates to each content block belonging to the document. It should be noted that the document version identifier sequence consists of the document version identifiers of the document nodes. When one of the content blocks in the document is updated (equivalent to an update to the document), a new content block version identifier is added to the content block version identifier sequence of the content block node, and a new document version identifier is also added to the document version identifier sequence of that document node.
[0057] The update process for each content block refers to the process of changes occurring to the entity content of each content block. For example, adding, deleting, and modifying the entity content within a content block can all be considered updating the content block. It should be noted that when the entity content of a content block in a document is updated, the document version identifier of the corresponding document node is also updated. This can be understood as follows: each update to a content block updates the corresponding document version identifier, adding a new document version identifier to the document node's document version identifier sequence.
[0058] In this embodiment, the process by which the server monitors the update status of a document based on the document version identifier of the document node may include: monitoring the sequence of document version identifiers of document nodes in the tree structure, and determining that the document has been updated when a new document version identifier is generated.
[0059] In practice, the server monitors the document version identifier sequence of document nodes in the tree structure in real time or periodically to determine if a new document version identifier has been added to the sequence. When a new document version identifier is generated, the corresponding content block version identifier is determined based on the document version identifier. The updated content block is then identified according to the content block version identifier, and its entity content is analyzed to determine the updated content block. The content block version identifier represents the update information of the content block, such as the update count, which is the number of content block version identifiers in the sequence, equal to the update count of the content block. This can be understood as the process of monitoring the update status of a document, which refers to monitoring the entity content of each content block in the document. When the entity content of one of the content blocks is updated, the document generates updated content.
[0060] S120. When an update to the content object of the room is detected, determine the client in the room that has subscribed to the content object.
[0061] The content objects include documents. It's important to note that clients can send requests to the server to join one or more content object rooms, essentially subscribing to updates of the content objects that room is monitoring. Each room can contain one or more content objects; this is not limited. In practice, when the server detects an update to a content object in a room, it queries all clients that have subscribed to that content object in that room.
[0062] It's important to note that the document version identifier is used to record updated content belonging to this document. It may or may not record updates to referenced documents or referenced content blocks within this document. If the document version identifier is set not to record updates to referenced documents and referenced content blocks, then when the entity content of a referenced document or referenced content block within this document is updated, the document version identifier corresponding to this document will not be updated. This can be understood as needing to subscribe to both the document's document version identifier and the content block version identifiers of the referenced content blocks within the document when subscribing to content objects. Content block nodes that have a hierarchical relationship with document nodes are all within the document. Referenced content blocks within the document are not recorded through hierarchical or parent-child relationships in a tree structure, but rather through dedicated reference nodes. These reference nodes are child nodes of the referencing document and parent nodes of the referenced source document or source content block node.
[0063] S130. Based on the updated content of the content objects in the room, provide the updated content to the client so that the client can update the content objects.
[0064] It's important to note that after the server determines all clients in the room have subscribed to the content object, it can push updated content to the clients, allowing them to update their content. Alternatively, clients can also fetch updated content from the server to update their locally cached content. Furthermore, if the size of the updated content pushed by the server to the clients reaches a certain preset value, the clients can send a fetch request to the server to proactively retrieve the updated content and update their locally cached content.
[0065] The technical solution disclosed in this embodiment uses document version identifiers of document nodes to uniformly monitor the update status of documents. When an update to a content object in a room is detected, the updated content of that content object is uniformly provided to all clients that have subscribed to that content object in the room, enabling clients to update their content objects. Compared to monitoring multiple content blocks in a document separately using content block version identifiers, this effectively reduces the monitoring pressure on the server, thus achieving effective synchronous updates of online documents while reducing server monitoring pressure. Furthermore, monitoring the document update status using document version identifiers and providing updated content to clients that have subscribed to the content object when it is updated adds a function to protect the order of subscriptions compared to traditional subscription mechanisms, and relies on versioning to achieve deduplication and prevent data loss.
[0066] Figure 3 This is a flowchart of another document synchronization method provided in this embodiment. This embodiment further defines the document synchronization method based on the above embodiments. This embodiment uses the example of a content block node recording a content block version identifier sequence, and the content object also including content blocks, to illustrate the document synchronization process. Figure 3 As shown, the document synchronization method in this embodiment includes the following steps:
[0067] S210. Monitor the update status of the document based on the document version identifier of the document node in the document's tree structure.
[0068] The document includes at least one content block. The tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. The document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document.
[0069] S220. When an update to the content object of a room is detected, determine the client in the room that has subscribed to the content object.
[0070] The content object includes documents.
[0071] S230. Based on the document version identifier of the document node in the tree structure, and based on the version identifier snapshot of the tree structure, find the new content block version identifier of each content block node corresponding to the newly added document version identifier.
[0072] Here, the version identifier snapshot refers to the correspondence established between the latest document version identifier in the document version identifier sequence of the document node and the latest content block version identifier of the content block node corresponding to each content block contained in the document. For example, suppose that the document corresponding to document node 1 contains 3 content blocks, namely content block B1, content block B2 and content block B3. The document version identifier sequence of document node 1 contains 8 document version identifiers, namely 0, 1, 2, 3, 4, 5, 6 and 7 (i.e., document version identifier 7 represents the latest document version identifier). The content block version identifier sequence of the content block node corresponding to content block B1 contains two content block version identifiers, namely 0 and 1 (i.e., the latest content block version identifier of content block B1 is 1). The content block version identifier sequence of the content block node corresponding to content block B2 contains three content block version identifiers, namely 0, 1 and 2 (i.e., the latest content block version identifier of content block B2 is 2). The content block version identifier sequence of the content block node corresponding to content block B3 contains four content block version identifiers, namely 0, 1, 2 and 3 (the latest content block version identifier of content block B3 is 3). Therefore, a correspondence is established between document version identifier 7 of document node 1 and the latest content block version identifier 1 of content block B1, the latest content block version identifier 2 of content block B2 and the latest content block version identifier 3 of content block B3, and this correspondence is used as a version identifier snapshot.
[0073] It should be noted that a parent-child relationship is established between document nodes and the content block nodes contained in the document they correspond to. Each content block node's content block version identifier corresponds to a document version identifier. This can be understood as follows: based on the document node's document version identifier and a pre-created tree structure's version identifier snapshot, the content block version identifier of each content block node corresponding to that document version identifier can be quickly found. Here, a newly added document version identifier refers to the latest document version identifier in the document node's document version identifier sequence; similarly, a newly added content block version identifier for each content block node refers to the latest content block version identifier in the content block version identifier sequence for that content block node.
[0074] This can be understood as follows: when one of the content blocks in a document is updated, the content block version identifier of the corresponding content block node is updated. Correspondingly, the document version identifier of the document node containing the content block is also updated. A correspondence is then established between the newly added document version identifier and the newly added content block version identifier, and stored in a version identifier snapshot. It should be noted that the version identifier snapshot can be a table used to store the mapping relationship between the document version identifiers of document nodes and the content block version identifiers of content block nodes, or it can be in other forms; this disclosure does not limit this.
[0075] S240. Based on the version identifier of the newly added content block, determine the updated content of the corresponding content block, and provide the updated content to the client so that the client can update the content object.
[0076] In this embodiment, a new content block version identifier is generated in the content block version identifier sequence of the content block node. The corresponding edit operation identifier is then looked up based on this new content block version identifier to determine the corresponding edit operation, thereby determining the updated content of the content block. After the server obtains the updated content of the content block, it pushes the updated content to the client so that the client can update the content object. Of course, when the size of the updated content reaches a certain threshold, the server can notify the client to retrieve the updated content of the content block from the server to update the content object cached locally on the client.
[0077] In one embodiment, the content block node records a content block version identifier sequence, and the document synchronization method further includes: when any content block node belonging to the document node generates a new content block version identifier, adding a document version identifier to the document version identifier sequence of the document node.
[0078] In this embodiment, a document may contain one content block or multiple content blocks. In practice, a document typically contains multiple content blocks, and correspondingly, one document node corresponds to multiple content block nodes. When the entity content of one of the content block nodes corresponding to a document node is updated, a new content block version identifier is added to the content block version identifier sequence of that content block node. Simultaneously, a new document version identifier is added to the document version identifier sequence of the document node corresponding to the content block node. This allows the corresponding content block version identifier to be found through the document version identifier, thereby enabling the retrieval of the updated content of that content block.
[0079] In one embodiment, the content object further includes content blocks, and the document synchronization method further includes: monitoring the update status of the content blocks based on the content block version identifier of the content block node in the tree structure.
[0080] The content block nodes record a content block version identifier sequence, which is used to characterize content updates. In this embodiment, the content block version identifier is used to record the number of updates to the content block; that is, when the content of a content block is updated, a new content block version identifier is added to the content block version identifier sequence. The content block version identifier sequence of each content block node is monitored to determine whether a new content block version identifier has been added. If a new content block version identifier is added to one of the content block version identifier sequences, it is determined that the entity content of that content block has been updated. In actual operation, the content block version identifier sequence of each content block can be monitored in real time or periodically.
[0081] Figure 4 This is a flowchart of another document synchronization method provided in this disclosure. This embodiment further explains the document synchronization process based on the above embodiments. For example, taking the execution of steps S310-S340 before S350 as an example, the document synchronization process is explained, but this is not intended to be limiting. Figure 4 As shown, the document synchronization method in this embodiment includes the following steps:
[0082] S310: Receive the room subscription request triggered by the client when loading a document.
[0083] In this context, a room subscription request refers to a request sent by the client to the server to subscribe to content objects within a room. In this embodiment, the content object includes at least one of the following: a document and a content block. When the client loads a document, it automatically triggers the room subscription request and sends it to the server. The process of the client loading the document refers to the process of the client opening the document. This can be understood as the client automatically subscribing to the content of that document after loading it; or as a user joining a room when they start reading a document. Conversely, closing the document means exiting the room subscription.
[0084] S320. Determine the currently loaded document that the room subscription request points to.
[0085] It should be noted that the room subscription request sent by the client to the server carries the identification information of the loaded document. After the server receives the room subscription request from the client, it parses the room subscription request to obtain the corresponding identification information; then, it determines the currently loaded document that the room subscription request points to based on the identification information.
[0086] S330. Determine the corresponding document node in the tree structure based on the currently loaded document, and identify the document node identifier of the document node as the content object pointed to by the room subscription request.
[0087] It should be noted that the document node identifier refers to the identification information of a document node, used to distinguish different document nodes. This can be understood as a unique identifier for each document node; that is, different document nodes correspond to different document node identifiers. In this embodiment, each document corresponds to a document node in the tree structure, and each document node is configured with a corresponding document node identifier. Correspondingly, the currently loaded document also corresponds to one of the document nodes in the tree structure; that is, its document node in the tree structure can be determined based on the currently loaded document. Then, the document node identifier of the document node is used as the content object pointed to by the room subscription request.
[0088] S340. Add the client to the room corresponding to the content object.
[0089] In some embodiments, each room may include multiple content objects, each content object may include a document and / or a content block. In other embodiments, each room corresponds to one content object to facilitate the update and management of content objects. Each document corresponds to a document node identifier. In an embodiment, after determining the document node corresponding to the currently loaded document, the document node identifier corresponding to that document node is found, and the client is added to the room corresponding to that document node identifier.
[0090] S350. Monitor the update status of the document based on the document version identifier of the document node in the document's tree structure.
[0091] The document includes at least one content block. The tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. The document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document.
[0092] S360. When an update to the content object of a room is detected, determine which client in the room has subscribed to the content object.
[0093] The content object includes documents.
[0094] S370. Based on the updated content of the content objects in the room, provide the updated content to the client so that the client can update the content objects.
[0095] In one embodiment, after determining the corresponding document node in the tree structure based on the currently loaded document, the method further includes: determining the content block node of the referenced content block that the document node has a reference relationship; identifying the content block node with the reference relationship and determining it as the content object pointed to by the room subscription request.
[0096] In practice, each document typically contains multiple content blocks, and correspondingly, each document node can correspond to multiple content block nodes. Among these, the content block node that references a content block within a document node refers to the content block node corresponding to the content block currently referenced by the document node. In this embodiment, after determining the document node of the currently loaded document in the tree structure, the content block referenced by each document node is found and designated as the referenced content block. The content block node of the referenced content block in the tree structure is then obtained, and its identifier is used as the content object pointed to by the room subscription request.
[0097] For example, suppose client 1 loads (i.e. opens) document A, and document A references content block C of document B. Then the content object that the room subscription request sent by client 1 points to is the document node identifier of document A, and also includes the content block node identifier of content block C.
[0098] In one embodiment, after determining the corresponding document node in the tree structure based on the currently loaded document, the method further includes: determining the content block node of the backlink content block with the backreference relationship of the document node; identifying the content block node with the backreference relationship as the content object pointed to by the room subscription request.
[0099] In this embodiment, a content block node with a backlink relationship to a document node refers to a content block node that references the content block of the currently loaded document; that is, other content block nodes reference the currently loaded document. In practice, the currently loaded document can act as a referenced document, meaning that content blocks in other documents or other documents reference the currently loaded document. When the content of the currently loaded document is updated, in order to synchronize the updates of documents or content blocks associated with the currently loaded document, an association is established between the currently loaded document and the documents associated with it. The content block that references the currently loaded document is called a backlink content block with a backlink relationship. For example, assuming document A is referenced by content block D, the preview information of content block D is displayed in the backlink area of document A.
[0100] Accordingly, after determining the document node of the currently loaded document in the tree structure, on the one hand, the content block node of the content block referenced in the document node (i.e., the content block node of the referenced content block with a reference relationship) needs to be determined, and on the other hand, the content block node of the referenced document node (i.e., the content block node of the backlinked content block with a backreference relationship) also needs to be determined. The identifiers of the content block nodes with reference relationships and the identifiers of the content block nodes with backreference relationships are both used as the content object that the room subscription request points to.
[0101] In one embodiment, the method of pushing updated content to clients that have subscribed to content objects through a room update operation is described. This can be understood as the server using a room service to enable clients subscribed to documents and content blocks within a room to receive updated content, thereby allowing the clients to synchronize and update their locally cached documents and content blocks.
[0102] First, interested clients join a room for a document or content block, which is equivalent to subscribing to updates of the content block and document.
[0103] When a document is loaded on the client (i.e., a user opens a document), the client automatically joins a room, meaning the author of the document is the recipient of room recommendations. When a user starts reading a document, it's equivalent to joining a room. Similarly, when a user closes a document, they unsubscribe from that room.
[0104] The server can automatically add all documents and content blocks in the document to the corresponding room. Of course, developers can also choose to add only the document version identifier.
[0105] Users can add rooms based on document version identifiers and content block version identifiers, thus changing the subscription logic. Alternatively, document version identifiers and content block version identifiers can be used as content objects for subscription.
[0106] Then, the server checks for update operations on content objects within a room, on a room-by-room basis.
[0107] Each room can correspond to a content block or a document.
[0108] If a content block is associated with a new content block version identifier, the updated content corresponding to that content block version identifier will be pushed to the clients in the room when a new content block version identifier is generated.
[0109] If a document is associated with a specific document, then when a new document version identifier is generated, the updated content corresponding to that document version identifier will be pushed to the clients in the room.
[0110] By subscribing to both content blocks and documents simultaneously, the server can deduplicate content to avoid sending updates to the client repeatedly.
[0111] Figure 5 This is a schematic diagram illustrating a process for achieving document synchronization using room updates, as provided in an embodiment of this disclosure. Figure 5 As shown, there are three content objects in the room: content block 1 (referred to as Record1), content block 2 (referred to as Record2), and document 1 (Page1). Two clients subscribe to content block 1 (Actor1 and Actor2), three clients subscribe to content block 2 (Actor1, Actor2, and Actor3), and two clients subscribe to document 1 (Actor1 and Actor4). Content block 2 belongs to document 1. When an edit event occurs in content block 2, the room on the server receives this information. The server queries the room for content block 2 and the room members of document 1 to which it belongs, determining the clients subscribed to content block 2 (including Actor1, Actor2, Actor3, and Actor4). Based on the updated content of content block 2 in the room, the server provides the updated content block to the clients (Actor1, Actor2, Actor3, and Actor4) so that these four clients can update the content objects.
[0112] It should be noted that because client Actor1 subscribed to both content block 2 and document 1 to which content block 2 belongs, the server pushed updated content to client Actor1 twice. Of course, in practice, deduplication can be performed to avoid duplicate pushes.
[0113] In one embodiment, Figure 6 This is a flowchart of another document synchronization method provided in this disclosure. The embodiment describes a process of synchronizing and updating a document using heartbeat requests, where the content object also includes content blocks. This embodiment uses the example of S420 being executed between S410 and S420 to illustrate the document synchronization process, but this is not limited; it is sufficient that S420 occurs before S450. Figure 6 As shown, the document synchronization method in this embodiment includes the following steps:
[0114] S410. Monitor the update status of the document based on the document version identifier of the document node in the document's tree structure.
[0115] The document includes at least one content block. The tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. The document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document.
[0116] S420. Monitor the update status of content blocks based on the content block version identifier of the content block node in the tree structure.
[0117] The content block node records a sequence of content block version identifiers, which are used to indicate content updates of the content block.
[0118] S430. When an update to the content object of a room is detected, determine which client in the room has subscribed to the content object.
[0119] The content object includes documents.
[0120] S440. Based on the updated content of the content objects in the room, provide the updated content to the client so that the client can update the content objects.
[0121] S450: Receives heartbeat requests sent by the client.
[0122] A heartbeat request refers to a client sending a detection message to the server to check for the latest version. In practice, the client can send heartbeat requests to the server in real time or periodically.
[0123] S460. Based on the document version identifier of the document node and / or the content block version identifier of the content block node in the tree structure, detect whether the target document or target content block corresponding to the heartbeat request has been updated.
[0124] In this embodiment, after the server receives a heartbeat request from the client, it checks whether the version of the content object pointed to by the heartbeat request has been updated. The content object includes: a document and / or a content block. This can be understood as detecting whether the target document or target content block corresponding to the heartbeat request has been updated based on the document version identifier of the document node and / or the content block version identifier of the content block node in the tree structure of the currently loaded document. The heartbeat mechanism is similar to a room subscription mechanism; it is an update mechanism initiated by the client. When the client loads a document, it listens for the document's TV (TV) and the RV (Reference Provider ID) of the referenced content block, and aggregates heartbeat requests for both the TV and the RV, sending them to the server.
[0125] S470. If the target document or target content block is updated, provide the client with an updated version identifier.
[0126] In one embodiment, for a heartbeat request to monitor the TV (TV), the heartbeat request may carry the latest version of the TV. The server then checks whether the latest version of the TV corresponding to the target document in the heartbeat request is consistent with the latest document version identifier of the document node in the tree structure of the currently loaded document, i.e., whether the document has been updated. If they are consistent, the server feeds back the latest status message of the document. If they are inconsistent, the server feeds back the new version of the TV and the updated RV (Reference Document Version) that the client needs to update to, so that the client can pull the incremental update content. For a heartbeat request to monitor the referenced content block RV, the heartbeat request may carry the identifier of the referenced content block and may or may not carry the latest version of the RV. If the latest version of the RV is not carried, the server feeds back the latest version of the RV directly to the client based on the content block version identifier sequence of the content block node in the tree structure of the currently loaded document, so that the client can check whether the target content block has been updated. When the client detects that the latest version of the RV is consistent with the latest version of the RV cached locally, no update is required; if they are inconsistent, the server pulls the incremental update content of the referenced content block from the server based on the latest version of the RV.
[0127] The technical solution in this embodiment reduces the number of heartbeat requests sent by the client to the server by monitoring the document version identifier, thereby avoiding the technical problem of server-side read propagation.
[0128] Figure 7 This is a schematic diagram illustrating a process for document synchronization using heartbeats, provided in an embodiment of this disclosure. Figure 7 As shown, the client (denoted as ClientVars) passes the heartbeat version of the currently loaded document as a parameter. After the server returns the heartbeat version, if there is a new content block version identifier and a new heartbeat version of a changed content block under the currently loaded document, the client determines whether the new content block version identifier and the new heartbeat version returned by the server are consistent with those in the local cache. If there is a difference, the client requests (fetch miss) the new content block version identifier and the new heartbeat version from the server so that the client can update the new heartbeat version in the local cache.
[0129] There are two types of heartbeats: one is the heartbeat version of the content block, which means that when a new content block version identifier is generated, the server pushes an update to the client; the other is the heartbeat version of the document, where the heartbeat version of the document can only be updated through a heartbeat request.
[0130] Figure 8 This is a schematic diagram illustrating another process for document synchronization using heartbeats, provided in an embodiment of this disclosure. For example... Figure 8As shown, the client (denoted as Actor) sends a heartbeat request to the server. After receiving the heartbeat request, the server queries the latest content block version identifier corresponding to the content block node and the latest document version identifier corresponding to the document node. Then, the server feeds back the updated content corresponding to the latest content block version identifier and the updated content block corresponding to the latest document version identifier to the client, so that the client can update the locally cached documents and content blocks.
[0131] In one embodiment, Figure 9 This is a flowchart of another document synchronization method provided in this disclosure. The embodiment describes a process of synchronously updating the document using a patch update request, where the content object also includes content blocks. Figure 9 As shown, the document synchronization method in this embodiment includes the following steps:
[0132] S510. Monitor the update status of the document based on the document version identifier of the document node in the document's tree structure.
[0133] The document includes at least one content block. The tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. The document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document.
[0134] S520. Monitor the update status of content blocks based on the content block version identifier of the content block node in the tree structure.
[0135] The content block node records a sequence of content block version identifiers, which are used to indicate content updates of the content block.
[0136] S530. When an update to the content object of a room is detected, determine the client in the room that has subscribed to the content object.
[0137] The content object includes documents.
[0138] S540. Based on the updated content of the content objects in the room, provide the updated content to the client so that the client can update the content objects.
[0139] S550 receives the difference update request sent by the client.
[0140] In this context, a patch update request refers to a request initiated by the client to the server to patch a missing version of a content object that it has locally cached. This missing version can manifest in several ways: a heartbeat request reveals a mismatch in the version identifier of the content object; or, after editing a content block, the version identifier returned by the server does not match the local version identifier. Essentially, the patch update request indicates the version identifier of the missing content object on the client's local machine. For example, assuming client 1 is missing document version identifiers 5 through 10 locally, the patch update request sent by client 1 to the server would specify that it requires operations on all six versions from document version identifier 5 to document version identifier 10.
[0141] S560: Based on the version identifier of the target document or target content block specified in the supplementary update request, obtain the corresponding update content and send it back to the client.
[0142] Here, the version identifier of the target document refers to the missing document version identifier on the client's local machine; the version identifier of the target content block refers to the missing content block version identifier on the client's local machine. In this embodiment, the server determines the missing document version identifier and content block version identifier on the client's local machine based on the missing update request, and obtains the target document corresponding to the missing document version identifier, or the target content block corresponding to the missing content block version identifier; then, it obtains the updated content corresponding to the version identifier of the target document, or the updated content corresponding to the version identifier of the target content block, and sends it back to the client, so that the client caches the updated content corresponding to the version identifier of the missing target document or the version identifier of the missing target content block on its local machine.
[0143] Figure 10 This is a schematic diagram illustrating a process for updating a document using interpolation, as provided in an embodiment of this disclosure. Figure 10As shown, 1. The FlowSync module in the client receives content update-related information sent by the server (NEW_CHANGES / ACCEPT_COMMIT / USER_HEARTBEAT()); 1.1 When the client detects an error in the version of a content block or document, it collects the records that need to be patched, i.e., the version information of the content block that needs to be patched; 1.2 The client attempts to patch, and if there is already a patch in progress, the patch update function is not called; 1.3 The client initiates a patch update request (FETCH_MISS()), actively triggering the retrieval of the updated content of the content block corresponding to the latest content block version identifier, or the updated content of the document corresponding to the latest document version identifier, from the server, so that the client can update the locally cached document or content block; 1.3.1 The server pushes the updated content to the client (NEW_CHANGES()); 1.4 The client updates its local cache based on the updated content; 1.5 The client performs local cache flushing (flush()). This can be understood as the client triggering the update request. After comparison, if the client finds a missing version, it automatically sends an update request to the server to achieve automatic version correction. Of course, to avoid sending the update request to the server repeatedly, the client locally records whether it has already sent the update request to the server but has not received a response from the server.
[0144] This embodiment applies to client-side document processing. The technical solution of this embodiment can be implemented in conjunction with the document processing method executed on the server side of the aforementioned embodiments. The method includes:
[0145] S1110. For the currently processed document on the client, a content update request is sent to the server to request the server to determine the document content based on the document version identifier of the content update request.
[0146] The document includes at least one content block, and the tree structure includes document nodes and content block nodes. The parent-child relationship between the document nodes and content block nodes represents the ownership relationship between the document and the content block. The document node records a document version identifier sequence, which is used to represent the update of the content block belonging to the document.
[0147] In this embodiment, the document currently being processed by the client is a document that the client loads for reading or editing. When the client initially loads the document, it needs to obtain the document's physical content from the server. Since the document's content blocks may be edited and updated by other clients, content updates may also be necessary during the editing and processing of the document. The content update request sent by the client to the server can be a room-adding request or a heartbeat request. Referring to the technical solution of the foregoing embodiments, the room-adding request or heartbeat request carries a document identifier or content block identifier, so that the server can respond to the client's update request accordingly.
[0148] That is, in the technical solution of this embodiment, sending a content update request to the server for the currently processed document on the client includes at least one of the following:
[0149] When the client loads the currently processed document, it sends a content update request to the server.
[0150] During the process of editing the currently processed document on the client, a content update request is sent to the server.
[0151] Specifically, the above operations can be:
[0152] For the currently processed document on the client, at least one referenced content block of the currently processed document is identified, and the document version identifier of the currently processed document and the content block identifier of the referenced content block are carried in the update request and sent to the server.
[0153] When the client's currently processed document only includes content blocks belonging to that document, the client can include the document's identifier in the content update request. If the document also references content blocks from other documents, the identifiers of the referencing content blocks can be included in the content update request, and the update request can be sent to both the document identifier and the content block identifier together. Of course, the content update requests for the document identifier and the content block identifier can be sent to the server separately or together.
[0154] Preferably, the document content update request may only include the document identifier, and the server determines the document node based on the document identifier, and then feeds back the latest TV of the document node and the RV of the content block node to which the document belongs.
[0155] S1120. Obtain the document version identifier and the content block version identifier belonging to the document, which are fed back by the server.
[0156] After the server determines the document version identifier and the RV (Reference Document) of the content block belonging to the document, it sends this information back to the client. Of course, the server can also reference the RV of the content block at the same time.
[0157] S1130. Obtain entity content to the client based on the document version identifier and content block version identifier.
[0158] After obtaining TV and RV, the client can further fetch entity content for a given entity from the server based on TV and RV. If it is the initial loading of a document, the full entity content needs to be retrieved. If it is an incremental update during processing, the server can provide the latest version of TV and RV, and the client can then fetch the incremental entity content to its local cache.
[0159] The technical solution of this disclosure allows the client to request the updated content of the document and its associated content block all at once through the document node's TV, without the client needing to listen to each content block separately to initiate a content update request. This reduces the consumption of listening resources on the client and the number of message interactions between the client and server, thus improving document update efficiency.
[0160] Figure 11 This is a structural block diagram of a document synchronization device provided in an embodiment of this disclosure. For example... Figure 11 As shown, the document synchronization device in this embodiment can be optionally configured on the server side. The device includes: a first listening module 610, a first determining module 620, and a first sending module 630.
[0161] The first listening module 610 is used to listen to the update status of the document based on the document version identifier of the document node in the tree structure of the document; wherein the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, and the document version identifier is used to represent the update of the content block belonging to the document;
[0162] The first determining module 620 is used to determine, when an update of the content object in the room is detected, a client that has subscribed to the content object in the room; wherein, the content object includes a document;
[0163] The first sending module 630 is used to provide updated content to the client based on the updated content of the content object in the room, so that the client can update the content object.
[0164] Based on the above embodiments, the listening module is specifically used to: listen to the document version identifier sequence of document nodes in the tree structure, and determine that the document has generated updated content when a new document version identifier is generated.
[0165] Based on the above embodiments, the content block node records a content block version identifier sequence, and the document synchronization device further includes:
[0166] A new module is added to the document version identifier sequence of the document node when a new content block version identifier is generated in any content block node belonging to the document node.
[0167] Based on the above embodiments, the content object also includes content blocks, and the document synchronization device further includes:
[0168] The second monitoring module is used to monitor the update status of content blocks based on the content block version identifier of the content block node in the tree structure; wherein, the content block node records a sequence of content block version identifiers, and the content block version identifier is used to represent the content update of the content block.
[0169] Based on the above embodiments, the first sending module includes:
[0170] The lookup unit is used to find the new content block version identifier of each content block node corresponding to the new document version identifier based on the document version identifier of the document node in the tree structure and the version identifier snapshot of the tree structure.
[0171] The sending unit is used to determine the updated content of the corresponding content block based on the version identifier of the newly added content block, and to provide the updated content to the client.
[0172] Based on the above embodiments, the document synchronization device further includes:
[0173] The first receiving module is used to receive the room subscription request triggered by the client when loading the document, and to determine the content object that the room subscription request points to;
[0174] The Add module is used to add clients to the room corresponding to the content object.
[0175] Based on the above embodiments, determining the content object pointed to by the room subscription request is specifically used for:
[0176] Determine the currently loaded document that the room subscription request points to;
[0177] Based on the currently loaded document, determine the corresponding document node in the tree structure, and identify the document node identifier of the document node as the content object that the room subscription request points to.
[0178] Based on the above embodiments, after determining the corresponding document node in the tree structure according to the currently loaded document, the method further includes:
[0179] Identify the content block nodes of document nodes that reference content blocks that have a reference relationship with the document nodes;
[0180] Identify the content block nodes that have a reference relationship as the content object that the room subscription request points to.
[0181] Based on the above embodiments, after determining the corresponding document node in the tree structure according to the currently loaded document, the method further includes:
[0182] Identify the content block nodes of the backlinked content blocks that have backreferences to the document nodes;
[0183] The content block node with a backreference relationship is identified as the content object that the room subscription request points to.
[0184] Based on the above embodiments, the document synchronization device further includes:
[0185] The second receiving module is used to receive heartbeat requests sent by the client;
[0186] The detection module is used to detect whether the target document or target content block corresponding to the heartbeat request has been updated based on the document version identifier of the document node and / or the content block version identifier of the content block node in the tree structure.
[0187] The second sending module is used to provide the client with an updated version identifier if the target document or target content block is updated.
[0188] Based on the above embodiments, the document synchronization device further includes:
[0189] The third receiving module is used to receive the difference update request sent by the client;
[0190] The feedback module is used to obtain the corresponding update content based on the version identifier of the target document or target content block specified in the update request, and then send the update content back to the client.
[0191] The document synchronization device described above can execute the document synchronization method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of executing the method.
[0192] The document synchronization device in this embodiment can optionally be configured on the client. The device includes: a request sending module 710, a version identifier acquisition module 720, and a content acquisition module 730.
[0193] The request sending module 710 is used to send a content update request to the server for the currently processed document on the client, so as to request the server to determine the document content according to the document version identifier of the content update request; wherein the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, and the document version identifier is used to represent the update of the content block belonging to the document;
[0194] Version identifier acquisition module 720 is used to acquire the document version identifier and the content block version identifier belonging to the document, which are fed back by the server.
[0195] The content acquisition module 730 is used to acquire entity content to the client based on the document version identifier and the content block version identifier.
[0196] In the above embodiments, optionally, the request sending module is specifically used to determine at least one referenced content block of the currently processed document for the client, and to send the document version identifier of the currently processed document and the content block identifier of the referenced content block in the update request to the server.
[0197] In the above embodiments, optionally, the request sending module is specifically used to perform at least one of the following:
[0198] When the client loads the currently processed document, it sends a content update request to the server.
[0199] During the process of editing the currently processed document on the client, a content update request is sent to the server.
[0200] In the above embodiments, optionally, the content update request is a room addition request or a heartbeat request.
[0201] The technical solutions of this disclosure can be used to execute the document processing methods of this disclosure, and have corresponding functions and beneficial effects.
[0202] Figure 12 This is a structural block diagram of a document synchronization device provided in an embodiment of this disclosure. Refer to the following... Figure 12 This diagram illustrates a structural schematic of an electronic device 800 suitable for implementing embodiments of the present disclosure. The terminal devices in these embodiments may include, but are not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 12 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0203] like Figure 12As shown, the electronic device 800 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage device 806 into a random access memory (RAM) 803. The RAM 803 also stores various programs and data required for the operation of the electronic device 800. The processing device 801, ROM 802, and RAM 803 are interconnected via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0204] Typically, the following devices can be connected to I / O interface 805: input devices 806 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 807 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 806 including, for example, magnetic tapes, hard disks, etc.; and communication devices 809. Communication device 809 allows electronic device 800 to communicate wirelessly or wiredly with other devices to exchange data. Although... Figure 12 An electronic device 800 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0205] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 809, or installed from a storage device 806, or installed from a ROM 802. When the computer program is executed by a processing device 801, it performs the functions defined in the methods of embodiments of this disclosure.
[0206] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0207] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0208] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0209] The aforementioned computer-readable medium carries one or more programs that, when executed by the electronic device, cause the electronic device to: monitor the update status of a document based on the document version identifier of a document node in the document's tree structure; wherein the document includes at least one content block, the tree structure includes document nodes and content block nodes, and the parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block; the document node records a sequence of document version identifiers, which are used to represent updates of content blocks belonging to the document; upon detecting an update of a content object in a room, determine that a client in the room has subscribed to the content object; wherein the content object includes a document; and provide the updated content to the client based on the updated content of the content object in the room, so that the client can update the content object.
[0210] The aforementioned computer-readable medium carries one or more programs. When the electronic device executes one or more of these programs, the electronic device causes the following actions: For the currently processed document on the client, it sends a content update request to the server, requesting the server to determine the document content based on the document version identifier of the content update request; wherein the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document nodes and content block nodes represents the attribution relationship between the document and the content block; the document node records a document version identifier sequence, the document version identifier being used to represent an update belonging to the content block of the document; it obtains the document version identifier and the content block version identifier belonging to the document from the server; and it retrieves entity content to the client based on the document version identifier and the content block version identifier.
[0211] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0212] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0213] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".
[0214] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0215] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0216] According to one or more embodiments of this disclosure, a document synchronization method is provided, comprising: monitoring the update status of a document based on a document version identifier of a document node in a tree structure of the document; wherein the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document nodes and the content block nodes represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, the document version identifier being used to represent the update of the content block belonging to the document;
[0217] When an update to the content object of a room is detected, it is determined that a client has subscribed to the content object in the room; wherein, the content object includes a document;
[0218] Based on the updated content of the content objects in the room, the updated content is provided to the client so that the client can update the content objects.
[0219] According to one or more embodiments of this disclosure, a document synchronization method is provided, which monitors the update status of a document based on the document version identifier of a document node in the document's tree structure, including:
[0220] The document version identifier sequence of document nodes in the monitoring tree structure is used to determine that the document has been updated when a new document version identifier is generated.
[0221] According to one or more embodiments of this disclosure, a document synchronization method is provided, wherein the content block node records a content block version identifier sequence, and the method further includes:
[0222] When any of the content block nodes belonging to the document node generates a new content block version identifier, a new document version identifier is added to the document version identifier sequence of the document node.
[0223] According to one or more embodiments of this disclosure, a document synchronization method is provided, wherein the content object further includes content blocks, and the method further includes:
[0224] The update status of the content block is monitored based on the content block version identifier of the content block node in the tree structure; wherein, the content block node records a sequence of content block version identifiers, and the content block version identifier is used to represent the content update of the content block.
[0225] According to one or more embodiments of this disclosure, a document synchronization method is provided, which provides updated content to the client based on updated content objects in the room, including:
[0226] Based on the document version identifier of the document node in the tree structure, and based on the version identifier snapshot of the tree structure, find the new content block version identifier of each content block node corresponding to the newly added document version identifier;
[0227] Based on the version identifier of the newly added content block, the updated content of the corresponding content block is determined, and the updated content is provided to the client.
[0228] According to one or more embodiments of this disclosure, a document synchronization method is provided, the method further comprising:
[0229] Receive a room subscription request triggered by the client when loading a document, and determine the content object that the room subscription request points to;
[0230] Add the client to the room corresponding to the content object.
[0231] According to one or more embodiments of this disclosure, a document synchronization method is provided, wherein determining the content object pointed to by the room subscription request includes:
[0232] Determine the currently loaded document that the room subscription request points to;
[0233] Based on the currently loaded document, the corresponding document node in the tree structure is determined, and the document node identifier of the document node is identified as the content object pointed to by the room subscription request.
[0234] According to one or more embodiments of this disclosure, a document synchronization method is provided, which, after determining the corresponding document node in the tree structure based on the currently loaded document, further includes:
[0235] Identify the content block nodes of the document nodes that have a referencing relationship with the referenced content blocks;
[0236] The content block node with a reference relationship is identified as the content object that the room subscription request points to.
[0237] According to one or more embodiments of this disclosure, a document synchronization method is provided, which, after determining the corresponding document node in the tree structure based on the currently loaded document, further includes:
[0238] Identify the content block nodes of the document nodes that have backlinks to the content blocks with backreference relationships;
[0239] The content block node identifier with a reverse reference relationship is identified as the content object that the room subscription request points to.
[0240] According to one or more embodiments of this disclosure, a document synchronization method is provided, the method further comprising:
[0241] Receive heartbeat requests sent by the client;
[0242] Based on the document version identifier of the document node and / or the content block version identifier of the content block node in the tree structure, detect whether the target document or target content block corresponding to the heartbeat request has been updated;
[0243] If the target document or target content block is updated, an updated version identifier is provided to the client.
[0244] According to one or more embodiments of this disclosure, a document synchronization method is provided, the method further comprising:
[0245] Receive the error correction update request sent by the client;
[0246] Based on the version identifier of the target document or target content block specified in the supplementary update request, the corresponding update content is obtained and fed back to the client.
[0247] According to one or more embodiments of this disclosure, a document synchronization method is provided, comprising:
[0248] For the currently processed document on the client, a content update request is sent to the server to request the server to determine the document content based on the document version identifier of the content update request; wherein, the document includes at least one content block, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document node and the content block node represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, and the document version identifier is used to represent the update of the content block belonging to the document;
[0249] Obtain the document version identifier and the content block version identifier belonging to the document, which are fed back by the server.
[0250] Based on the document version identifier and content block version identifier, the entity content is retrieved and sent to the client.
[0251] In the above method, sending a content update request to the server for the currently processed document on the client includes:
[0252] For the currently processed document on the client, at least one referenced content block of the currently processed document is identified, and the document version identifier of the currently processed document and the content block identifier of the referenced content block are carried in the update request and sent to the server.
[0253] In the above methods, sending a content update request to the server for the currently processed document on the client includes at least one of the following:
[0254] When the client loads the currently processed document, it sends a content update request to the server.
[0255] During the process of editing the currently processed document on the client, a content update request is sent to the server.
[0256] In the above method, the content update request is either a room addition request or a heartbeat request.
[0257] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0258] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0259] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A document synchronization method, characterized in that, The method includes: The document's update status is monitored based on the document version identifiers of document nodes in the document's tree structure. The document includes at least one content block, and the tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. Each document node records a document version identifier sequence, which represents the update of a content block belonging to the document. Each content block node records a content block version identifier sequence, which represents the content update of the content block. The tree structure also includes version identifier snapshots, which record the correspondence between the current document version identifier and the latest content block version identifier of the content block node corresponding to each content block contained in the document. When an update to the content object of a room is detected, it is determined that a client has subscribed to the content object in the room; wherein, the content object includes a document; Based on the updated content of the content objects in the room, the updated content is provided to the client so that the client can update the content objects; Specifically, providing the updated content to the client based on the updated content of the content objects in the room includes: Based on the document version identifier of the document node in the tree structure, and based on the version identifier snapshot of the tree structure, find the new content block version identifier of each content block node corresponding to the newly added document version identifier. Based on the version identifier of the newly added content block, determine the updated content of the corresponding content block and provide the updated content to the client; The method further includes: When any of the content block nodes belonging to the document node generates a new content block version identifier, a new document version identifier is added to the document version identifier sequence of the document node.
2. The method according to claim 1, characterized in that, Based on the document version identifier of the document node in the document's tree structure, the update status of the document is monitored, including: The document version identifier sequence of document nodes in the monitoring tree structure is used to determine that the document has been updated when a new document version identifier is generated.
3. The method according to claim 1, characterized in that, If the content object also includes content blocks, then the method further includes: The update status of the content block is monitored based on the content block version identifier of the content block node in the tree structure.
4. The method according to claim 1 or 3, characterized in that, The method further includes: Receive a room subscription request triggered by the client when loading a document, and determine the content object that the room subscription request points to; Add the client to the room corresponding to the content object.
5. The method according to claim 4, characterized in that, The content object that the room subscription request points to includes: Determine the currently loaded document that the room subscription request points to; Based on the currently loaded document, the corresponding document node in the tree structure is determined, and the document node identifier of the document node is identified as the content object pointed to by the room subscription request.
6. The method according to claim 5, characterized in that, After determining the corresponding document node in the tree structure based on the currently loaded document, the process also includes: Identify the content block nodes of the document nodes that have a referencing relationship with the referenced content blocks; The content block node with a reference relationship is identified as the content object that the room subscription request points to.
7. The method according to claim 5, characterized in that, After determining the corresponding document node in the tree structure based on the currently loaded document, the process also includes: Identify the content block nodes of the document nodes that have backlinks to the content blocks that have backreferences to the document nodes; The content block node with a reverse reference relationship is identified as the content object that the room subscription request points to.
8. The method according to claim 3, characterized in that, The method further includes: Receive heartbeat requests sent by the client; Based on the document version identifier of the document node and / or the content block version identifier of the content block node in the tree structure, detect whether the target document or target content block corresponding to the heartbeat request has been updated; If the target document or target content block is updated, an updated version identifier is provided to the client.
9. The method according to claim 3, characterized in that, The method further includes: Receive the error update request sent by the client; Based on the version identifier of the target document or target content block specified in the supplementary update request, the corresponding update content is obtained and fed back to the client.
10. A document synchronization method, characterized in that, The method includes: For the currently processed document on the client, a content update request is sent to the server to request the server to determine the document content based on the document version identifier of the content update request. The document includes at least one content block and a tree structure, comprising document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. Each document node records a document version identifier sequence, which represents an update of a content block belonging to the document. Each content block node records a content block version identifier sequence, which represents a content update of the content block. When any content block node belonging to the document node generates a new content block version identifier, the server adds a new document version identifier to the document version identifier sequence of the document node. The tree structure also includes a version identifier snapshot, which records the correspondence between the current document version identifier and the latest content block version identifier of the content block node corresponding to each content block contained in the document. Specifically, the server, based on the document version identifier of the document node in the tree structure and the version identifier snapshot of the tree structure, finds the new content block version identifier corresponding to each content block node; based on the new content block version identifier, it determines the updated content of the corresponding content block and provides the updated content to the client. Obtain the document version identifier and the content block version identifier belonging to the document, which are fed back by the server. Based on the document version identifier and content block version identifier, the entity content is retrieved and sent to the client.
11. The method according to claim 10, characterized in that, Sending a content update request to the server for the document currently being processed by the client includes: For the currently processed document on the client, at least one referenced content block of the currently processed document is identified, and the document version identifier of the currently processed document and the content block identifier of the referenced content block are carried in the update request and sent to the server.
12. The method according to claim 11, characterized in that, Sending a content update request to the server for the document currently being processed by the client includes at least one of the following: When the client loads the currently processed document, it sends a content update request to the server. During the process of editing the currently processed document on the client, a content update request is sent to the server.
13. The method according to claim 10, 11, or 12, characterized in that, The content update request is either a room addition request or a heartbeat request.
14. A document synchronization device, characterized in that, include: The first monitoring module is used to monitor the update status of a document based on the document version identifiers of document nodes in the document's tree structure. The document includes at least one content block, and the tree structure includes document nodes and content block nodes. The parent-child relationship between document nodes and content block nodes represents the ownership relationship between the document and the content block. Each document node records a document version identifier sequence, which represents the update of a content block belonging to the document. Each content block node records a content block version identifier sequence, which represents the content update of the content block. The tree structure also includes version identifier snapshots, which record the correspondence between the current document version identifier and the latest content block version identifier of the content block node corresponding to each content block contained in the document. The first determining module is used to determine, when an update of the content object in a room is detected, a client that has subscribed to the content object in the room; wherein, the content object includes a document; The sending module is used to provide the updated content to the client based on the updated content of the content object in the room, so that the client can update the content object; The sending module is specifically used for: Based on the document version identifier of the document node in the tree structure, and based on the version identifier snapshot of the tree structure, find the new content block version identifier of each content block node corresponding to the newly added document version identifier. Based on the version identifier of the newly added content block, determine the updated content of the corresponding content block and provide the updated content to the client; The device further includes: A new module is added to the document version identifier sequence of the document node when a new content block version identifier is generated in any of the content block nodes belonging to the document node.
15. A document synchronization device, characterized in that, The device includes: A request sending module is used to send a content update request to the server for the currently processed document on the client, requesting the server to determine the document content based on the document version identifier of the content update request; wherein, the document includes at least one content block, the document includes a tree structure, the tree structure includes document nodes and content block nodes, the parent-child relationship between the document nodes and content block nodes represents the ownership relationship between the document and the content block; the document node records a document version identifier sequence, the document version identifier is used to represent the update of the content block belonging to the document; the content block node records a content block version identifier sequence, the content block version identifier is used to represent the content update of the content block; wherein, when any content block node belonging to the document node generates a new content block version identifier, the server adds a document version identifier to the document version identifier sequence of the document node; wherein, the tree structure also includes a version identifier snapshot, the version identifier snapshot records the correspondence between the current document version identifier and the latest content block version identifier of the content block node corresponding to each content block contained in the document; Specifically, the server, based on the document version identifier of the document node in the tree structure and the version identifier snapshot of the tree structure, finds the new content block version identifier corresponding to each content block node; based on the new content block version identifier, it determines the updated content of the corresponding content block and provides the updated content to the client. The version identifier acquisition module is used to acquire the document version identifier and the content block version identifier belonging to the document, which are fed back by the server. The content acquisition module is used to acquire entity content to the client based on the document version identifier and content block version identifier.
16. A document synchronization device, characterized in that, include: One or more processors; Memory, used to store one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the document synchronization method as described in any one of claims 1-9 or the document synchronization method as described in any one of claims 10-13.
17. A computer storage medium, characterized in that, The medium stores a computer program that, when executed by a processor, implements the document synchronization method as described in any one of claims 1-9 or as described in any one of claims 10-13.
Citation Information
Patent Citations
Managing the status of documents in a distributed storage system
US20060136513A1
Copy-on-write versioning of documents
US20080104141A1
Method and System for Document Retrieval with Selective Document Comparison
US20140279843A1