A file synchronization method and device, electronic equipment and storage medium

By working together between the client and the cloud storage server, a file synchronization strategy is determined and executed, which solves the problem of inconsistent file synchronization between clients and achieves efficient and accurate file synchronization.

CN114328428BActive Publication Date: 2026-06-19BEIJING BAIDU NETCOM SCI & TECH CO LTD

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
BEIJING BAIDU NETCOM SCI & TECH CO LTD
Filing Date
2021-12-30
Publication Date
2026-06-19

Smart Images

  • Figure CN114328428B_ABST
    Figure CN114328428B_ABST
Patent Text Reader

Abstract

This disclosure provides a file synchronization method, apparatus, electronic device, and storage medium, relating to the field of computer technology, particularly cloud computing and data synchronization. The specific implementation involves: a client sending a file synchronization request to a cloud storage server; the client receiving a cloud storage information file from the cloud storage server; the client determining a file synchronization strategy based on the cloud storage information file, its local modification information file, and its local historical synchronization information file; and the client executing a file synchronization operation corresponding to the specified strategy. This disclosure improves the accuracy of file synchronization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to the fields of cloud computing and data synchronization. Background Technology

[0002] Multi-device bidirectional synchronization technology refers to the ability of multiple clients to promptly synchronize files with other clients after a user updates them, ensuring that the files on each client are up-to-date. Current client-to-client interactions are either unidirectional synchronization or bidirectional synchronization with inconsistent file synchronization, reducing the accuracy of file synchronization. Summary of the Invention

[0003] This disclosure provides a file synchronization method, apparatus, electronic device, and storage medium.

[0004] According to one aspect of this disclosure, a file synchronization method is provided, comprising:

[0005] The client sends a file synchronization request to the cloud storage server;

[0006] The client receives cloud storage information files from the cloud storage server;

[0007] The client determines the file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file;

[0008] The client executes the file synchronization operation corresponding to the file synchronization strategy.

[0009] According to another aspect of this disclosure, a file synchronization device is provided, comprising:

[0010] The request sending unit is used to send file synchronization requests to the cloud storage server;

[0011] The receiving unit is used to receive cloud storage information files fed back by the cloud storage server;

[0012] The strategy determination unit is used to determine a file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file.

[0013] The synchronization processing unit is used to execute file synchronization operations corresponding to the file synchronization strategy.

[0014] According to another aspect of this disclosure, an electronic device is provided, comprising:

[0015] At least one processor; and

[0016] A memory communicatively connected to the at least one processor; wherein,

[0017] The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the methods provided in the embodiments of this disclosure.

[0018] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions thereon, the computer instructions being used to cause a computer to perform the methods provided in embodiments of this disclosure.

[0019] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements the methods provided in embodiments of this disclosure.

[0020] By adopting this disclosure, the client can send a file synchronization request to the cloud storage server, receive the cloud storage information file fed back by the cloud storage server, and determine the file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. Thus, the client can perform the file synchronization operation corresponding to the file synchronization strategy, thereby improving the accuracy of file synchronization.

