Method and apparatus for operating a document system

By introducing a root directory lock mechanism and a dual storage space management update lock into the collaborative document system, the problem of mutual interference between update and deletion operations is solved, improving operational efficiency and reducing the probability of errors.

CN115168289BActive Publication Date: 2025-11-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210852257.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-07-20
Publication Date
2025-11-18
Estimated Expiration
2042-07-20

AI Technical Summary

Technical Problem

In online collaborative document systems, update and delete operations are prone to interfering with each other. Existing distributed lock mechanisms have small locking granularity, resulting in low efficiency and error-proneness, especially in high-concurrency situations where deadlocks are likely to occur.

Method used

A root directory locking mechanism is adopted. By generating update locks and delete locks for the root directory in the lock component, locking judgment is only performed at the root directory level. Two storage spaces are used to manage update locks, storing overall and specific update lock data respectively, avoiding traversing the directory tree and repeatedly modifying the number of locks.

Benefits of technology

It improves the efficiency of document system operation, reduces the probability of errors, simplifies lock maintenance and management, and ensures that update and deletion operations do not affect each other.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115168289B_ABST
    Figure CN115168289B_ABST
Patent Text Reader

Abstract

The application discloses an operation method and device of a document system, and relates to the technical field of computers. A specific embodiment of the method comprises the following steps: in response to a target operation initiated by a user and carrying an identifier of a to-be-operated object, determining a root directory of the to-be-operated object according to the identifier of the to-be-operated object; in the case where no first lock corresponding to the target operation and acting on the root directory exists in a preset lock component, creating a target lock corresponding to the target operation and acting on the root directory in the lock component, and executing the target operation; wherein the to-be-operated object comprises a document or a directory in the document system. The embodiment can ensure that the update-type operation and the delete-type operation of the document system do not affect each other through the root directory lock mechanism.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of collaborative office technology, and in particular to a document system operation method and device. BACKGROUND

[0002] In the current online collaborative document system, a user can perform a creating document, modifying directory and other creating type operations under the same directory, and can also perform a deleting file, moving directory and other deleting type operations, the two types of operations are easy to influence each other and cause errors, for example, user a is modifying a document and user b deletes the document or the directory where the document is located without knowing, resulting in user a's work being cleared. In practical applications, a distributed lock can be used to solve the above problems, but the distributed lock currently used is generally set for a document or a directory to be operated, and because the granularity of the lock is too small, it is often necessary to lock everywhere in practical operation, and it is necessary to traverse the entire directory tree to determine whether there is a lock, resulting in low efficiency, difficulty in maintenance, and even deadlocks. In addition, in the update lock mechanism for update type operations, a lock number field is generally maintained in the update lock data structure, and when an update lock is created, the lock number is incremented by 1; when an update lock is released, the lock number is decremented by 1, and the management and maintenance cost of this mechanism is high, and the lock number is easy to be incorrect in high concurrency and some abnormal situations, resulting in failures. SUMMARY

[0003] Therefore, the embodiments of the present application provide a document system operation method and device, which can ensure that update type operations and deleting type operations of a document system do not affect each other through a root directory lock mechanism, and can improve the operation efficiency of the document system.

[0004] To achieve the above object, according to one aspect of the present application, a document system operation method is provided.

[0005] The document system operation method of the embodiments of the present application comprises: in response to a target operation initiated by a user and carrying an identifier of an object to be operated, determining a root directory of the object to be operated according to the identifier of the object to be operated; in the case where it is determined in a preset lock component that there is no first lock corresponding to the target operation acting on the root directory, creating a target lock corresponding to the target operation acting on the root directory in the lock component, and executing the target operation; wherein the object to be operated includes a document or a directory in the document system.

[0006] Optionally, the target operation includes an update type operation; the first lock corresponding to the update type operation is a deleting lock; and the target lock corresponding to the update type operation is an update lock.

[0007] Optionally, the target operation includes a delete-type operation; the first lock corresponding to the delete-type operation is a delete lock and an update lock; and the target lock corresponding to the delete-type operation is a delete lock.

[0008] Optionally, the root directory of the to-be-operated object is determined according to the identifier of the to-be-operated object, including: when the to-be-operated object is a document in the document system, querying document information corresponding to the identifier of the to-be-operated object from a preset database, obtaining an identifier of a parent directory of the to-be-operated object in the document information, determining full path information corresponding to the identifier of the parent directory, and extracting an identifier of a root directory of the to-be-operated object from the full path information; and when the to-be-operated object is a directory in the document system, querying full path information corresponding to the identifier of the to-be-operated object from the database, and extracting an identifier of a root directory of the to-be-operated object from the full path information.

[0009] Optionally, the target lock corresponding to the target operation and acting on the root directory is created in the lock component, including: in the case that the target operation is a delete-type operation, inserting delete lock data including index data into the lock component to form a delete lock acting on the root directory; wherein the index data is generated based on the identifier of the root directory and serves as an identifier of the delete lock.

[0010] Optionally, it is judged that the first lock corresponding to the target operation and acting on the root directory does not exist, including: generating a delete lock identifier based on the identifier of the root directory, and judging that a delete lock acting on the root directory does not exist when delete lock data corresponding to the delete lock identifier does not exist in the lock component.

[0011] Optionally, the delete lock identifier is generated based on the identifier of the root directory, including: combining a preset delete lock prefix with the identifier of the root directory to obtain the delete lock identifier.

[0012] Optionally, the update lock acting on the root directory includes: first update lock data stored in a first storage space of the lock component and second update lock data stored in a second storage space of the lock component; wherein the first update lock data and the second update lock data contain index data; the index data in the first update lock data is generated based on the identifier of the root directory and serves as an identifier of the update lock; and the index data in the second update lock data includes the identifier of the update lock and operation domain data generated based on the identifier of the to-be-operated object.

[0013] Optionally, the first update lock data further comprises an expiration time; and the creating, in the lock component, the target lock corresponding to the target operation for the root directory comprises: in a case where the target operation is an update type operation, generating an update lock identifier based on the identifier of the root directory, querying whether the first storage space has first update lock data corresponding to the update lock identifier; if yes, resetting the expiration time in the queried first update lock data, and inserting second update lock data indexed by the update lock identifier and operation domain data generated based on the identifier of the to-be-operated object into the second storage space; and if not, inserting first update lock data indexed by the update lock identifier into the first storage space, and inserting second update lock data indexed by the update lock identifier and the operation domain data generated based on the identifier of the to-be-operated object into the second storage space.

[0014] Optionally, the judging that there is no first lock corresponding to the target operation for the root directory comprises: in a case where the target operation is a delete type operation, generating an update lock identifier based on the identifier of the root directory, and judging that there is no update lock for the root directory when the first storage space does not have first update lock data corresponding to the update lock identifier or the second storage space does not have second update lock data corresponding to the update lock identifier.