[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description

[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:

[0023] Figure 1 This is a flowchart illustrating a file synchronization method according to an embodiment of the present disclosure;

[0024] Figure 2 This is a schematic diagram of data interaction according to an embodiment of the file synchronization method of this disclosure;

[0025] Figure 3 This is a schematic diagram of a star-shaped structure and a centralized structure according to embodiments of the present disclosure;

[0026] Figure 4 This is a schematic diagram of a synchronization conflict resolution strategy according to an embodiment of the present disclosure;

[0027] Figure 5 This is a schematic diagram of the 0 / 1 switching mechanism according to an embodiment of the present disclosure;

[0028] Figure 6 This is a schematic diagram of a distributed lock mechanism according to an embodiment of the present disclosure;

[0029] Figure 7 This is a structural block diagram of a file synchronization device according to an embodiment of the present disclosure;

[0030] Figure 8 This is a schematic diagram illustrating communication between a client and a cloud storage server in a file synchronization system according to an embodiment of this disclosure;

[0031] Figure 9 This is a block diagram of an electronic device used to implement the file synchronization method of the embodiments of this disclosure. Detailed Implementation

[0032] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0033] Multi-device file synchronization technology can currently be solved using the following three methods:

[0034] (1) File synchronization is achieved using Rclone sync mode (i.e., synchronizing files from the original folder to the target folder, only modifying the destination): locally modified and newly added files are synchronized to the remote storage, and files that have been deleted locally are deleted on the remote storage, achieving consistency between local and remote storage files. However, since Rclone sync is only a one-way synchronization, changes to files on the remote storage are not synchronized to the local storage. In addition, rclonesync-V2, which is an improvement on Rclone, adds bidirectional synchronization functionality, but it does not solve the problem of file consistency during multi-device concurrent synchronization, nor does it guarantee file integrity during the synchronization process.

[0035] (2) Incremental file synchronization is achieved using the VTFS versioning mechanism: Before and during synchronization, each client first pulls the latest remote modifications, then merges them with the local version to generate an incremental version, and then synchronizes. However, in high-frequency synchronization, the VTFS versioning mechanism generates too many versions, lacks a merging mechanism, and the metadata increases exponentially, resulting in excessive storage resource consumption. Furthermore, the implementation based on the file system in user space (fuse) mechanism leads to a significant decrease in read and write performance compared to disk, and poor mount point stability.

[0036] (3) File synchronization is achieved based on the JuiceFS shared file system (i.e., a shared file system designed for cloud-native environments, supporting the management, analysis, archiving, and backup of all types of data): A centralized service is used to store file metadata, which is shared among all clients. Clients directly access remote file metadata, ensuring real-time file consistency. Through the centralized metadata service, user-edited files will be synchronized in real time, but local files will be unusable in offline clients, limiting their scope of use and increasing operational costs.

[0037] According to embodiments of this disclosure, a file synchronization method is provided. Figure 1 This is a flowchart illustrating a file synchronization method according to an embodiment of the present disclosure, such as... Figure 1 As shown, the method includes:

[0038] S101, The client sends a file synchronization request to the cloud storage server.

[0039] S102. The client receives the cloud storage information file from the cloud storage server.

[0040] S103. The client determines the file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file.

[0041] S104. The client executes the file synchronization operation corresponding to the file synchronization policy.

[0042] In one example of S101-S104, the client can periodically send the synchronization request to the cloud storage server for bidirectional file synchronization (e.g., the synchronization interval can be 1 minute, 10 minutes, 1 hour, etc.). After the cloud storage server responds to the file synchronization request, the client can receive the cloud storage information file from the cloud storage server. The client can compare the cloud storage information file (i.e., the latest changes in the cloud storage) with the client's local files (i.e., the client's local modification information file and the client's local historical synchronization information file) to find conflicting files and the type of conflict, and based on this, obtain the file synchronization policy. Then, according to the file synchronization policy, the client executes the corresponding file synchronization operation (such as download, upload, delete, or do nothing).

[0043] By adopting this disclosure, the client can send a file synchronization request to the cloud storage server, receive the cloud storage information file fed back by the cloud storage server, and determine the file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. Thus, the client can perform the file synchronization operation corresponding to the file synchronization strategy, thereby improving the accuracy of file synchronization.

[0044] In one embodiment, the client determines a file synchronization strategy based on cloud storage information files, the client's local modification information files, and the client's local historical synchronization information files. This includes: the client determining the target conflict file and the target conflict type based on the cloud storage information files, the client's local modification information files, and the client's local historical synchronization information files; and the client obtaining a file synchronization strategy based on the target conflict type. By employing this embodiment, the target conflict file and the target conflict type can be determined based on the cloud storage information files, the client's local modification information files, and the client's local historical synchronization information files, and a file synchronization strategy can be obtained based on the target conflict type. This allows for the execution of corresponding file synchronization operations on the target conflict file according to the file synchronization strategy, improving the accuracy of file synchronization. Since highly available cloud storage servers can persist data, file synchronization between the client and the cloud storage server can also ensure that data is not lost and that data integrity is guaranteed.

[0045] In one embodiment, the client executes file synchronization operations corresponding to the file synchronization strategy, including: the client performing any one of the file synchronization operations (file download, file upload, or file deletion) on the target conflicting file according to the file synchronization strategy. By adopting this embodiment, file synchronization operations such as downloading, uploading, not processing, and deleting can be performed specifically according to the file synchronization strategy to ensure the accuracy of file synchronization.

[0046] In one embodiment, the cloud storage information file includes: a first directory storage information file and a second directory storage information file. The client determines the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. This includes: the client comparing the first directory storage information file and the second directory storage information file to determine that the first directory storage information file is the target cloud storage information file, wherein the target cloud storage information file represents the file containing the latest synchronization information from the cloud storage server. Using this embodiment, the cloud storage server can store two file directories (which can be denoted as "directory 0" and "directory 1"), storing the first directory storage information file and the second directory storage information file respectively. Thus, the client can determine the target conflict file for the file synchronization operation to be performed by comparing the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file. If the target conflict file is located on the client, the current target conflict type is determined to be either added or modified.

[0047] In one embodiment, the client obtains a file synchronization strategy based on the target conflict type, including: if the target conflict type is addition or modification, the file synchronization strategy is file upload. After the client uploads the target conflict file, it can send an updated second directory storage information file. Using this embodiment, after uploading the target conflict file, a file synchronization operation is performed on the updated second directory storage information file obtained on the client side, and the original second directory storage information file stored on the cloud storage server is replaced accordingly, improving the accuracy of file synchronization.

[0048] In one embodiment, the method further includes: the client merging the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file to obtain an updated second directory storage information file. Using this embodiment, local and cloud files can be merged to obtain an updated second directory storage information file, maintaining the accuracy of file synchronization at all times.

[0049] In one embodiment, the method further includes: the client sending a request to the cloud storage server to obtain a lock file status identifier; if the obtained lock file status identifier is invalid or expired, the client writing corresponding locking information to the file system lock file of the cloud storage server. This embodiment sets up a distributed locking mechanism for the client's file synchronization operation. For example, if the obtained lock file status identifier is invalid or expired, the client writes corresponding locking information to the file system lock file of the cloud storage server. Files with locked information are not allowed to be synchronized, avoiding erroneous operations when other clients perform file synchronization operations with the cloud storage server, thus improving the accuracy of file synchronization.

[0050] According to embodiments of this disclosure, a file synchronization method is provided. Figure 2 This is a data interaction diagram of a file synchronization method according to an embodiment of the present disclosure, such as... Figure 2 As shown, it includes:

[0051] S201. The client sends a file synchronization request to the cloud storage server.

[0052] In this embodiment of the disclosure, the client periodically sends synchronization requests to the cloud storage server, that is, the client periodically performs a bidirectional synchronization process with the cloud storage server. The synchronization interval can be one minute, ten minutes or one hour, or other times, and is not specifically limited here.

[0053] In this embodiment, the number of clients is multiple, such as 2, 3, 4, 5 or more. Each client synchronizes with the cloud storage server, and one client synchronizes with another client through the cloud storage server. Here, the client can be an application client, or other types of clients; no specific limitation is made here.

[0054] Figure 3 This diagram illustrates a star topology and a centralized topology according to embodiments of this disclosure. Taking the star topology as an example, multiple clients (clients 301-304) communicate end-to-end using a star-based synchronization method. Each client needs to be aware of the presence of other clients. This method requires a centralized client registration and synchronization service to ensure each client can promptly discover other clients, and a heartbeat mechanism is needed to detect client liveness. Considering that such end-to-end communication increases server resource consumption, and that each client synchronizes independently with other clients, maintaining a certain synchronization frequency or having a large number of clients also increases client CPU resource consumption. Therefore, in practical applications, a centralized topology not only reduces server and client resource consumption but also improves file synchronization accuracy. In this embodiment of the disclosure, a centralized storage method is adopted based on the centralized structure. The file synchronization between clients using the star-topic synchronization method is transformed into synchronization between the client and the centralized storage service. That is, multiple clients (client 301-client 304) communicate with the cloud storage server respectively. The cloud storage server adopts a highly available storage server, which can persistently store data, ensure that the data is not lost, and ensure data integrity.

[0055] S202: In response to a file synchronization request, the cloud storage server sends the cloud storage information file to the client.

[0056] In this embodiment, the cloud storage server directly receives file synchronization requests from clients without requiring processing through a Git service. Compared to traditional Git services, which use a client / server architecture where clients merge the latest files using commit and pull commands, and require a Git server to handle push requests from various clients before persistently storing the data, this embodiment employs a serverless approach. Clients can directly synchronize with the cloud storage server without the need for a cloud storage server to coordinate synchronization requests from various clients, thus saving server-side resources.

[0057] In this embodiment of the disclosure, the cloud storage information file is stored in the file system of the cloud storage server and is used to record the latest update information (synchronization information) of all stored files. The client needs to obtain this file before each synchronization to perform subsequent conflict file judgment.

[0058] S203. Based on cloud storage information files, client's local modification information files, and client's local historical synchronization information files, determine the target conflict file and target conflict type, and obtain a file synchronization conflict resolution strategy according to the target conflict type.

[0059] In this embodiment of the disclosure, during the synchronization process between the client and the cloud storage server, it is necessary to compare the local modified information file, the local historical synchronization information file, and the latest changes in the cloud storage to find conflicting files. Based on the pre-sorted types of conflicts that may occur during the synchronization process, the classification type of the conflicting files is determined, and the conflict resolution strategy is obtained from the pre-established conflict resolution strategy model based on the classification type of the conflicting files.

[0060] Figure 4 This is a schematic diagram of a synchronization conflict resolution strategy according to an embodiment of the present disclosure. The conflict resolution strategy model can be in the form of a diagram (see [link]). Figure 4The terms "existence," "absence," "deletion," and "upload" refer to the process of synchronizing files between the client and cloud storage servers. "Greater than," "less than," and "equal to" compare the latest update times of files on the client and cloud storage servers. For example, if the client has file A, and the cloud storage server also has a corresponding mapped file A' (with the same name, referred to as A' for distinction), and "client < cloud" means the latest update time of file A on the client is earlier than the latest update time of mapped file A' on the cloud storage server, then mapped file A' needs to be downloaded to the client to synchronize files between the client and cloud storage servers.

[0061] S204. The client and the cloud storage server perform corresponding file synchronization operations on the target conflicting files based on the file synchronization conflict resolution strategy.

[0062] In this embodiment of the disclosure, the client and the cloud storage server perform corresponding upload, download, or deletion operations according to the synchronization conflict resolution strategy shown in Figure 4.

[0063] The file synchronization method of this disclosure transforms client-to-client file synchronization into synchronization between the client and a cloud storage server. The use of a highly available cloud storage server enables data persistence, ensuring that data is not lost, thereby improving the efficiency of file synchronization and user experience. It can be applied to multi-terminal project collaborative development and multi-terminal project file synchronization.

[0064] In one embodiment, the cloud storage information file includes a first directory storage information file and a second directory storage information file. The first directory storage information file is used to record the synchronization information of all files stored in the first file system storage directory on the cloud storage server, and the second directory storage information file is used to record the synchronization information of all files stored in the second file system storage directory on the cloud storage server. The second file system storage directory is obtained by mapping the first file system storage directory.

[0065] In one embodiment, a target cloud storage information file is determined by comparing a first directory storage information file and a second directory storage information file. The target cloud storage information file is a file that records the latest synchronization information of the cloud storage server. If the first directory storage information file is determined to be the target cloud storage information file, the updated second directory storage information file is obtained by merging the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file.