[0015] Optionally, the generating the update lock identifier based on the identifier of the root directory comprises: combining a preset update lock prefix with the identifier of the root directory to obtain the update lock identifier; and the operation domain data is obtained by combining the identifier of the to-be-operated object with the identifier of the user.

[0016] Optionally, the method further comprises: generating an update credential for the to-be-operated object after the update lock for the root directory is created in the lock component; generating a delete credential for the to-be-operated object after the delete lock for the root directory is created in the lock component; and the executing the update type operation comprises: in response to obtaining the update credential, executing the update type operation; and the executing the delete type operation comprises: in response to obtaining the delete credential, executing the delete type operation.

[0017] Optionally, the method further comprises: releasing the update credential and deleting second update lock data of the update lock in the second storage space to release the update lock after the update type operation is executed completely; and releasing the delete credential and deleting delete lock data of the delete lock in the lock component to release the delete lock after the delete type operation is executed completely.

[0018] Optionally, the method further comprises: judging, in the lock component, that there is a delete lock acting on the root directory, and rejecting execution of the update-type operation; judging, in the lock component, that there is a delete lock or an update lock acting on the root directory, and rejecting execution of the delete-type operation; the update-type operation comprises at least one of the following: creating a document, modifying a document, creating a directory, modifying a directory, creating a shortcut of a document, creating a shortcut access of a directory, creating a copy of a document, recovering a deleted document, and recovering a deleted directory; the delete-type operation comprises at least one of the following: deleting a document, deleting a directory, moving a document, and moving a directory; the update lock and the delete lock are distributed locks, and the lock component comprises a database, a cache unit, or a Zookeeper.

[0019] To achieve the above object, according to another aspect of the present application, there is provided an operation device of a document system.

[0020] The operation device of the document system according to the embodiment of the present application can comprise: a root directory determining unit configured to determine a root directory of a to-be-operated object according to an identification of the to-be-operated object in response to a target operation initiated by a user and carrying the identification of the to-be-operated object; and a lock processing unit configured to create a target lock corresponding to the target operation and acting on the root directory in a preset lock component in a case where there is no first lock corresponding to the target operation and acting on the root directory in the lock component, and execute the target operation; wherein the to-be-operated object comprises a document or a directory in the document system.

[0021] To achieve the above object, according to still another aspect of the present application, there is provided an electronic device.

[0022] The electronic device according to the embodiment of the present application comprises: one or more processors; and a storage device configured to store one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the operation method of the document system provided by the present application.

[0023] To achieve the above object, according to still another aspect of the present application, there is provided an electronic device.

[0024] The computer readable storage medium according to the embodiment of the present application has a computer program stored thereon, wherein the program, when executed by a processor, implements the operation method of the document system provided by the present application.

[0025] According to the technical solution of the present application, the embodiments of the above application have the following advantages or beneficial effects:

[0026] The root directory identifier of the document, the directory and other operation objects of the document system is used to generate the identifier of the update lock and the delete lock, so that the root directory lock mechanism acting on the root directory is realized, when the user needs to perform the update type operation, it is only needed to judge whether the delete lock acting on the corresponding root directory exists in the lock component, so as to decide whether to perform the operation, when the user needs to perform the delete type operation, it is only needed to judge whether the delete lock and the update lock acting on the corresponding root directory exist in the lock component, so as to decide whether to perform the operation, thereby avoiding the problem that in the existing distributed lock mechanism, the lock needs to be added everywhere and the whole directory tree needs to be traversed to query the lock, the operation efficiency of the document system is improved under the premise that the update type operation and the delete type operation cannot affect each other, the maintenance is easy, and the error probability is reduced. Further, the two storage spaces (the first storage space and the second storage space) are opened in the lock component to manage the update lock, the first storage space stores the first update lock data including the update lock identifier, so as to indicate the update lock of the root directory as a whole, the second storage space stores the second update lock data including the update lock identifier and the operation domain data, so as to specifically indicate the update lock corresponding to different operation objects, only when the two kinds of update lock data exist at the same time, the update lock acting on the root directory can be identified, when the update lock is released, only the data in the second storage space needs to be deleted, and the data in the first storage space does not need to be changed, thereby ensuring the effective management of the update lock, avoiding the repeated modification of the locking times of multiple update type operations in one storage space, so that the maintenance cost of the update lock is reduced, and the error is avoided.

[0027] The further effects of the above-mentioned non-conventional optional mode will be described in the following combined with the specific embodiments. BRIEF DESCRIPTION OF DRAWINGS

[0028] The accompanying drawings are used to better understand the present application, and do not constitute undue limitations on the present application. Among them:

[0029] Figure 1 Is the main step schematic diagram of the operation method of the document system of the embodiment of the present application;

[0030] Figure 2 Is the overall flow schematic diagram of the operation method of the document system of the embodiment of the present application;

[0031] Figure 3 Is the execution flow schematic diagram of the update type operation in the embodiment of the present application;

[0032] Figure 4 Is the execution flow schematic diagram of the delete type operation in the embodiment of the present application;

[0033] Figure 5 Is the component part schematic diagram of the operation device of the document system of the embodiment of the present application;

[0034] Figure 6is an exemplary system architecture diagram to which embodiments of the present application can be applied;

[0035] Figure 7 is an electronic device structure schematic diagram for implementing an operation method of a document system according to an embodiment of the present application. DETAILED DESCRIPTION

[0036] Exemplary embodiments of the present application are described herein with reference to the accompanying drawings, in which various details are set forth to facilitate an understanding of the present application. It should be appreciated that various embodiments of the present application can be practiced with modification and alteration without departing from the scope and spirit of the present application. Similarly, it should be appreciated that the present application is not limited in its application to the details set forth in the description, as understood by persons of ordinary skill in the art. The present application is directed to all such modifications and alternatives.

[0037] The technical concept of the present application is first described below. The purpose of the present application is to optimize the collaboration mechanism of a document system to improve operation efficiency and reduce error probability, where the document system can support online collaborative editing of documents by multiple users, and has at least one directory tree, each directory tree has a root directory and sub-directories subordinate to the root directory, and one or more documents can be stored under each directory. In the prior art, the update-type operation and the delete-type operation of the document system are easily affected by each other, for example, a document being modified by one user can be deleted by another user, so a lock mechanism is needed to isolate the influence between the update-type operation and the delete-type operation. In practical applications, the update-type operation can include: creating a document, modifying a document, creating a directory, modifying a directory, creating a shortcut of a document, creating a shortcut access of a directory, creating a copy of a document, restoring a deleted document, and restoring a deleted directory. The delete-type operation can include: deleting a document, deleting a directory, moving a document, and moving a directory.

[0038] Further, in order to avoid the defects of low operation efficiency, difficulty in maintenance, and easy occurrence of deadlocks caused by locking at the granularity of a document or a directory in the prior art, the present application considers locking at the root directory level, that is, if there is an update lock acting on the root directory (that is, any directory or document under the root directory is performing an update-type operation), then the delete-type operation of any document and directory under the root directory is refused, but the update-type operation can be performed at the same time; if there is a delete lock acting on the root directory (that is, any directory or document under the root directory is performing a delete-type operation), then the update-type operation and the delete-type operation of any document and directory under the root directory are refused, so that the operation execution efficiency is improved and the availability of the document system is improved on the premise that the update-type operation and the delete-type operation do not affect each other. Preferably, the above update lock and delete lock can be distributed locks.

[0039] In order to realize the above mechanism, the following design can be made based on a database (such as Mysql), a cache unit (which can be a memory cache unit such as Redis), a Zookeeper, and the like lock component (the lock component refers to a system for providing or implementing a lock mechanism). First, an update lock and a delete lock (both of which can be collectively referred to as a root directory lock) that act on any root directory are associated with the root directory to realize a root directory lock mechanism. Optionally, the identifier of the root directory can be used to generate the identifier of the root directory lock when the root directory lock is created, and the root directory lock data (including the delete lock data, the first update lock data, and the second update lock data to be described later) including the identifier of the root directory lock is stored in the lock component. Subsequently, the root directory lock identifier is used to query in the lock component to determine whether the root directory lock that acts on the root directory currently exists. Before creating an update lock, it is first necessary to determine that no delete lock that acts on the same root directory currently exists. Before creating a delete lock, it is first necessary to determine that no delete lock and no update lock that act on the same root directory currently exist. After creating an update lock, an update type operation can be performed, and after the operation is performed, the corresponding data of the update lock is deleted to release the update lock, so as to avoid affecting subsequent operations. After creating a delete lock, a delete type operation can be performed, and after the operation is performed, the corresponding data of the delete lock is deleted to release the delete lock, so as to avoid affecting subsequent operations.

[0040] Further, for the delete lock, since multiple users cannot perform delete type operations in parallel with respect to the same root directory, the lock component can only maintain at most one piece of delete lock data with respect to the same root directory, that is, before performing a delete type operation, the corresponding delete lock data is inserted in the lock component to create a delete lock, and after the operation is performed, the delete lock data is deleted to release the delete lock.

[0041] For the update lock, since multiple users can perform update type operations in parallel with respect to the same root directory, the lock component can maintain multiple pieces of update lock related data with respect to the same root directory. In the prior art, a lock number field is generally maintained in a unified update lock data structure, the lock number is increased by 1 when an update lock is created, and the lock number is decreased by 1 when an update lock is released. The management and maintenance cost of this mechanism is relatively high, and the lock number is prone to errors in high concurrency and some abnormal situations, which can cause faults.

[0042] To solve the above problems, the embodiment of the present application creates two storage spaces (a first storage space and a second storage space) in a lock component to manage update locks, the first storage space stores first update lock data including an update lock identifier to indicate update locks of a root directory as a whole, and the second storage space stores second update lock data including an update lock identifier and operation domain data to specifically indicate update locks corresponding to different objects to be operated, and only when both the two kinds of update lock data exist can the update locks be identified as update locks acting on the root directory. In addition, in the first update lock data, the update lock identifier serves as index data thereof, and in the second update lock data, both the update lock identifier and the operation domain data (generated based on an identifier of an object to be operated) serve as index data thereof. In this way, for multiple update locks acting on the same root directory, the update locks have one common first update lock data of the first storage space, the data does not need to be inserted again if it exists when the update locks are created, and the data does not need to be deleted when the update locks are released (can be automatically deleted based on an expiration time), and the first storage space does not have the locking times field in the prior art. Each update lock also has one independent second update lock data of the second storage space, the second update lock data is inserted when the update lock is created, and the second update lock data is deleted when the update lock is released, thereby realizing independent management of each update lock, avoiding mutual influence and high error rate caused by centralized management, and ensuring high availability of the document system in a high concurrency case.

[0043] The following describes specific technical solutions of the present application. It should be noted that the embodiments of the present application and the technical features in the embodiments can be combined with each other without conflict.

[0044] Figure 1 is a schematic diagram of main steps of an operation method of a document system according to an embodiment of the present application.

[0045] As shown in Figure 1 , the operation method of the document system according to the embodiment of the present application can be executed by a document system server, and the specific steps are as follows:

[0046] Step S101: in response to a target operation initiated by a user and carrying an identifier of an object to be operated, determining a root directory of the object to be operated according to the identifier of the object to be operated. Step S102: in the case where it is determined that no first lock corresponding to the target operation and acting on the root directory exists in a preset lock component, creating a target lock corresponding to the target operation and acting on the root directory in the lock component, and executing the target operation. In particular, the target operation can be an update operation, the first lock corresponding to the update operation is a delete lock, and the target lock corresponding to the update operation is an update lock; the target operation can also be a delete operation, the first lock corresponding to the delete operation is a delete lock and an update lock, and the target lock corresponding to the delete operation is a delete lock. The following describes the update operation and the delete operation respectively.

[0047] The execution steps of the update type operation are as follows: in response to a user-initiated update type operation carrying an identifier of an object to be operated, determining a root directory of the object to be operated according to the identifier of the object to be operated; when it is determined that there is no delete lock acting on the root directory in a preset lock component, creating an update lock acting on the root directory in the lock component, and executing the update type operation. This step is about the steps of the update type operation, and the specific process is shown in the left side of FIG. 1 in Figure 2 .

[0048] In this step, the user can initiate an update type operation to the document system server through a web terminal or a client terminal such as an APP or a computer terminal program, which carries an identifier of an object to be operated. The object to be operated can be any document or any directory in the document system. Generally, the object to be operated of the update type operation is related to the specific type of the update type operation. Specifically, if the update type operation is to create a document, the object to be operated is the parent directory of the document to be created (i.e., the directory where the document to be created is located); if the update type operation is to create a directory, the object to be operated is the parent directory of the directory to be created (i.e., the directory where the directory to be created is located); if the update type operation is to modify a document, modify a directory, create a shortcut of a document, create a shortcut access of a directory, create a copy of a document, restore a deleted document, or restore a deleted directory, the object to be operated is the document or the directory to be operated.

[0049] After receiving the update type operation, the document system server can first determine the root directory of the object to be operated according to the identifier of the object to be operated. Exemplarily, in a database-based architecture, the document system server can determine the root directory of the object to be operated by querying the database. Specifically, if the object to be operated is a document in the document system, the document system server can first query the document information corresponding to the identifier of the object to be operated from the database, then obtain the identifier of the parent directory of the object to be operated in the document information, and then query the full path information corresponding to the identifier of the parent directory in the directory table of the database (the full path refers to the hierarchical relationship from the root directory where the document or the directory is located to its parent directory), and finally extract the identifier of the root directory of the object to be operated from the full path information. If the object to be operated is a directory in the document system, the document system server can first query the full path information corresponding to the identifier of the object to be operated in the directory table of the database, and then extract the identifier of the root directory of the object to be operated from the full path information.