[0066] Figure 5 This is a schematic diagram of a 0 / 1 switching mechanism according to an embodiment of this disclosure. In some examples, such as... Figure 5 As shown, the cloud storage server includes two file system storage directories. The first file system storage directory can be named "directory 0" and the second file system storage directory can be named "directory 1". These two directories are mapped. Before synchronization, the client first retrieves the directory storage information files for both "directory 0" and "directory 1". These files are meta files, and the synchronization information stored in the meta file includes information about all stored files, file storage locations, and file update times. Before performing file synchronization, the client first retrieves the meta files for both "directory 0" and "directory 1", then compares the markers of the two meta files to obtain the latest and complete meta file. Assuming the latest meta file comes from directory 0, it is denoted as 0.meta. Two meta files exist locally on the client (the local modification information file "local.meta" and the local history synchronization information file "history.meta"). Specifically, local.meta records the current file modification information, and history.meta records the file information after the latest synchronization. The client merges these files according to the conflict resolution strategy to generate 1.meta, which is the updated second directory storage information file mentioned above.

[0067] In one implementation, if it is determined by comparing the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file that the target conflict file is located on the client and the target conflict type is add / modify, then the target conflict file is uploaded to the second file system storage directory. After the target conflict file has been uploaded, the updated second directory storage information file is sent to the second file system storage directory.

[0068] In some examples, such as Figure 5 As shown, in conflict resolution, if file A is stored in directory "0" in 0.meta, after local modification, its storage location in 1.meta will be reversed to directory "1". After all files are successfully pushed, file 1.meta will be pushed to directory "1". Even if an exception occurs during the process of pushing file A to directory "1" and the push fails, it will not affect the use of file A in directory "0", and 1.meta will not be pushed to directory "1". Other clients can still obtain the correct and latest file information from the cloud during file synchronization, thus ensuring that cloud files are not corrupted in the event of synchronization failure. This synchronization failure resolution mechanism can be called the 0 / 1 switching mechanism.

[0069] Since the cloud storage server used in this embodiment is an object storage system, and the object file system does not support semantics such as MV, it is not possible to first synchronize a temporary file and then MV-compile it into the final filename after successful synchronization when uploading a file. If file A already exists in the cloud storage, and file A is modified on the client side, and a network error or system failure occurs during the synchronization process from the client to the cloud storage, causing the synchronization terminal to be interrupted, the file A in the cloud will become an incorrect file. The file synchronization method of this embodiment, using the aforementioned 0 / 1 switching mechanism, can effectively ensure that the cloud file is not corrupted when file synchronization fails.

[0070] In one embodiment, if it is determined by comparing the first directory storage information file, the client's local modification information file, and the client's local history synchronization information file that the target conflicting file is located on the client and the target conflict type is deletion, then an updated second directory storage information file is sent to the second file system storage directory. In this embodiment, if the client deletes a file, it only needs to send an updated directory storage information file to the second file system storage directory; the cloud storage server does not need to actually perform the file deletion operation, but can use the storage information identifier.

[0071] In one implementation, the client can send a request to the cloud storage server to obtain the lock file status identifier. If the obtained lock file status identifier is invalid or expired, the client writes the corresponding locking information to the file system lock file of the cloud storage server.

[0072] Figure 6 This is a schematic diagram of a distributed lock mechanism according to an embodiment of this disclosure. In some examples, such as... Figure 6 As shown, simultaneous file synchronization by multiple clients (clients 601-603) can lead to file overwriting and write conflicts. Therefore, a distributed lock mechanism is introduced to ensure that only one client performs file synchronization at a time. To avoid introducing new components, this embodiment of the disclosure designs a distributed lock mechanism including functions such as locking, unlocking, lock renewal, and deadlock release. Taking locking client 603 as an example, the specific description is as follows:

[0073] 1) Locking Process: Before performing file synchronization, the system first attempts to retrieve the lock file from the cloud storage server. This lock file stores lock file status indicators. If the lock file status indicator is invalid or expired (i.e., no lock exists), the system attempts to acquire the lock by writing the lock file (repo.lock file) to the cloud storage server, along with the client's 603 lock status and the lock acquisition time. If the lock file status indicator is valid (i.e., the lock exists), the system determines whether client 603 can acquire the lock based on whether the lock was acquired by client 603 itself and whether the lock has expired.