[0050] After obtaining the identifier of the root directory, the document system server determines whether there is a delete lock acting on the same root directory in the preset lock component. Specifically, the document system server first generates a delete lock identifier based on the identifier of the root directory according to a fixed rule, for example, combines a preset delete lock prefix with the identifier of the root directory to obtain the delete lock identifier, and then queries the delete lock identifier in the lock component. If it is determined that there is no delete lock data corresponding to the delete lock identifier, it indicates that there is no delete lock acting on the same root directory at present, and then the update operation can be performed after creating an update lock acting on the root directory in the lock component.

[0051] In particular, in the embodiment of the application, as described above, the update lock acting on the root directory includes first update lock data stored in the first storage space of the lock component and second update lock data stored in the second storage space of the lock component. The first update lock data and the second update lock data contain index data. The index data in the first update lock data is generated based on the identifier of the root directory and serves as the identifier of the update lock. The index data in the second update lock data includes the identifier of the update lock and operation domain data generated based on the identifier of the object to be operated. That is, the first update lock data can be queried according to the identifier of the update lock, the second update lock data can be queried in combination with the identifier of the update lock and the operation domain data, and the second update lock data can also be queried separately using the identifier of the update lock. Further, the first update lock data and the second update lock data can also include an expiration time, which will automatically decrease and be automatically deleted by the system when the expiration time decreases to zero. After the expiration time is reset, it will return to a preset maximum value, for example, 3 minutes.

[0052] Correspondingly, when creating the update lock acting on the root directory, the first update lock data and the second update lock data need to be created at the same time to indicate that the update lock is successfully created. The specific creation steps are as follows: the document system server first generates an update lock identifier based on the identifier of the root directory, for example, combines a preset update lock prefix with the identifier of the root directory according to a fixed rule to obtain the update lock identifier. Then, the document system server queries whether there is first update lock data corresponding to the update lock identifier in the first storage space: if there is, the expiration time in the queried first update lock data is reset, and the second update lock data indexed by the update lock identifier and the operation domain data generated based on the identifier of the object to be operated is inserted into the second storage space. In practical application, the above operation domain data can be obtained by combining the identifier of the object to be operated with the identifier of the user.

[0053] If the document system server judges that the first storage space does not exist the first update lock data corresponding to the update lock identifier, the first update lock data indexed by the update lock identifier is inserted into the first storage space, and the second update lock data indexed by the update lock identifier and the operation domain data generated based on the identifier of the to-be-operated object is inserted into the second storage space. In this way, the update lock acting on the root directory can be created.

[0054] Taking the lock component Redis as an example, the second storage space is a hash table, and the first storage space is a space in Redis different from the second storage space. In the above process, the document system server first generates the update lock identifier by combining the fixed update lock prefix and the identifier of the root directory, and then queries the first storage space by taking the update lock identifier as the key. If the first update lock data is returned, the expiration time of the data is reset, and the second update lock data is inserted into the hash table, that is, the update lock identifier is taken as the key, the operation domain data formed by combining the user identifier and the identifier of the to-be-operated object is taken as the field, and the relevant value is set as the value for storage. If the first update lock data is not returned when the first storage space is queried by taking the update lock identifier as the key, the first update lock data is generated by taking the update lock identifier as the key and setting the relevant value as the value, and is inserted into the first storage space. At this time, the expiration time therein is the maximum value, and the second update lock data is inserted into the hash table in a similar manner.

[0055] As a preferred solution, the document system server can generate an update credential for the to-be-operated object after the above update lock is created, which is used as the basis for the update-type operation, that is, only after the update credential is obtained can the update-type operation be performed. The principle is that, since the above document system server can include multiple nodes (the node can be a physical server or a service program), the node that creates the update lock and the node that performs the update-type operation can not be the same node. Before performing the update-type operation, the node that performs the update-type operation needs to obtain the message that the update lock creation is successful, which requires the node that creates the update lock to send this message to the node that performs the update-type operation in some way. The above update credential is used to achieve this purpose. It can be understood that this problem can also be solved without using the update credential but only using the above update lock mechanism. Preferably, the update credential can contain the identifier of the to-be-operated object for association with the to-be-operated object, the identifier of the user and the identifier of the root directory for subsequent release of the update lock, and a state parameter (such as true or false) and an expiration time.

[0056] After the execution of the update-type operation is completed, the document system server can release the update credential and delete the second update lock data of the update lock in the second storage space to release the update lock, so as to avoid affecting subsequent operations. In this process, the corresponding second update lock data can be located through the identification of the root directory, the user identification and the identification of the object to be operated in the update credential. It is worth noting that the first update lock data of the update lock does not need to be deleted when the update lock is released, and the first update lock data can be automatically deleted by the decrease of the expiration time.

[0057] In the execution step of the update-type operation, if the document system server determines that there is delete lock data corresponding to the delete lock identification in the lock component, it means that there is a delete lock acting on the same root directory at present, so the update credential cannot be obtained, and the update-type operation is refused to be executed. Thereafter, the document system server can periodically perform the judgment in the execution step of the update-type operation and perform the corresponding step.

[0058] The execution step of the delete-type operation is as follows: in response to a delete-type operation initiated by a user and carrying the identification of the object to be operated, the root directory of the object to be operated is determined according to the identification of the object to be operated, and when it is determined that there is no delete lock and update lock acting on the root directory in the preset lock component, a delete lock acting on the root directory is created in the lock component, and the delete-type operation is executed. This step is about the step of the delete-type operation, and the specific process is shown on the right side of FIG. 2 in the description of the delete-type operation. Figure 2

[0059] The above delete-type operation can include deleting a document, deleting a directory, moving a document and moving a directory, and the object to be operated is a document or a directory to which the operation is directed. In this step, after the document system server receives the delete-type operation, the identification of the root directory of the object to be operated is first determined by the identification of the object to be operated using a method similar to that in the execution step of the update-type operation. Thereafter, it is determined whether there is a delete lock and an update lock acting on the root directory in the lock component. If there is any of the above delete lock and update lock, the delete lock will not be created and the delete-type operation will be refused to be executed. Only when there is neither the above delete lock nor the above update lock, a delete lock acting on the root directory will be created and the delete-type operation will be executed. It is worth noting that the judgment of whether there is a delete lock and the judgment of whether there is an update lock can be executed in any order.

[0060] ​In the embodiments of the present application, the judgment logic for whether there is a delete lock is as follows: the document system server generates a delete lock identifier based on the identifier of the root directory (for example, combines a delete lock prefix with the identifier of the root directory to obtain the delete lock identifier), and queries the lock component using the delete lock identifier: if the corresponding delete lock data is queried, it means that there is a delete lock acting on the same root directory; if the corresponding delete lock data is not queried, it means that there is no delete lock acting on the same root directory.

[0061] In actual application, the judgment logic for whether there is an update lock is as follows: the document system server generates an update lock identifier based on the identifier of the root directory (for example, combines an update lock prefix with the identifier of the root directory to obtain the update lock identifier), and judges that there is no update lock acting on the same root directory when the first update lock data corresponding to the update lock identifier does not exist in the first storage space or the second update lock data corresponding to the update lock identifier does not exist in the second storage space; judges that there is an update lock acting on the same root directory when the first update lock data corresponding to the update lock identifier exists in the first storage space and the second update lock data corresponding to the update lock identifier exists in the second storage space.

[0062] When the document system server judges that there is neither a delete lock acting on the same root directory nor an update lock acting on the same root directory, the delete lock acting on the root directory can be created in the following way: the document system server inserts delete lock data including index data in the lock component to form a delete lock acting on the root directory. The above index data is generated based on the identifier of the root directory (for example, combines a delete lock prefix with the identifier of the root directory to obtain the index data) as the identifier of the delete lock.

[0063] Taking Redis as an example, the lock component can store delete lock data in a storage space other than the aforementioned second storage space. In the above process, the document system server first combines a fixed delete lock prefix with the identifier of the root directory to generate a delete lock identifier, and then forms delete lock data with the delete lock identifier as the key and the relevant value as the value and stores it in Redis.

[0064] As a preferred solution, the document system server can generate a deletion credential for the to-be-operated object after the above deletion lock is created, and the deletion credential is used as the basis for the deletion class operation, i.e. only after the deletion credential is obtained can the deletion class operation be executed, and the principle is similar to the above-mentioned update credential. Since the above document system server can include multiple nodes (the node can be a physical server or a service program), the node that creates the deletion lock can not be the same node that executes the deletion class operation, and the node that executes the deletion class operation needs to obtain the message that the creation of the deletion lock is successful before executing the deletion class operation, which requires the node that creates the deletion lock to send this message to the node that executes the deletion class operation in some way, and the above deletion credential is used to achieve this purpose. It can be understood that this problem can also be solved without using the deletion credential and only using the above deletion lock mechanism. Preferably, the deletion credential can include the identification of the to-be-operated object to associate with the to-be-operated object, and can also include the user identification, the identification of the root directory, the state parameter (such as true or false) and the expiration time.

[0065] After the execution of the deletion class operation is completed, the document system server can release the deletion credential and delete the deletion lock data of the deletion lock in the lock component to release the deletion lock, so as to avoid affecting subsequent operations. In this process, the root directory identification in the deletion credential can be used to locate the corresponding deletion lock data.

[0066] In the execution step of the deletion class operation, if the document system server determines that there is any one of the deletion lock and the update lock acting on the root directory, the deletion credential will not be obtained, and the execution of the deletion class operation is refused. Thereafter, the document system server can periodically perform the judgment in step S102 and perform the corresponding steps.

[0067] The following describes a specific embodiment of the present application, referring to Figure 3 and Figure 4 . Figure 3 is the execution flow diagram of the update class operation in the embodiment of the present application, Figure 4 is the execution flow diagram of the deletion class operation in the embodiment of the present application. In this embodiment, the document system server includes nodes such as a gateway (such as a Facade gateway), a document service, a resource service, etc., wherein the document service can execute the update class operation, and the resource service can execute the deletion class operation and interact with the lock component and the database to implement the root directory lock mechanism and the credential mechanism.

[0068] As Figure 3As shown, the user initiates an update type operation at the web end or the client, the gateway first verifies the interface input parameters, and then calls the RPC (Remote Procedure Call) interface of the document service after passing the verification, the document service calls the get update credential interface provided by the resource service, the resource service queries the full path information of the parent directory from the database according to the to-be-operated object identifier, and then obtains the root directory identifier. Thereafter, the resource service generates a delete lock identifier according to the root directory identifier, and queries the lock component (such as Redis) with the delete lock identifier as the key. If the delete lock exists, the resource service returns a message that the get update credential fails to the document service, and the document service returns a message that the operation cannot be executed temporarily to the gateway. If the delete lock does not exist, the resource service generates an update lock identifier according to the root directory identifier, and queries the first storage space of the lock component with the update lock identifier as the key. If the first update lock data is queried, the expiration time is reset, the update lock identifier is taken as the key, the user identifier is combined with the to-be-operated object identifier to generate operation domain data as the field, and a related value (such as 1) is taken as the value to generate second update lock data and store in the hash table of the lock component. If the first update lock data is not queried, the first update lock data is inserted in the first storage space in a similar manner, and the second update lock data is inserted in the hash table. Thereafter, the resource service generates an update credential and returns it to the document service, and the document service executes the update type operation after receiving the update credential. After the execution is completed, the document service releases the update credential, the resource service deletes the second update lock data in the hash table to release the update lock, and thereafter, the resource service, the document service and the gateway return the execution results in sequence, and finally, the gateway returns the execution result of the update type operation to the user.

[0069] As Figure 4As shown, after the user initiates the delete type operation, the gateway first performs the legality verification of the input parameter, and after passing, calls the RPC interface provided by the resource service. The resource service first performs the idempotent verification of the request and the verification of the user deletion permission, and after passing, interacts with the database to obtain the full path information of the object to be operated and then obtains the root directory identifier. Thereafter, the resource service generates a delete lock identifier according to the root directory identifier, and queries the lock component with the delete lock identifier as the key. If the delete lock is queried, the delete type operation is refused. If the delete lock is not queried, an update lock identifier is generated according to the root directory identifier, and the first storage space and the second storage space are queried with the update lock identifier as the key. If the first update lock data and the second update lock data exist at the same time, it means that there is an update lock, and the delete type operation is refused. If the first update lock data and the second update lock data do not exist at the same time, it means that there is no update lock, and the delete lock data is inserted in the lock component with the delete lock identifier as the key to create the delete lock. Thereafter, the resource service generates a delete credential and executes the delete type operation, releases the delete credential after execution, deletes the delete lock data in the lock component to release the delete lock, and finally returns the execution result of the delete type operation to the user through the gateway.

[0070] It can be seen that in the embodiment of the application, the implementation details of the update lock and the delete lock are encapsulated, and the above implementation details are not sensed by the user, thereby improving the user experience.