[0074] 2) Lock renewal: Once a client successfully acquires a lock (603 error) and is in the locked state, if synchronization is not completed within the lock's validity period, an additional service needs to be started to renew the lock in a timely manner to prevent the lock from expiring and being taken over by other clients.

[0075] 3) Release the lock: After the file synchronization operation performed by client 603 is completed, it actively releases the lock. If the release fails, other clients (such as clients 601-602) cannot mirror the synchronization during the lock's validity period and will have to wait until the lock expires.

[0076] In this embodiment of the disclosure, during the locking process, multiple clients simultaneously write repo.lock to the cloud storage server. The client that writes first successfully acquires the lock. Lock release involves deleting the written repo.lock. The client that acquired the lock can delete the lock file, and other clients can also do so. All these methods are implemented through lock acquisition.

[0077] According to embodiments of this disclosure, a file synchronization device is provided. Figure 7 This is a structural block diagram of a file synchronization device according to an embodiment of the present disclosure, such as... Figure 7 As shown, the file synchronization device 700 is located on the client side and includes: a request sending unit 701, used to send a file synchronization request to a cloud storage server; a receiving unit 702, used to receive a cloud storage information file fed back by the cloud storage server; a policy determination unit 703, used to determine a file synchronization policy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file; and a synchronization processing unit 704, used to execute a file synchronization operation corresponding to the file synchronization policy.

[0078] In one embodiment, the strategy determination unit is used for the client to determine the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file; and for the client to obtain the file synchronization strategy based on the target conflict type.

[0079] In one embodiment, the synchronization processing unit is used by the client to perform any one of the following file synchronization operations—file download, file upload, or file deletion—on the target conflicting file according to the file synchronization strategy.

[0080] In one embodiment, the cloud storage information file includes: a first directory storage information file and a second directory storage information file; the policy determination unit is used for the client to determine, by comparing the first directory storage information file and the second directory storage information file, that the first directory storage information file is a target cloud storage information file, the target cloud storage information file being used to characterize the latest synchronized information of the cloud storage server; the client to determine the target conflict file by comparing the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file; and, if the target conflict file is located on the client, to determine that the target conflict type is either added or modified.

[0081] In one embodiment, the strategy determination unit is used to determine that the file synchronization strategy is file upload when the target conflict type is the addition or modification; the device further includes a file update unit, used to send an updated second directory storage information file after the target conflict file has been uploaded.

[0082] In one embodiment, the system further includes a fusion unit, which is used to fuse the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file to obtain the updated second directory storage information file.

[0083] In one embodiment, a locking processing unit is further included, which is used to send a request to the cloud storage server to obtain a lock file status identifier; if the obtained lock file status identifier is in an invalid or expired state, the unit writes corresponding locking information into the file system lock file of the cloud storage server.

[0084] According to embodiments of this disclosure, a file synchronization system is provided. Figure 8 This is a schematic diagram illustrating communication between a client and a cloud storage server in a file synchronization system according to an embodiment of this disclosure, as shown below. Figure 8 As shown, the file synchronization system includes multiple clients (clients 801-804) and a cloud storage server 805, and all clients communicate bidirectionally with the cloud storage server.

[0085] Taking bidirectional communication between any one of multiple clients and a cloud storage server as an example, the client may include: a synchronization request sending unit for sending a file synchronization request to the cloud storage server; a storage information receiving unit for receiving cloud storage information files sent by the cloud storage server; a conflict determination unit for determining the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file, and obtaining a file synchronization conflict resolution strategy based on the target conflict type; and a first synchronization operation unit for performing corresponding synchronization operations on the target conflict file based on the file synchronization conflict resolution strategy.

[0086] The cloud storage server includes: a request response unit, used to respond to a file synchronization request and send cloud storage information files to the client; and a second synchronization operation unit, used to perform corresponding synchronization operations on the target conflicting files based on the file synchronization conflict resolution strategy.

[0087] In one embodiment, the cloud storage information file includes a first directory storage information file and a second directory storage information file. The first directory storage information file records synchronization information for all files stored in the first file system storage directory on the cloud storage server, and the second directory storage information file records synchronization information for all files stored in the second file system storage directory on the cloud storage server. The second file system storage directory is obtained by mapping the first file system storage directory.

[0088] In one embodiment, the conflict determination unit includes: a synchronization information comparison module, configured to determine a target cloud storage information file by comparing a first directory storage information file and a second directory storage information file, wherein the target cloud storage information file is a file that records the latest synchronization information of the cloud storage server; and a fusion module, configured to, if the first directory storage information file is determined to be the target cloud storage information file, fuse the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file to obtain an updated second directory storage information file.

[0089] In one embodiment, the fusion module is further configured to, if by comparing the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file, determine that the target conflict file is located on the client and the target conflict type is addition / modification, then upload the target conflict file to the second file system storage directory; after the target conflict file has been uploaded, send the updated second directory storage information file to the second file system storage directory.

[0090] In one embodiment, the client further includes: a lock file acquisition unit, configured to send a request to the cloud storage server to acquire a lock file status identifier; and a locking unit, configured to write corresponding locking information to the file system lock file of the cloud storage server if the acquired lock file status identifier is invalid or expired.

[0091] This disclosure also provides an electronic device, including:

[0092] At least one processor; and

[0093] A memory that is communicatively connected to at least one processor; wherein,

[0094] The memory stores instructions that can be executed by at least one processor, which enables the at least one processor to perform the file synchronization method as described in the above-disclosed embodiments.

[0095] This disclosure also provides a non-transitory computer-readable storage medium storing computer instructions thereon, the computer instructions being used to cause a computer to perform the file synchronization method as described in the above-disclosed embodiments.

[0096] This disclosure also provides a computer program product, characterized in that it includes a computer program that, when executed by a processor, implements the file synchronization method as described in the above-disclosed embodiments.

[0097] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0098] Electronic devices are intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0099] like Figure 9As shown, the electronic device 900 includes a computing unit 901, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 902 or a computer program loaded into a random access memory (RAM) 903 from a storage unit 906. The RAM 903 may also store various programs and data required for the operation of the electronic device 900. The computing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0100] Multiple components in electronic device 900 are connected to I / O interface 905, including: input unit 906, such as keyboard, mouse, etc.; output unit 907, such as various types of displays, speakers, etc.; storage unit 906, such as disk, optical disk, etc.; and communication unit 909, such as network card, modem, wireless transceiver, etc. Communication unit 909 allows electronic device 900 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0101] The computing unit 901 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 901 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 901 performs the various methods and processes described above, such as the file synchronization method. For example, in some embodiments, the file synchronization method may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 906. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded into RAM 903 and executed by the computing unit 901, one or more steps of the file synchronization method described above may be performed. Alternatively, in other embodiments, the computing unit 901 may be configured to perform the file synchronization method by any other suitable means (e.g., by means of firmware).

[0102] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0103] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0104] 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. A machine-readable medium 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.

[0105] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0106] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.

[0107] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.

[0108] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this disclosure can be achieved, and this is not limited herein.

[0109] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.

Claims

1. A file synchronization method, said method being applied to multi-device file synchronization, comprising: The client sends a file synchronization request to the cloud storage server; The client receives a cloud storage information file from the cloud storage server, which records the latest updates of all stored files; the cloud storage server includes a first file system and a second file system, wherein one file system stores the first directory storage information file and the other file system stores the second directory storage information file. The client determines the file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file; The client executes the file synchronization operation corresponding to the file synchronization strategy. It also includes: after the client makes local modifications, the target cloud storage information file, the local modification information file, and the local historical synchronization information file, which are used to represent the latest synchronization information of the cloud storage server, are merged from the first directory storage information file and the second directory storage information file to obtain a new meta file; In the new meta, its storage location is reversed to the directory corresponding to the target cloud storage information file; After all files are successfully pushed, the client will push the new meta file to the directory of the file system corresponding to the target cloud storage information file.

2. The method according to claim 1, wherein, The client determines a file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file, including: The client determines the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. The client obtains the file synchronization strategy based on the target conflict type.