[0071] In the technical scheme of the embodiment of the present application, the root directory identifier of the operation object such as the document and the directory based on the document system is used to generate the identifier of the update lock and the delete lock, so that the root directory lock mechanism acting on the root directory is realized, when the user needs to perform the update type operation, it is only needed to judge whether the delete lock acting on the corresponding root directory exists in the lock component, so as to decide whether to perform the operation, when the user needs to perform the delete type operation, it is only needed to judge whether the delete lock and the update lock acting on the corresponding root directory exist in the lock component, so as to decide whether to perform the operation, thereby avoiding the problem of needing to lock everywhere and traversing the whole directory tree to query the lock in the existing distributed lock mechanism, improving the operation efficiency of the document system under the premise of ensuring that the update type operation and the delete type operation do not affect each other, being easy to maintain, and reducing the error probability. Further, the embodiment of the present application opens two storage spaces (the first storage space and the second storage space) in the lock component to manage the update lock, the first storage space stores the first update lock data including the update lock identifier, so as to indicate the update lock of the root directory as a whole, the second storage space stores the second update lock data including the update lock identifier and the operation domain data, so as to specifically indicate the update lock corresponding to different operation objects, only when the two kinds of update lock data exist simultaneously, the update lock acting on the root directory can be identified, when the update lock is released, it is only needed to delete the data in the second storage space without changing the data in the first storage space, thereby ensuring the effective management of the update lock while avoiding the repeated modification of the locking times of multiple update type operations in one storage space, so as to reduce the maintenance cost of the update lock and avoid errors.

[0072] It should be noted that, for each method embodiment described above, in order to facilitate the description, it is expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the order of the described actions, and some steps can actually be performed in other orders or simultaneously. In addition, those skilled in the art should know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to implement the present application.

[0073] In order to better implement the above scheme of the embodiment of the present application, the related device for implementing the above scheme is also provided.

[0074] Please refer to Figure 5 As shown in the figure, the operation device 500 of the document system provided by the embodiment of the present application can include a root directory determination unit 501 and a lock processing unit 502.

[0075] The root directory determining unit 501 can be configured to determine a root directory of the object to be operated according to an identification of the object to be operated in response to a target operation initiated by a user and carrying the identification of the object to be operated. The lock processing unit 502 can be configured to create a target lock corresponding to the target operation in the lock component and acting on the root directory, and execute the target operation, in a case where it is determined that the lock component does not have a first lock corresponding to the target operation and acting on the root directory. The object to be operated includes a document or a directory in the document system.

[0076] In a specific application, the target operation includes an update operation, the first lock corresponding to the update operation is a delete lock, and the target lock corresponding to the update operation is an update lock.

[0077] In an actual application, the target operation includes a delete operation, the first lock corresponding to the delete operation is a delete lock and an update lock, and the target lock corresponding to the delete operation is a delete lock.

[0078] In the embodiment, the root directory determining unit 501 can be further configured to, when the object to be operated is a document in the document system, query document information corresponding to the identification of the object to be operated from a preset database, acquire an identification of a parent directory of the object to be operated in the document information, determine full path information corresponding to the identification of the parent directory, and extract an identification of a root directory of the object to be operated from the full path information. When the object to be operated is a directory in the document system, the root directory determining unit 501 can be further configured to query full path information corresponding to the identification of the object to be operated from the database, and extract an identification of a root directory of the object to be operated from the full path information.

[0079] In an optional implementation, the lock processing unit 502 can be further configured to, when the target operation is a delete operation, insert delete lock data including index data into the lock component to form a delete lock acting on the root directory, wherein the index data is generated based on the identification of the root directory and serves as an identification of the delete lock.

[0080] As a preferred solution, the lock processing unit 502 can be further configured to generate a delete lock identification based on the identification of the root directory, and determine that there is no delete lock acting on the root directory when there is no delete lock data corresponding to the delete lock identification in the lock component.

[0081] Preferably, the lock processing unit 502 can be further configured to combine a preset delete lock prefix with the identification of the root directory to obtain the delete lock identification.

[0082] In a specific scenario, the update lock acting on the root directory includes: first update lock data stored in the first storage space of the lock component and second update lock data stored in the second storage space of the lock component; wherein the index data is contained in the first update lock data and the second update lock data; the index data in the first update lock data is generated based on the identifier of the root directory as the identifier of the update lock; and the index data in the second update lock data includes the identifier of the update lock and operation domain data generated based on the identifier of the to-be-operated object.

[0083] In an actual scenario, the first update lock data further includes an expiration time; and the lock processing unit 502 can be further configured to: in a case where the target operation is an update-type operation, generate an update lock identifier based on the identifier of the root directory, query whether the first update lock data corresponding to the update lock identifier exists in the first storage space, reset the expiration time in the queried first update lock data, and insert, in the second storage space, second update lock data with the update lock identifier and operation domain data generated based on the identifier of the to-be-operated object as index data; if not, insert, in the first storage space, first update lock data with the update lock identifier as index data, and insert, in the second storage space, second update lock data with the update lock identifier and operation domain data generated based on the identifier of the to-be-operated object as index data.

[0084] In an optional technical solution, the lock processing unit 502 can be further configured to: in a case where the target operation is a deletion-type operation, generate an update lock identifier based on the identifier of the root directory, and determine that there is no update lock acting on the root directory when the first update lock data corresponding to the update lock identifier does not exist in the first storage space or the second update lock data corresponding to the update lock identifier does not exist in the second storage space.

[0085] In some embodiments, the lock processing unit 502 can be further configured to: combine a preset update lock prefix with the identifier of the root directory to obtain the update lock identifier; and obtain the operation domain data by combining the identifier of the to-be-operated object with the identifier of the user.

[0086] Preferably, the lock processing unit 502 can be further configured to: after creating the update lock acting on the root directory in the lock component, generate an update credential for the to-be-operated object; after creating the deletion lock acting on the root directory in the lock component, generate a deletion credential for the to-be-operated object; and in response to obtaining the update credential, perform the update-type operation; and in response to obtaining the deletion credential, perform the deletion-type operation.

[0087] In one embodiment, the lock processing unit 502 can be further configured to release the update credential and delete the second update lock data of the update lock in the second storage space to release the update lock after the update type operation is completed; and release the delete credential and delete the delete lock data of the delete lock in the lock component to release the delete lock after the delete type operation is completed.

[0088] In addition, in the embodiment of the present application, the lock processing unit 502 can be further configured to refuse to execute the update type operation if it is determined that there is a delete lock acting on the root directory in the lock component; refuse to execute the delete type operation if it is determined that there is a delete lock or an update lock acting on the root directory in the lock component; the update type operation comprises at least one of creating a document, modifying a document, creating a directory, modifying a directory, creating a shortcut of a document, creating a shortcut access of a directory, creating a copy of a document, recovering a deleted document, and recovering a deleted directory; the delete type operation comprises at least one of deleting a document, deleting a directory, moving a document, and moving a directory; the update lock and the delete lock are distributed locks, and the lock component comprises a database, a cache unit, or a Zookeeper.

[0089] According to the technical scheme of the embodiment of the present application, the update lock and the delete lock are generated based on the root directory identifier of the operation object such as a document and a directory of a document system, so that the root directory lock mechanism acting on the root directory is realized. When a user needs to execute an update type operation, it is only necessary to determine whether there is a delete lock acting on the corresponding root directory in the lock component to decide whether to execute the operation. When a user needs to execute a delete type operation, it is only necessary to determine whether there is a delete lock or an update lock acting on the corresponding root directory in the lock component to decide whether to execute the operation. Thus, the problem of needing to lock everywhere and traversing the whole directory tree to query a lock in the existing distributed lock mechanism is avoided, the operation efficiency of the document system is improved on the premise that the update type operation and the delete type operation do not affect each other, the maintenance is easy, and the error probability is reduced. Further, two storage spaces (the first storage space and the second storage space) are opened in the lock component to manage the update lock. The first storage space stores the first update lock data comprising the update lock identifier to indicate the update lock of the root directory as a whole. The second storage space stores the second update lock data comprising the update lock identifier and the operation domain data to specifically indicate the update lock corresponding to different operation objects. Only when both kinds of update lock data exist can it be determined that there is an update lock acting on the root directory. When the update lock is released, it is only necessary to delete the data in the second storage space without modifying the data in the first storage space. Thus, the update lock is effectively managed while avoiding multiple update type operations repeatedly modifying the locking times in one storage space, so that the maintenance cost of the update lock is reduced and errors are avoided.

[0090] Figure 6 An exemplary system architecture 600 is shown, which can be applied to the operation method or operation device of the document system according to embodiments of the present invention.

[0091] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, and 603, network 604, and server 605 (this architecture is merely an example; the components included in a specific architecture may be adjusted according to the specific application). Network 604 serves as the medium for providing a communication link between terminal devices 601, 602, and 603 and server 605. Network 604 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0092] Users can use terminal devices 601, 602, and 603 to interact with server 605 via network 604 to receive or send messages, etc. Various client applications can be installed on terminal devices 601, 602, and 603, such as online collaborative document applications (for example only).

[0093] Terminal devices 601, 602, and 603 can be various electronic devices with displays and web browsing capabilities, including but not limited to smartphones, tablets, laptops, and desktop computers.

[0094] Server 605 can be a server that provides various services, such as a document system server (for example only) that supports online collaborative document applications operated by users using terminal devices 601, 602, and 603. The document system server can process received operation requests and feed back the processing results (e.g., operation results - for example only) to terminal devices 601, 602, and 603.

[0095] It should be noted that the operation method of the document system provided in the embodiments of the present invention is generally executed by the server 605, and correspondingly, the operation device of the document system is generally set in the server 605.

[0096] It should be understood that Figure 6 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0097] The present invention also provides an electronic device. The electronic device of an embodiment of the present invention includes: one or more processors; and a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the operation method of the document system provided by the present invention.

[0098] The following is for reference. Figure 7It shows a schematic diagram of the structure of a computer system 700 suitable for implementing an electronic device according to embodiments of the present invention. Figure 7 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of use of the embodiments of the present invention.

[0099] like Figure 7 As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes based on programs stored in read-only memory (ROM) 702 or programs loaded from storage section 708 into random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the computer system 700. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0100] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0101] In particular, according to the embodiments disclosed in this invention, the processes described in the above main step diagrams can be implemented as computer software programs. For example, embodiments of this invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the main step diagrams. In the above embodiments, the computer program can be downloaded and installed from a network via communication section 709, and / or installed from removable medium 711. When the computer program is executed by central processing unit 701, it performs the functions defined in the system of this invention.

[0102] It should be noted that the computer-readable medium shown in the present application can be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or component, or any combination of the above. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the 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, device or component. In the present application, the computer-readable signal medium can include a data signal carried in a baseband or as a part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to an electromagnetic signal, an optical signal or any suitable combination of the above. The computer-readable signal medium can also be any computer-readable medium other than the computer-readable storage medium, which can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, device or component. The program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0103] The flowcharts and block diagrams in the drawings illustrate the possible implementation architectures, functions and operations of the systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a portion of code that contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders than that shown in the figures. For example, two blocks that are shown in succession can actually be executed substantially concurrently, or they can sometimes be executed in reverse order, depending on the involved functions. It should also be noted that each block in the block diagrams or flowcharts, and combinations of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0104] The units described in the embodiments of the present application can be implemented in the form of software, or can be implemented in the form of hardware. The units described can also be arranged in a processor, for example, a processor can be described as including a first operation unit and a second operation unit. In some cases, the names of these units do not constitute a limitation on the units themselves.

[0105] As another aspect, the present application also provides a computer readable medium, which can be included in the device described in the above embodiments, or can exist separately without being assembled into the device. The computer readable medium carries one or more programs, which, when executed by the device, cause the device to perform the steps including: in response to a target operation initiated by a user and carrying an identifier of an object to be operated, determining a root directory of the object to be operated according to the identifier of the object to be operated; in the case where no first lock corresponding to the target operation and acting on the root directory exists in a preset lock component, creating a target lock corresponding to the target operation and acting on the root directory in the lock component, and executing the target operation; wherein the object to be operated includes a document or a directory in the document system.

[0106] In the technical solution of the embodiments of the present application, the identifiers of the update lock and the delete lock are generated based on the root directory identifier of the document, the directory and other objects to be operated in the document system, so that the root directory lock mechanism acting on the root directory is realized. When the user needs to perform an update type operation, it is only necessary to determine whether the delete lock acting on the corresponding root directory exists in the lock component to decide whether to perform the operation. When the user needs to perform a delete type operation, it is only necessary to determine whether the delete lock and the update lock acting on the corresponding root directory exist in the lock component to decide whether to perform the operation. In this way, the problem of needing to lock everywhere and traversing the entire directory tree to query the lock in the existing distributed lock mechanism is avoided, the operation efficiency of the document system is improved on the premise of ensuring that the update type operation and the delete type operation do not affect each other, maintenance is easy, and the error probability is reduced. Further, the present embodiment opens two storage spaces (the first storage space and the second storage space) in the lock component to manage the update lock. The first storage space stores first update lock data including the update lock identifier to indicate the update lock of the root directory as a whole. The second storage space stores second update lock data including the update lock identifier and operation domain data to specifically indicate the update lock corresponding to different objects to be operated. Only when both kinds of update lock data exist can the update lock acting on the root directory be identified. When the update lock is released, only the data in the second storage space needs to be deleted without changing the data in the first storage space. In this way, while ensuring effective management of the update lock, repeated modification of the locking times of multiple update type operations in one storage space is avoided, thereby reducing the maintenance cost of the update lock and avoiding errors.

[0107] The foregoing detailed description has set forth various embodiments of the devices and / or processes via the use of specific terminology. However, embodiments thereof can be practiced with the exact description not being presented in detail. The term "device" should be understood to encompass devices operating in various modes, such as active mode, sleep mode, hibernate mode, and the like. The terms "coupled" and "connected," along with their derivatives, can be used. It should be understood that these terms are not intended as synonyms for each other. Rather, particular circuitry that can be said to be coupled or connected can be coupled and connected via some transmission medium.