3. The method according to claim 2, wherein, The client executes file synchronization operations corresponding to the file synchronization strategy, including: According to the file synchronization strategy, the client performs any one of the following file synchronization operations on the target conflicting file: file download, file upload, or file deletion.

4. The method according to claim 2, wherein, The client determines the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file, including: The client determines that the first directory storage information file is the target cloud storage information file by comparing the first directory storage information file and the second directory storage information file; The client determines the target conflicting file by comparing the information file stored in the first directory, the client's local modification information file, and the client's local historical synchronization information file. If the target conflict file is located on the client, the target conflict type is determined to be either newly added or modified.

5. The method according to claim 4, wherein, The client obtains the file synchronization strategy based on the target conflict type, including: When the target conflict type is the addition or modification, the file synchronization strategy is file upload. The method further includes: After uploading the target conflict file, the client sends an updated second directory storage information file.

6. The method according to claim 5, further comprising: The client merges the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file to obtain the updated second directory storage information file.

7. The method according to any one of claims 1-6, further comprising: The client sends a request to the cloud storage server to obtain the lock file status identifier; If the lock file status is identified as invalid or expired, the client writes the corresponding locking information to the file system lock file of the cloud storage server.

8. A file synchronization device, said device being used for multi-terminal file synchronization, comprising: The request sending unit is used to send file synchronization requests to the cloud storage server; The receiving unit is used to receive a cloud storage information file that records the latest update information of all stored files, fed back by the cloud storage server; the cloud storage server includes a first file system and a second file system, wherein one file system stores the first directory storage information file and the other file system stores the second directory storage information file. The strategy determination unit is used to determine a file synchronization strategy based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. A synchronization processing unit is used to execute file synchronization operations corresponding to the file synchronization strategy according to the file synchronization strategy; It also includes a file update unit, which, after the client makes local modifications, merges the target cloud storage information file, the local modification information file, and the local historical synchronization information file in the first directory storage information file and the second directory storage information file to represent the latest synchronization information of the cloud storage server, and obtains a new meta file; In the new meta, its storage location is reversed to the directory corresponding to the target cloud storage information file; After all files are successfully pushed, the client will push the new meta file to the directory of the file system corresponding to the target cloud storage information file.

9. The apparatus according to claim 8, wherein, The strategy determination unit is used for: The client determines the target conflict file and the target conflict type based on the cloud storage information file, the client's local modification information file, and the client's local historical synchronization information file. The client obtains the file synchronization strategy based on the target conflict type.

10. The apparatus according to claim 9, wherein, The synchronization processing unit is used for: According to the file synchronization strategy, the client performs any one of the following file synchronization operations on the target conflicting file: file download, file upload, or file deletion.

11. The apparatus according to claim 9, wherein, The cloud storage information files include: a first directory storage information file and a second directory storage information file; The strategy determination unit is used for: The client determines that the first directory storage information file is the target cloud storage information file by comparing the first directory storage information file and the second directory storage information file. The target cloud storage information file is used to represent the latest synchronized information of the cloud storage server. The client determines the target conflicting file by comparing the information file stored in the first directory, the client's local modification information file, and the client's local historical synchronization information file. If the target conflict file is located on the client, the target conflict type is determined to be either newly added or modified.

12. The apparatus according to claim 11, wherein, The strategy determination unit is used for: When the target conflict type is the addition or modification, the file synchronization strategy is file upload. The device also includes a file update unit, used to send an updated second directory storage information file after the target conflict file has been uploaded.

13. The apparatus of claim 12, further comprising a fusion unit for: The updated second directory storage information file is obtained by merging the first directory storage information file, the client's local modification information file, and the client's local historical synchronization information file.

14. The apparatus according to any one of claims 8-13, further comprising a locking processing unit for: Send a request to the cloud storage server to obtain the lock file status identifier; If the lock file status is identified as invalid or expired, corresponding locking information is written to the file system lock file of the cloud storage service server.

15. An electronic device, characterized in that, include: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method as described in any one of claims 1 to 7.

16. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method as described in any one of claims 1 to 7.

17. A computer program product, characterized in that, It includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1 to 7.