Claims

1. A method for operating a document system, characterized in that, include: In response to a user-initiated target operation carrying an identifier of the object to be operated on, the root directory of the object to be operated on is determined based on the identifier of the object to be operated on; If it is determined in the preset lock component that there is no first lock corresponding to the target operation that applies to the root directory, a target lock corresponding to the target operation that applies to the root directory is created in the lock component, and the target operation is executed; The object to be operated on includes documents or directories in the document system; the target operation includes update operations; the first lock corresponding to the update operation is a delete lock; the target lock corresponding to the update operation is an update lock; the update lock acting on the root directory includes: first update lock data stored in the first storage space of the lock component and second update lock data stored in the second storage space of the lock component; wherein the first update lock data and the second update lock data contain index data; the index data in the first update lock data is generated based on the identifier of the root directory and serves as the identifier of the update lock; the index data in the second update lock data includes the identifier of the update lock and operation field data generated based on the identifier of the object to be operated on.

2. The method according to claim 1, characterized in that, The target operation includes deletion operations; The first locks corresponding to the deletion operations are the deletion lock and the update lock; The target lock corresponding to the deletion operation is the deletion lock.

3. The method according to claim 1, characterized in that, Determining the root directory of the object to be operated on based on its identifier includes: When the object to be operated on is a document in the document system, the document information corresponding to the identifier of the object to be operated on is retrieved from the preset database, the identifier of the parent directory of the object to be operated on is obtained from the document information, the full path information corresponding to the identifier of the parent directory is determined, and the identifier of the root directory of the object to be operated on is extracted from the full path information. When the object to be operated on is a directory in the document system, the full path information corresponding to the identifier of the object to be operated on is retrieved from the database, and the identifier of the root directory of the object to be operated on is extracted from the full path information.

4. The method according to claim 2, characterized in that, Creating a target lock in the lock component that operates on the root directory and corresponds to the target operation includes: When the target operation is a deletion operation, deletion lock data including index data is inserted into the lock component to form a deletion lock acting on the root directory; wherein, the index data is generated based on the identifier of the root directory and serves as the identifier of the deletion lock.

5. The method according to claim 4, characterized in that, The determination that there is no first lock corresponding to the target operation acting on the root directory includes: A delete lock identifier is generated based on the identifier of the root directory. If the delete lock data corresponding to the delete lock identifier does not exist in the lock component, it is determined that there is no delete lock applied to the root directory.

6. The method according to claim 5, characterized in that, The generation of the deletion lock identifier based on the identifier of the root directory includes: The delete lock identifier is obtained by combining the preset delete lock prefix with the identifier of the root directory.

7. The method according to claim 1, characterized in that, The first update of the lock data further includes an expiration time; and the step of creating a target lock in the lock component that operates on the root directory and corresponds to the target operation includes: When the target operation is an update operation, an update lock identifier is generated based on the identifier of the root directory, and the first storage space is queried to see if the first update lock data corresponding to the update lock identifier exists: If it exists, reset the expiration time in the first update lock data retrieved, and insert the second update lock data in the second storage space with the update lock identifier and the operation domain data generated based on the identifier of the object to be operated on as index data. If it does not exist, insert first update lock data with the update lock identifier as index data in the first storage space, and insert second update lock data with the update lock identifier and operation domain data generated based on the identifier of the object to be operated on as index data in the second storage space.

8. The method according to claim 7, characterized in that, Determining that there is no first lock corresponding to the target operation acting on the root directory includes: When the target operation is a deletion operation, an update lock identifier is generated based on the identifier of the root directory. If the first update lock data corresponding to the update lock identifier does not exist in the first storage space, or the second update lock data corresponding to the update lock identifier does not exist in the second storage space, it is determined that there is no update lock acting on the root directory.

9. The method according to claim 8, characterized in that, The step of generating an update lock identifier based on the identifier of the root directory includes: combining a preset update lock prefix with the identifier of the root directory to obtain the update lock identifier; The operation domain data is obtained by combining the identifier of the object to be operated on with the identifier of the user.

10. The method according to claim 2, characterized in that, The method further includes: After creating an update lock that applies to the root directory in the lock component, an update credential for the object to be operated on is generated. After creating a delete lock on the root directory in the lock component, a delete credential for the object to be operated on is generated; and, Performing the update operation includes: in response to obtaining the update credential, performing the update operation; Performing the deletion operation includes: performing the deletion operation in response to obtaining the deletion credential.

11. The method according to claim 10, characterized in that, The method further includes: After the update operation is completed, the update credential is released, and the second update lock data of the update lock in the second storage space is deleted to release the update lock; After the deletion operation is completed, the deletion credential is released, and the deletion lock data of the deletion lock in the lock component is deleted to release the deletion lock.

12. The method according to any one of claims 4-11, characterized in that, The method further includes: if the lock component determines that a delete lock exists on the root directory, refusing to execute the update operation; if the lock component determines that a delete lock or an update lock exists on the root directory, refusing to execute the delete operation. The update operations include at least one of the following: creating a document, modifying a document, creating a table of contents, modifying a table of contents, creating a shortcut to a document, creating a shortcut to a table of contents, creating a copy of a document, recovering a deleted document, and recovering a deleted table of contents; The deletion operations include at least one of the following: deleting a document, deleting a directory, moving a document, and moving a directory; The update lock and the delete lock are distributed locks, and the lock components include: a database, a cache unit, or Zookeeper.

13. An operating device for a document system, characterized in that, include: The root directory determination unit is used to: in response to a target operation initiated by a user and carrying an identifier of the object to be operated on, determine the root directory of the object to be operated on based on the identifier of the object to be operated on; A lock processing unit is configured to: if, in a preset lock component, it is determined that there is no first lock acting on the root directory corresponding to the target operation, create a target lock acting on the root directory corresponding to the target operation in the lock component, and execute the target operation; wherein, the object to be operated on includes a document or directory in the document system; the target operation includes an update operation; the first lock corresponding to the update operation is a delete lock; the target lock corresponding to the update operation is an update lock; the update lock acting on the root directory includes: first update lock data stored in a first storage space of the lock component and second update lock data stored in a second storage space of the lock component; wherein, the first update lock data and the second update lock data contain index data; the index data in the first update lock data is generated based on the identifier of the root directory and serves as the identifier of the update lock; the index data in the second update lock data includes the identifier of the update lock and operation field data generated based on the identifier of the object to be operated on.

14. An electronic device, characterized in that, include: One or more processors; Storage device for storing 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 method as described in any one of claims 1-12.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the method as described in any one of claims 1-12.

Citation Information

Patent Citations

  • Client metadata buffer optimization method of distributed file system

    CN104113587A

  • Method and system for allowing multiple users to edit a hierarchical data structure

    US6529905B1