File synchronization method, electronic equipment and storage medium

By checking and incremental synchronization of temporary synchronized files during file synchronization, the problems of insecure and incomplete file synchronization in the existing technology are solved, and an efficient and secure file synchronization process is achieved.

CN119248736AActive Publication Date: 2025-01-03HONOR DEVICE CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202410386081.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-03-29
Publication Date
2025-01-03
Estimated Expiration
2044-03-29

AI Technical Summary

Technical Problem

In the prior art, the file synchronization process is unsafe, error-prone, and the file synchronization is incomplete, so it is impossible to effectively prevent the system of the device in the trust ring from being attacked by malware or viruses.

Method used

By generating temporary synchronized files during file synchronization and verifying them intact, consistency, and functionality, we ensure the accuracy and security of file synchronization, and use incremental synchronization to reduce data transmission, save bandwidth and improve efficiency .

Benefits of technology

Improve the accuracy and security of file synchronization, ensure that files are not tampered with, reduce the load and power consumption during file synchronization, and enhance the security and stability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248736A_ABST
    Figure CN119248736A_ABST
Patent Text Reader

Abstract

The invention provides a file synchronization method, electronic equipment and a storage medium, and relates to the technical field of data processing. The method is applied to the electronic device, a trust ring where the electronic device is located further comprises at least one trusted electronic device, and the method comprises the steps that a to-be-synchronized file sent by the at least one trusted electronic device is obtained; generating a temporary synchronization file according to the to-be-synchronized file; verifying the temporary synchronization file; and when the temporary synchronization file passes the verification, synchronizing the temporary synchronization file to the file system. In the implementation mode, the temporary synchronization file is verified, the consistency of the file received by the electronic equipment and the source file can be ensured, the integrity of file synchronization is ensured, and the accuracy of file synchronization is improved. In addition, the temporary synchronization file is verified, it can be guaranteed that the synchronized file is not tampered, the system of the electronic device in the trust ring is prevented from being attacked by malicious software or viruses, and the safety of the file synchronization process is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file synchronization method, an electronic device and a storage medium. Background Art

[0002] With the development of communication technology, distributed technology is increasingly being applied to electronic devices. Distributed technology brings users a more relaxed and convenient experience in some scenarios such as office, data storage, and data access.

[0003] For example, in a distributed file synchronization scenario, mobile phones and other electronic devices (such as tablets, laptops, home storage devices, etc.) use near-field communications, such as wireless fidelity (Wi-Fi), Bluetooth (BT), and peer-to-peer (P2P) to form a local area network, establish a trust loop, and synchronize files in the mobile phone to other electronic devices.

[0004] However, it is found in use that the file synchronization process in the related technology is not safe and is prone to errors. Summary of the invention

[0005] The present application provides a file synchronization method, an electronic device and a storage medium, which can ensure the integrity of file synchronization, improve the accuracy of file synchronization and improve the security of the file synchronization process.

[0006] In a first aspect, the present application provides a file synchronization method, which is applied to an electronic device, wherein the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the method includes: obtaining a file to be synchronized sent by at least one trusted electronic device; generating a temporary synchronization file based on the file to be synchronized; verifying the temporary synchronization file; and when the temporary synchronization file passes the verification, synchronizing the temporary synchronization file to the file system.

[0007] The to-be-synchronized file is a file that is to be synchronized. In the embodiment of the present application, the to-be-synchronized file may be a file for synchronization sent by a trusted electronic device to an electronic device.

[0008] Optionally, verifying the temporary synchronization file may include verifying the integrity of the temporary synchronization file, the consistency between the temporary synchronization file and the source file, whether the function of the temporary synchronization file is normal, etc.

[0009] In this implementation, since the temporary synchronization file is verified, it can ensure that the file received by the electronic device is consistent with the source file, ensure the integrity and consistency of file synchronization, make the final synchronized file accurate, and improve the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively preventing the system of the electronic device in the trust ring from being attacked by malware or viruses, and improving the security of the file synchronization process.

[0010] In combination with the first aspect, in certain implementations of the first aspect, verifying a temporary synchronization file includes: obtaining source metadata sent by at least one trusted electronic device; generating a verification value corresponding to the temporary synchronization file and a verification value corresponding to the source metadata; and determining that the temporary synchronization file has passed verification when it is detected that the verification value of the temporary synchronization file is consistent with the verification value of the source metadata.

[0011] Optionally, the check value of the temporary synchronization file and the check value of the source-end metadata may both include a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, and the like.

[0012] This implementation is equivalent to performing a consistency check on the temporary synchronization file and the source file. When the temporary synchronization file and the source file are consistent, the file is synchronized again, which can make the final synchronized file accurate and improve the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively preventing the system of the electronic device in the trust ring from being attacked by malware or viruses, and improving the security of the file synchronization process.

[0013] In combination with the first aspect, in certain implementations of the first aspect, synchronizing a temporary synchronization file to a file system includes: deleting a local file corresponding to the temporary synchronization file in the file system; modifying the file name of the temporary synchronization file; and storing the temporary synchronization file with the modified file name in the file system.

[0014] Optionally, the modified file name of the temporary synchronization file is consistent with the file name of the local file.

[0015] In this implementation, the local file is deleted first, and then the file name of the temporary synchronization file is modified. This can avoid file name conflicts, reduce errors caused by inconsistent file names or file versions, and help ensure the integrity and consistency of file synchronization.

[0016] In combination with the first aspect, in some implementations of the first aspect, generating a temporary synchronization file according to the file to be synchronized includes: performing incremental synchronization on the local file and the file to be synchronized to generate the temporary synchronization file.

[0017] In this implementation, the incremental synchronization method is used to complete the multi-terminal synchronization of files, which can effectively reduce the amount of data transferred by the file and save bandwidth. In addition, due to the reduction in the amount of data transferred, the file synchronization process is accelerated, which improves the overall data synchronization efficiency. At the same time, since the electronic device only needs to process the changed files, the load during the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0018] In combination with the first aspect, in certain implementations of the first aspect, the file synchronization method may further include, before obtaining the file to be synchronized sent by at least one trusted electronic device: obtaining local metadata; when it is detected that the local metadata matches the local file, comparing the local metadata with the source metadata for consistency; when the local metadata is consistent with the source metadata, updating the local file.

[0019] Among them, local metadata is used to describe the local file name, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read and write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file is a hidden file, a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative path, etc.

[0020] The source-side metadata is used to describe the name of the file to be synchronized, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read-write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file is a hidden file, a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative path, etc.

[0021] In this implementation, the local metadata and the local files, as well as the local metadata and the source metadata are verified, and the subsequent file synchronization process is executed when the verification passes, which can ensure the accuracy of the subsequent file synchronization results.

[0022] In combination with the first aspect, in certain implementations of the first aspect, the file synchronization method, after detecting that the local metadata matches the local file, compares the local metadata with the source metadata to see if they are consistent, may also include: when the local metadata is inconsistent with the source metadata, determining the difference data between the local metadata and the source metadata; and sending the difference data to at least one trusted electronic device.

[0023] The difference data is used to trigger at least one trusted electronic device to send the file to be synchronized to the electronic device.

[0024] In this implementation, when it is determined that the local file is different from the source file, the difference data is sent to the trusted electronic device, triggering the trusted electronic device to send the file to be synchronized to the electronic device, thereby providing a guarantee for achieving file synchronization.

[0025] In combination with the first aspect, in certain implementations of the first aspect, when the local metadata is inconsistent with the source metadata, after determining the difference data between the local metadata and the source metadata, the file synchronization method may also include: sending the source metadata and the difference data to at least one trusted electronic device.

[0026] The sending of source-end metadata is used for at least one trusted electronic device to verify whether the source-end metadata matches a local file in at least one trusted electronic device; the sending of difference data is used to trigger at least one trusted electronic device to send a file to be synchronized to the electronic device when the source-end metadata matches a local file in at least one trusted electronic device.

[0027] In this implementation, the source file and metadata of the trusted electronic device are first verified, and the subsequent file synchronization process is executed when there is no problem with the source file, which can ensure the accuracy of the subsequent file synchronization results.

[0028] In a second aspect, the present application provides an electronic device, comprising: one or more processors; one or more memories; a module with multiple applications installed; the memory stores one or more programs, and when one or more programs are executed by the processor, the electronic device executes the method in the above-mentioned first aspect and any possible implementation thereof.

[0029] In a third aspect, the present application provides a device for processing data, including a unit for executing any one of the methods in the first aspect. The device may be a server, an electronic device, or a chip in an electronic device. The device may include an input unit and a processing unit.

[0030] When the device is an electronic device, the processing unit may be a processor, and the input unit may be a communication interface; the electronic device may also include a memory for storing computer program code, and when the processor executes the computer program code stored in the memory, the electronic device executes any one of the methods in the first aspect.

[0031] When the device is a chip in an electronic device, the processing unit may be a processing unit inside the chip, and the input unit may be an output interface, a pin or a circuit, etc.; the chip may also include a memory, which may be a memory inside the chip (for example, a register, a cache, etc.) or a memory located outside the chip (for example, a read-only memory, a random access memory, etc.); the memory is used to store computer program code, and when the processor executes the computer program code stored in the memory, the chip executes any one of the methods in the first aspect.

[0032] In a fourth aspect, the present application provides a chip, including a processor. The processor is used to read and execute a computer program stored in a memory to perform the method in the first aspect and any possible implementation thereof.

[0033] Optionally, the chip also includes a memory, and the memory is connected to the processor via a circuit or wire.

[0034] Optionally, the chip also includes a communication interface.

[0035] In a fifth aspect, the present application provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the method in the first aspect and any possible implementation thereof.

[0036] In a sixth aspect, the present application provides a computer program product, the computer program product comprising: a computer program code, when the computer program code runs on an electronic device, enables the electronic device to execute the method in the first aspect and any possible implementation thereof.

[0037] The technical effects obtained by the above-mentioned second, third, fourth, fifth and sixth aspects are similar to the technical effects obtained by the corresponding technical means in the above-mentioned first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of a system architecture applicable to the file synchronization method shown in an embodiment of the present application;

[0039] Figure 2 A schematic diagram of another system architecture applicable to the file synchronization method shown in the embodiment of the present application;

[0040] Figure 3 A schematic diagram of an application scenario of file synchronization shown in an embodiment of the present application;

[0041] Figure 4 A schematic diagram of backing up data based on external storage shown in an embodiment of the present application;

[0042] Figure 5 A schematic diagram of a data backup process shown in an embodiment of the present application;

[0043] Figure 6 A schematic diagram of a file synchronization process shown in an embodiment of the present application;

[0044] Figure 7 A flowchart of a file synchronization method shown in an embodiment of the present application;

[0045] Figure 8 A schematic diagram of incremental synchronization shown in an embodiment of the present application;

[0046] Fig. 9 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0047] Fig.10 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0048] Fig.11 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0049] Fig.12 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0050] Fig.13 A flowchart of another file synchronization method according to an embodiment of the present application is shown;

[0051] Fig.14 A schematic diagram of the hardware structure of an electronic device shown in an embodiment of the present application;

[0052] Fig.15 A schematic diagram of the software structure of an electronic device shown in an embodiment of the present application;

[0053] Fig.16 A schematic diagram of the structure of a chip shown in an embodiment of the present application. DETAILED DESCRIPTION

[0054] The technical solution in this application will be described below in conjunction with the accompanying drawings.

[0055] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0056] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.

[0057] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0058] In order to better understand the embodiments of the present application, some terms involved in the embodiments of the present application are first explained below to facilitate understanding by those skilled in the art.

[0059] 1. Trust Ring and Trusted Electronic Devices

[0060] Two or more electronic devices establish a trust relationship and form a trust circle through trusted authentication.

[0061] Electronic devices can perform trusted authentication, establish a trust relationship, and form a trust circle through any of the following methods: 1) Log in to the same account on two or more electronic devices respectively, and the electronic devices under the same account trust each other, then the above two or more electronic devices constitute a trust circle. For example, two mobile phones of the same user, or the mobile phone, tablet computer, laptop computer, home storage device (Network Attached Storage, NAS), etc. of the same user can perform trusted authentication by logging into the user's account, establish a trust relationship, and form a trust circle. 2) Two or more electronic devices perform trusted authentication through a private protocol, establish a trust relationship, and form a trust circle. 3) Two or more electronic devices perform trusted authentication by logging into the cloud, establish a trust relationship, and form a trust circle. It can be understood that the above methods of building a trust circle are only used for illustration and do not constitute any limitation on this application.

[0062] The electronic devices in the trust ring form a local area network through near field communication, and data synchronization can be performed through the local area network to achieve device collaboration. In the embodiment of the present application, data synchronization includes but is not limited to file synchronization.

[0063] The electronic device that actively initiates a synchronization request in the trust ring can be called the master device, and other electronic devices that have a trust relationship with the master device through mutual trust authentication are called trusted electronic devices. For example, a mobile phone, a tablet computer, and a laptop computer form a trust ring. The mobile phone actively initiates a synchronization request in the trust ring and applies to synchronize files in the mobile phone to the tablet computer and laptop computer. In this case, the mobile phone is the master device, and the tablet computer and laptop computer are trusted electronic devices.

[0064] 2. Cross-end mounting to access files

[0065] Storage devices transfer, share, and access files between different operating systems and electronic devices.

[0066] 3. Trust Ring Application

[0067] Trusted ring applications refer to applications in electronic devices within the trusted ring. Users can use trusted ring applications to set up file backup, file synchronization and other functions.

[0068] Exemplarily, the trusted ring applications may include file management applications, setting applications, near field transmission applications, gallery applications, third-party file synchronization applications, multimedia applications, social applications, network applications, educational applications, etc.

[0069] 4. Software Development Kit (SDK)

[0070] Usually refers to a collection of development tools that software engineers use to build applications for specific software packages, software frameworks, hardware platforms, operating systems, etc. In other words, SDK is a collection of related documents, examples, and tools that assist in the development of a certain type of application. It facilitates the creation of applications through compilers, debuggers, software frameworks, etc.

[0071] In an embodiment of the present application, the SDK may include a file synchronization SDK. The file synchronization SDK may be integrated into an application, such as a trusted ring application, thereby configuring the trusted ring application with a file synchronization capability.

[0072] 5. Directories and folders

[0073] Directories and folders usually refer to the same concept, which are containers for organizing and storing files and other directories / folders. In the present application embodiment, these two words are used interchangeably in different application scenarios, but the meanings and functions they represent are the same.

[0074] 6. Water level synchronization

[0075] Water level synchronization is a concept in the field of real-time data processing, which is used to ensure the consistency and integrity of data in a distributed system. In the embodiment of the present application, water level synchronization is used to ensure the consistency and integrity of files in different electronic devices and different operating systems.

[0076] 7. Incremental Synchronization

[0077] Incremental synchronization is a file synchronization technique that focuses on synchronizing only the files that have changed since the last file synchronization.

[0078] The above is a brief introduction to the terms involved in the embodiments of the present application, which will not be repeated below.

[0079] The electronic devices in the trust ring form a local area network through near field communication, and data can be synchronized through the local area network. For example, files can be synchronized between electronic devices in the trust ring.

[0080] See also Figure 1 , Figure 1 A schematic diagram of a system architecture applicable to the file synchronization method shown in the embodiment of the present application. Figure 1 As shown, electronic device 100, electronic device 200 and electronic device 300 establish a trust relationship through trusted authentication to form a trust ring. It should be understood that the number of electronic devices included in the trust ring may be more or less than Figure 1 The number of electronic devices shown is subject to actual needs and is not limited.

[0081] In the embodiment of the present application, the electronic device 100, the electronic device 200 and the electronic device 300 can be a master device and a trusted electronic device to each other.

[0082] For example, the electronic device 100 is a mobile phone, the electronic device 200 is a tablet computer, and the electronic device 300 is a laptop computer. For example, when the mobile phone initiates a synchronization request to the tablet computer and the laptop computer, and applies to synchronize the files in the mobile phone to the tablet computer and the laptop computer, the mobile phone is the main device, and the tablet computer and the laptop computer are trusted electronic devices. For another example, when the mobile phone and the tablet computer initiate a synchronization request to the laptop computer, and apply to synchronize the files in the mobile phone and the tablet computer to the laptop computer, the mobile phone and the tablet computer are the main devices, and the laptop computer is the trusted electronic device. This is only an exemplary description and is not limited to this.

[0083] See also Figure 2 , Figure 2FIG. 1 is another schematic diagram of a system architecture applicable to the file synchronization method shown in the embodiment of the present application. Figure 2 As shown, electronic device 100, electronic device 200 and electronic device 400 establish a trust relationship through trusted authentication to form a trust loop. Figure 1 The difference between the trust rings shown is that Figure 2 The electronic device 400 included in the trust ring shown may be a NAS. In an embodiment of the present application, a mobile phone and / or a tablet initiates a synchronization request to the NAS, requesting to synchronize files in the mobile phone and / or a tablet to the NAS. The NAS may also perform cross-end mount access to files, for example, the NAS may transfer and share files to the mobile phone and / or a tablet, and may also access files in the mobile phone and / or a tablet.

[0084] The following describes an application scenario of data synchronization between electronic devices in a trust ring in conjunction with the accompanying drawings.

[0085] The trust ring provided in the embodiment of the present application may include a mobile phone and a NAS, and synchronization of files in a mobile phone to a NAS is used as an example for explanation.

[0086] See also Figure 3 , Figure 3 A schematic diagram of an application scenario of file synchronization shown in an embodiment of the present application.

[0087] For example, open the settings application in the mobile phone, select the "System and Update" option in the display interface corresponding to the settings application, and the mobile phone displays the following: Figure 3 Click the interface shown in (a). Figure 3 In the control 101 in the interface shown in (a), click the "Backup and Restore" option, and the mobile phone displays the following Figure 3 The interface shown in (b).

[0088] exist Figure 3 The interface shown in (b) shows a variety of data backup and recovery methods, such as cloud backup, external storage, mobile assistant, etc. Among them, cloud backup can be used to back up the entire data of the mobile phone to the cloud server. If necessary, the entire data stored in the cloud server can also be restored to the mobile phone through cloud backup. The entire data can include gallery, contacts, text messages, call logs, memos, input methods, harassment blocking, wireless local area network (WLAN) settings, scenario intelligence, mobile phone housekeeper, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat history, browsing history, etc.

[0089] External storage is used to connect to external storage devices to back up and restore data. External storage devices may include external memory cards, Universal Serial Bus (USB) storage devices, NAS, etc.

[0090] Mobile Assistant is used to connect to a computer to back up and restore data.

[0091] In the embodiment of the present application, the files in the mobile phone are backed up to the NAS by means of external storage. It is worth noting that synchronization is also a backup method, and the present application also refers to synchronizing the files in the mobile phone to the NAS. In addition, it is also worth noting that the files and data in the present application refer to the same content, that is, the files in the mobile phone may include gallery, contacts, text messages, call logs, memos, input methods, harassment blocking, wireless local area networks (WLAN) settings, scenario intelligence, mobile phone housekeeper, clock, weather, camera, calendar, desktop icon layout, system settings, applications, chat records, browsing history, etc.

[0092] See also Figure 4 and Figure 5 , Figure 4 This is a schematic diagram of backing up data based on external storage shown in an embodiment of the present application. Figure 5 This is a schematic diagram of the data backup process shown in an embodiment of the present application.

[0093] For example, click Figure 3 In the interface shown in (b), the control 102 is clicked, that is, the "external storage" option is displayed on the mobile phone. Figure 4 The interface shown in (a) in the figure. Figure 4 The interface shown in (a) shows the identification information of various external storage devices, such as external storage card, USB storage, shared folder, etc. Among them, the external storage card is used to back up the data in the mobile phone to the external storage card when the external storage card is detected; the USB storage is used to back up the data in the mobile phone to the USB when connected to the USB; the shared folder is used to back up the data in the mobile phone to the home NAS device when the shared folder in the same network is scanned and found.

[0094] In this example, a shared folder is used to back up the data in the mobile phone to the NAS. Figure 4 In the interface shown in (a), the control 103 is clicked, that is, the "share folder" option is displayed on the mobile phone. Figure 4At this time, the mobile phone discovers the NAS storage device in the same network through WLAN scanning, or the mobile phone discovers the NAS storage device in the trusted circle. After the NAS storage device appears, the user can click to access and add the shared folder under the NAS storage device.

[0095] For example, click Figure 4 In the interface shown in (c), the control 104 is clicked, that is, the "Device Name" option is displayed on the mobile phone. Figure 5 The interface shown in (a) in the figure. Figure 5 In the interface shown in (a), the device name of the NAS storage device, the storage space used by the NAS storage device (1.58 TB used) and the total storage space (eg, 3.92 TB) are displayed.

[0096] exist Figure 5 In the interface shown in (a), an automatic backup control 105, a switch control 106, and a backup data item selection control 107 are also displayed. The switch control 106 is used to turn on or off the automatic backup function. Figure 5 (a) shows the scenario where the automatic backup function is enabled.

[0097] For example, when the automatic backup function is turned on, the user can set the automatic backup cycle according to the needs, for example, automatic backup every other day when the phone screen is off, automatic backup every seven days when the phone screen is off, etc.

[0098] The Select Backup Data Items control 107 is used by the user to select the data items that need to be backed up. Figure 5 In the interface shown in (a), select the backup data item control 107, that is, click the "automatically backup data item" option, and the mobile phone displays the following Figure 5 The interface shown in (b).

[0099] exist Figure 5 In the interface shown in (b), a select all control 108 and a start backup control 109 are displayed. By checking the select all control 108, all data items to be backed up can be selected with one click, such as Figure 5 The data items shown in (b) are music, pictures, videos, contacts, documents, system settings, etc. It should be understood that this is only an exemplary description, and the user can also check one or more data items to be backed up according to their own needs.

[0100] After selecting the data items to be backed up, click Figure 5 In the interface shown in (b), click the "Start backup" option, and the mobile phone displays the following Figure 5The mobile phone performs data preparation processing, such as calculating the number of items and data size corresponding to each data item to be backed up, and displays it in Figure 5 In the interface shown in (c) in the figure. When the data is prepared, the mobile phone starts to back up the data, that is, back up the data items selected by the user in the mobile phone to the NAS, or synchronize the files selected by the user in the mobile phone to the NAS.

[0101] In an embodiment of the present application, a distributed management service is used to manage each electronic device within the trust ring, so that data can be stored and accessed between different electronic devices (such as mobile phones, tablets, laptops, NAS, etc.) and different operating systems (such as Android system, IOS operating system, Symbian operating system, BlackBerry operating system, Linux operating system, Windows operating system, etc.), realizing cross-device and cross-system data storage and access, and opening up a data access channel for near-field communication between electronic devices.

[0102] The application scenario of file synchronization is described above in combination with user operations. The specific process of file synchronization between electronic devices in a trust ring is described below in combination with the accompanying drawings.

[0103] The trust ring provided in the embodiment of the present application may include a mobile phone and a personal computer (PC). The PC may include a desktop computer, a laptop computer, a small laptop computer, a tablet computer, and an ultrabook, etc. Synchronizing files in a mobile phone to a tablet computer is used as an example for explanation.

[0104] See also Figure 6 , Figure 6 A schematic diagram of a file synchronization process shown in an embodiment of the present application.

[0105] S101. The trusted ring application obtains a file synchronization request and calls a file synchronization SDK.

[0106] Trusted ring applications refer to applications in electronic devices within the trusted ring. Users can enable or disable functions such as file backup and file synchronization through trusted ring application settings.

[0107] In an embodiment of the present application, the trust ring application may include file management applications, setting applications, near-field transmission applications, gallery applications, third-party file synchronization applications, multimedia applications, social applications, network applications, educational applications, etc.

[0108] The file synchronization SDK is pre-integrated in the trusted ring application, making it easy for the trusted ring application to create shared directories / shared folders by calling the file synchronization SDK.

[0109] The file synchronization request is used to request that a file in the electronic device to which the trusted ring application belongs be synchronized to at least one trusted electronic device included in the trusted ring. For example, the electronic device to which the trusted ring application belongs is a mobile phone, and the trusted electronic device included in the trusted ring is a tablet computer. The file synchronization request is used to request that a file in the mobile phone be synchronized to the tablet computer.

[0110] The file synchronization request can be triggered by the electronic device to which the trusted ring application belongs, or by a trusted electronic device. For example, the trusted ring application installed on the mobile phone receives the user's operation to turn on the file synchronization function, triggering the file synchronization request. Alternatively, the trusted electronic device initiates a file synchronization request to the electronic device to which the trusted ring application belongs, and the electronic device to which the trusted ring application belongs receives the file synchronization request, such as a tablet computer initiating a file synchronization request to a mobile phone, and the mobile phone receives the file synchronization request.

[0111] Exemplarily, when the trusted ring application obtains a file synchronization request, the file synchronization SDK is called using the pre-written code in the trusted ring application.

[0112] S102: The file synchronization SDK calls the file synchronization service module to create a shared directory / shared folder.

[0113] Exemplarily, the file synchronization service module is deployed in the application framework layer, and is a software component specially designed in the present application to synchronize files between different electronic devices and different operating systems.

[0114] In the embodiment of the present application, the shared directory can be represented by a REPO directory, and the electronic devices in the trust ring can share the REPO directory. The REPO directory may include information such as the file path, the scan start time, the scan time interval, the REPO identification information, the electronic device name, the file synchronization configuration information, and the callback function of the file path.

[0115] The file path refers to the path corresponding to the file to be synchronized, that is, the path where the file to be synchronized to the trusted electronic device is located. For example, if a user wants to synchronize pictures on a mobile phone to a tablet computer, he selects the path corresponding to the gallery on the mobile phone, or selects the directory corresponding to the gallery on the mobile phone. The selected path or directory is the file path.

[0116] The scanning start time is the time when the electronic device starts scanning the file path. Usually, the time when the electronic device first starts scanning the file path is determined according to the time when the user first sets up the file synchronization function. For example, when the user first sets up the file synchronization function, if he selects to start synchronizing files immediately, then the electronic device immediately starts scanning the file path, that is, the scanning start time is the time when the user turns on the file synchronization function.

[0117] The time when the electronic device starts scanning the file path for a non-first time is determined according to the file synchronization cycle set by the user, that is, according to the scanning time interval. For example, the user sets to automatically synchronize files every other day, or every seven days, etc., then, after the electronic device scans the file path for the first time, it scans the file path every other day, or every seven days, etc.

[0118] The REPO identification information is the identifier (ID) of the REPO, which is used to uniquely identify the REPO of the electronic device.

[0119] The file synchronization configuration information may include the number of file synchronizations, the file synchronization version, the name of the trusted electronic device, the REPO identification information of the trusted electronic device, the file path of the trusted electronic device, the filter file, and the like.

[0120] The file synchronization version is used to indicate that the synchronized file has changed. For example, when the file is synchronized for the first time, the file synchronization version is recorded as 1.0; when the file is synchronized for the second time, if the file has changed, the file synchronization version is recorded as 1.1; when the file is synchronized for the third time, if the file has changed, the file synchronization version is recorded as 1.2, and so on.

[0121] The REPO identification information of the trusted electronic device is the ID of the REPO of the trusted electronic device, which is used to uniquely identify the REPO of the trusted electronic device. Exemplarily, when the REPO identification information of the mobile phone matches the REPO identification information of the tablet computer, the mobile phone and the tablet computer can synchronize files.

[0122] The file path of the trusted electronic device refers to the path where the files to be synchronized are stored, that is, the path where the files synchronized from the electronic device are stored. For example, if a user wants to synchronize pictures on a mobile phone to a specified path in a tablet computer, the specified path is the file path of the trusted electronic device.

[0123] Filter files refer to files that do not need to be synchronized. In the embodiment of the present application, the filter files may not be scanned, which can reduce the power consumption of the electronic device, effectively reduce the time of scanning files during file synchronization, and improve the efficiency of file synchronization.

[0124] Exemplarily, the file synchronization SDK calls the file synchronization service module, so that the file synchronization service module uses the application programming interface (API) function or method provided by the file synchronization SDK to create a shared directory / shared folder, such as creating a REPO directory.

[0125] S103: The file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0126] Data persistence refers to the long-term storage of data on a persistent storage medium so that the data can still be accessed after the application or operating system is restarted.

[0127] In the embodiment of the present application, the REPO directory can be stored in a local database of the mobile phone that can be persisted. In this way, after the user sets the file synchronization function, even if the mobile phone is restarted or the trusted ring application is restarted, the relevant information of the file synchronization function set by the user can be read from the local database to ensure that the relevant information of the REPO directory will not be lost. For the user, only the relevant information of the file synchronization function needs to be set once, and it can be used all the time, without having to reset the relevant information of the file synchronization function every time the mobile phone is restarted or the trusted ring application is restarted, which improves the user experience.

[0128] The above steps S101 to S103 describe a scenario in which an electronic device (such as a mobile phone) creates a shared directory / shared folder, such as a REPO directory, when a file synchronization request is obtained. In one possible implementation, the electronic device (such as a mobile phone) may also pre-create a shared directory / shared folder, such as a REPO directory, that is, the electronic device (such as a mobile phone) creates a REPO directory before obtaining a file synchronization request. For example, the trust ring application calls the file synchronization SDK, the file synchronization SDK calls the file synchronization service module to create a REPO directory, and the file synchronization service module performs data persistence processing on the REPO directory.

[0129] This method of creating a REPO directory in an electronic device in advance is conducive to the electronic devices in the subsequent trust ring directly using the REPO directory for file synchronization, thereby improving the efficiency of file synchronization.

[0130] Optionally, in a possible implementation, the trusted electronic device may create a shared directory / shared folder, such as a REPO directory, by using a method similar to the above steps S101 to S103. Figure 6 As shown, the method specifically includes:

[0131] S201: A trusted ring application in a trusted electronic device obtains a file synchronization request and calls a file synchronization SDK.

[0132] S202: The file synchronization SDK calls the file synchronization service module in the trusted electronic device to create a shared directory / shared folder.

[0133] S203: The file synchronization service module performs data persistence processing on the shared directory / shared folder.

[0134] For the description of steps S201 to S203 , reference may be made to the specific description of steps S101 to S103 above, which will not be repeated here.

[0135] The above steps S201 to S203 describe a scenario in which a trusted electronic device (such as a tablet computer) creates a shared directory / shared folder, such as a REPO directory, when a file synchronization request is obtained. In a possible implementation, the trusted electronic device (such as a tablet computer) may also pre-create a shared directory / shared folder, such as a REPO directory, that is, the trusted electronic device (such as a tablet computer) creates a REPO directory before obtaining a file synchronization request.

[0136] This method of creating a REPO directory in a trusted electronic device in advance is conducive to the subsequent electronic devices in the trust ring directly using the REPO directory for file synchronization, thereby improving the efficiency of file synchronization.

[0137] S104. Share the REPO directory with trusted electronic devices.

[0138] Exemplarily, the electronic device (such as a mobile phone) determines the files to be synchronized according to the file synchronization request, scans the file path in the electronic device (such as a mobile phone) based on the files to be synchronized, and records the file synchronization version for each scanning result.

[0139] For example, the file path in the electronic device (such as a mobile phone) is scanned for the first time based on the file to be synchronized, and the file synchronization version 1.0 is recorded as the first scanning result; the file path in the electronic device (such as a mobile phone) is scanned for the second time based on the file to be synchronized, and it is detected that the file to be synchronized has changed compared with the first time, and the file synchronization version 1.1 is recorded as the second scanning result; the file path in the electronic device (such as a mobile phone) is scanned for the third time based on the file to be synchronized, and it is detected that the file to be synchronized has not changed compared with the second time, and the file synchronization version 1.1 is recorded as the third scanning result, and so on.

[0140] The electronic device (such as a mobile phone) shares each recorded file synchronization version with a trusted electronic device (such as a tablet). For example, the electronic device (such as a mobile phone) records each recorded file synchronization version in a REPO directory and shares it with a trusted electronic device (such as a tablet). The trusted electronic device (such as a tablet) can read the file synchronization version changes from the REPO directory, thereby quickly determining the changes in the synchronized files.

[0141] S105. Synchronize REPO directory metadata with the trusted electronic device.

[0142] Metadata is used to describe data attributes. REPO directory metadata refers to the file path, scan start time, scan time interval, REPO identification information, electronic device name, file synchronization configuration information, etc. included in the REPO directory.

[0143] REPO directory metadata synchronization can be understood as the water level synchronization of electronic devices (such as mobile phones) and trusted electronic devices (such as tablet computers) based on the REPO directory. For example, electronic devices (such as mobile phones) synchronize the file path, scan start time, scan time interval, REPO identification information, electronic device name, file synchronization configuration information and other information included in the REPO directory with trusted electronic devices (such as tablet computers), which provides a guarantee for the consistency and integrity of subsequent files in different electronic devices and different operating systems.

[0144] S106: The file synchronization service module monitors the file system.

[0145] The file synchronization service module may include a monitoring and scanning management module, which is used to monitor and scan the file system in the electronic device (such as a mobile phone).

[0146] Exemplarily, the mobile phone determines the file to be synchronized according to the file synchronization request, and monitors and scans the file path of the file to be synchronized in the file system. For example, if the user wants to synchronize pictures on the mobile phone to the tablet computer, the path corresponding to the gallery on the mobile phone is monitored and scanned.

[0147] When changes are detected in the files to be synchronized, such as addition, deletion, modification, etc., the changes are notified to the file synchronization service module.

[0148] For example, if the file to be synchronized is a picture, any change in the picture in any application related to the picture will affect the file to be synchronized. For example, if a picture is added, deleted, or modified in a camera application, a social application, or a sharing application, the corresponding change will be notified to the file synchronization service module.

[0149] The file synchronization service module generates a file change record according to the changes in the file, and performs data persistence processing on the file change record. Among them, the file change record may include operations such as adding, deleting, and modifying the file, as well as the operation time corresponding to each operation.

[0150] Exemplarily, the file change record is stored in a local database of the mobile phone that can be persisted, so that even if the mobile phone is restarted, or the trusted ring application is restarted, or any application related to the file to be synchronized is restarted, the file change record can be read from the local database.

[0151] S107: The file synchronization service module reads the file change record from the local database.

[0152] Exemplarily, the file synchronization service module periodically reads the file change record from the local database according to the file synchronization period set by the user. For example, each time the electronic device monitors and scans the file system, the file synchronization service module reads the file change record from the local database.

[0153] S108: Synchronize file metadata with the trusted electronic device.

[0154] File metadata refers to information such as the file name, the electronic device it belongs to, file size, file addition time, file deletion time, and file modification time.

[0155] File metadata synchronization can be understood as an electronic device (such as a mobile phone) synchronizing file metadata with a trusted electronic device (such as a tablet). In this implementation, the file metadata is first synchronized with the trusted electronic device, and the file content can be synchronized directly afterwards, which improves the efficiency of file synchronization and is less prone to errors.

[0156] It should be understood that the electronic device and the trusted electronic device perform file metadata synchronization processing. After the electronic device sends the file metadata to the trusted electronic device, the trusted electronic device needs to compare the file metadata sent by the electronic device with its own file metadata. Figure 6 As shown, the comparison method specifically includes:

[0157] S204: The trusted electronic device performs file metadata comparison processing.

[0158] Comparison Processing is a data analysis technique used to identify differences and similarities between file metadata sent by an electronic device and file metadata of a trusted electronic device.

[0159] For example, the tablet computer uses the file synchronization service module to compare the file metadata in its own file system with the file metadata sent by the mobile phone one by one. If the comparison results are consistent, the file metadata recorded in the tablet computer is maintained; if the comparison results are inconsistent, the file metadata sent by the mobile phone is used as the standard, that is, the file metadata in the tablet computer is modified to the file metadata sent by the mobile phone.

[0160] In this implementation, the file metadata in the electronic device is first synchronized with the file metadata in the trusted electronic device, and the file content can be directly synchronized subsequently, which improves the efficiency of file synchronization and is less prone to errors.

[0161] Optionally, in a possible implementation, after the trusted electronic device performs the file metadata comparison process, the file metadata sent by the electronic device is subjected to data persistence processing, for example, the modified file metadata is stored in a local database.

[0162] S109: Synchronize the file content with the trusted electronic device.

[0163] The file content refers to the file itself. For example, if the file to be synchronized is a picture, the file content is the picture itself; if the file to be synchronized is music, the file content is the audio itself.

[0164] Exemplarily, the file synchronization service module in the electronic device reads the file content from the file system and sends the read file content to the trusted electronic device. Accordingly, the trusted electronic device needs to save the file content sent by the electronic device. Figure 6 As shown, the saving method specifically includes:

[0165] S205: The trusted electronic device writes the file content to a disk.

[0166] File dropping usually refers to writing data from a temporary storage area to a permanent storage device. In an embodiment of the present application, the trusted electronic device saves the file content sent by the electronic device to a local database of the trusted electronic device. Optionally, in a possible implementation, the trusted electronic device saves the file content sent by the electronic device to a file system, and then saves the file content in the file system to a local database. In this way, even if the trusted electronic device is restarted, or the trusted ring application is restarted, it will not affect the synchronized files, and the synchronized files can still be read from the local database.

[0167] It is worth noting that the above description of the specific process of file synchronization between electronic devices in the trust ring is based on the example of synchronizing files in a mobile phone to a tablet computer, so the description is mainly based on the method performed on the mobile phone side. It is understandable that when it is necessary to synchronize files in a tablet computer to a mobile phone, the tablet computer can execute the steps executed by the mobile phone, and the mobile phone can execute the steps executed by the tablet computer.

[0168] It is understandable that in the embodiments of the present application, although the Android operating system is used as an example for description, its basic principles are also applicable to electronic devices based on operating systems such as IOS, Symbian, Black Berry, Linux, and Windows.

[0169] In an embodiment of the present application, the file synchronization SDK integrated in the trust ring application configures the file synchronization capability for the trust ring application, and the file synchronization service module provides core services for file synchronization between electronic devices in the trust ring. Exemplarily, the file synchronization service module completes the perception of file changes and the generation of file metadata by monitoring and scanning the local file system. At the same time, the trust ring self-discovery and self-organizing networking capabilities provided by the system enable electronic devices to quickly discover surrounding devices, realize REPO directory sharing, REPO metadata synchronization, file metadata synchronization, and file content synchronization between electronic devices and trusted electronic devices in the trust ring, realize cross-device and cross-system data storage and access, and open up data access channels for near-field communication between electronic devices.

[0170] In the related art, when electronic devices in a trust ring synchronize files, the synchronized files are not verified, which may cause the synchronized files to be inconsistent with the source files, affecting the integrity of file synchronization. If the synchronized files are tampered with, it will also bring security risks to the electronic devices in the trust ring, making the entire file synchronization process unsafe and prone to errors.

[0171] For example, pictures in a trusted electronic device are synchronized to an electronic device. Considering that the electronic device and the trusted electronic device are in the same trust ring, the default file synchronization environment is safe and trustworthy, so the synchronized pictures are not verified. The trusted electronic device directly sends the picture to the electronic device, and the electronic device stores the picture in the file system after receiving it. This may cause the picture after the electronic device is synchronized to be inconsistent with the picture in the trusted electronic device, affecting the integrity of the file synchronization. If the synchronized picture is tampered with, the system of the electronic device and the trusted electronic device may be attacked by malware or viruses. If an error occurs in the synchronization process, the synchronized picture may also be damaged or lost. It can be seen that the file synchronization process in the related art is not safe and is very error-prone.

[0172] In view of this, an embodiment of the present application provides a file synchronization method, which is applied to an electronic device, and the trust ring in which the electronic device is located also includes at least one trusted electronic device. The method includes: obtaining a file to be synchronized sent by at least one trusted electronic device; generating a temporary synchronization file based on the file to be synchronized; verifying the temporary synchronization file; when the temporary synchronization file passes the verification, synchronizing the temporary synchronization file to the file system.

[0173] In this implementation, when the file to be synchronized sent by the trusted electronic device is obtained, the file to be synchronized is not directly stored in the file system, but a temporary synchronization file is generated based on the file to be synchronized, and the temporary synchronization file is verified. When the temporary synchronization file passes the verification, the temporary synchronization file is synchronized to the file system. Since the temporary synchronization file is verified, it can ensure that the file received by the electronic device is consistent with the source file, ensure the integrity of the file synchronization, and improve the accuracy of the file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with, avoid the system of the electronic device in the trust ring from being attacked by malware or viruses, and improve the security of the file synchronization process.

[0174] The file synchronization method provided in the embodiment of the present application is described below in conjunction with the flow chart.

[0175] See also Figure 7 , Figure 7 The following is a flowchart of a file synchronization method according to an embodiment of the present application. The method includes:

[0176] S301: Obtain a file to be synchronized sent by at least one trusted electronic device.

[0177] Two or more electronic devices establish a trust relationship through trusted authentication to form a trust ring. In the embodiment of the present application, the trust ring where the electronic device is located also includes at least one trusted electronic device, and the files in the electronic device can be synchronized to the trusted electronic device in the trust ring.

[0178] In one example, a trusted electronic device triggers a file synchronization request, which is used to instruct the trusted electronic device to send a file to be synchronized (i.e., a file to be synchronized) to the electronic device, and the electronic device receives the file to be synchronized sent by the trusted electronic device. For example, a user wants to synchronize pictures on a trusted electronic device (such as a mobile phone) to an electronic device (such as a tablet computer). After selecting a picture in the gallery through the Trust Ring application installed on the mobile phone, the "Start Synchronization" option is selected to trigger a file synchronization request. The mobile phone sends the selected picture to the tablet computer, and the tablet computer receives the picture sent by the mobile phone. Among them, the picture is the file to be synchronized.

[0179] In another example, the electronic device triggers a file synchronization request, which is used to request the trusted electronic device to send the file to be synchronized to the electronic device, and the electronic device receives the file to be synchronized sent by the trusted electronic device. For example, a user wants to synchronize pictures on a trusted electronic device (such as a mobile phone) to an electronic device (such as a tablet computer), and the tablet computer initiates a file synchronization request to the mobile phone, and the file synchronization request carries indication information of the pictures to be synchronized. The mobile phone receives the file synchronization request and sends the pictures to the tablet computer according to the indication information of the pictures, and the tablet computer receives the pictures sent by the mobile phone.

[0180] It is understandable that when the user selects a picture in the gallery, the user may also specify a storage location in the tablet computer to store the picture.

[0181] Optionally, in a possible implementation, a file synchronization request can be automatically triggered by a trusted electronic device. For example, the user sets the file to be automatically synchronized every other day, or every seven days, etc. Then, after the first synchronization of files, the mobile phone automatically triggers a file synchronization request every other day. For another example, the user sets the time to start automatic file synchronization after reaching a preset time point (such as 8 o'clock, 12 o'clock, 23 o'clock, etc.), then, when the mobile phone detects that the current time has reached the preset time point, it automatically triggers a file synchronization request. This is only an exemplary description and is not limited to this.

[0182] Optionally, in another possible implementation, the electronic device within the trust ring may also automatically trigger a file synchronization request, and send the file synchronization request to the trusted electronic device after each trigger. Please refer to the relevant description of the electronic device, which will not be repeated here.

[0183] S302: Generate a temporary synchronization file according to the file to be synchronized.

[0184] The file to be synchronized is the file you want to synchronize. In the embodiment of the present application, the file to be synchronized can be a file sent by a trusted electronic device to an electronic device for synchronization. For example, if a user wants to synchronize a picture on a trusted electronic device (such as a mobile phone) to an electronic device (such as a tablet), then the picture sent by the mobile phone to the tablet is the file to be synchronized.

[0185] In a possible implementation, a temporary synchronization file is directly generated based on the file to be synchronized. Exemplarily, a full synchronization method is adopted to generate a temporary synchronization file based on the file to be synchronized. For example, a temporary storage location is created, all the files to be synchronized are copied to the temporary storage location, and the files to be synchronized stored in the temporary storage location are determined as temporary synchronization files. The temporary storage location may include a REPO directory.

[0186] In another possible implementation, a local file corresponding to the file to be synchronized is obtained in the file system of the electronic device, and a temporary synchronization file is generated according to the local file and the file to be synchronized.

[0187] A local file refers to a file stored in a designated storage location of an electronic device before synchronizing the file to be synchronized. The designated storage location is used to store the file to be synchronized. It can be understood that the storage location of the local file in the electronic device is consistent with the storage location of the file to be synchronized in the electronic device.

[0188] For example, when a user selects a file to be synchronized (such as a picture in a gallery) on a mobile phone, the user specifies that the storage location for storing the picture in the tablet computer is drive D. Before synchronizing the file to be synchronized, the file stored in drive D is a local file.

[0189] S303: Verify temporary synchronization files.

[0190] Exemplarily, verifying the temporary synchronization file may include verifying the integrity of the temporary synchronization file, the consistency between the temporary synchronization file and the source file, whether the function of the temporary synchronization file is normal, etc.

[0191] Among them, verifying the integrity of the temporary synchronization file and verifying the consistency of the temporary synchronization file with the source file can ensure that the file to be synchronized is not damaged or changed during the transmission process, which can improve the security of the file synchronization process.

[0192] In an embodiment of the present application, the integrity of the temporary synchronization file and the consistency of the temporary synchronization file with the source file can be verified by hash verification, file checksum, digital signature, file content comparison, etc.

[0193] In the embodiment of the present application, hash verification is used as an example for explanation. For example, the source file corresponding to the temporary synchronization file is obtained, the hash value of the temporary synchronization file and the hash value of the source file are calculated, and the hash value of the temporary synchronization file is compared with the hash value of the source file to see if they are consistent. When the hash value of the temporary synchronization file is consistent with the hash value of the source file, it is determined that the temporary synchronization file is complete, that is, there is no problem with the integrity of the temporary synchronization file, and at the same time, the consistency of the temporary synchronization file and the source file is determined.

[0194] Exemplarily, the hash values ​​of the temporary synchronization file and the source file may be calculated by using an MD5 (Message Digest Algorithm 5) algorithm, a SHA-1 (Secure Hash Algorithm 1) algorithm, a SHA-2 (Secure Hash Algorithm 2) algorithm, or the like.

[0195] Optionally, the integrity of the temporary synchronization file may also be verified by a verification tool (such as md5sum, sha1sum, sha256sum, etc.).

[0196] File checksum is a method similar to hash check. In the embodiment of the present application, the checksum of the temporary synchronization file can be calculated by a command line tool such as (cksum command), and the integrity of the temporary synchronization file and the consistency of the temporary synchronization file with the source file can be verified by the checksum.

[0197] Optionally, when the temporary synchronization file is a compressed file, the integrity of the compressed file can be verified using a decompression tool corresponding to the compression tool. It is understandable that the decompression work will verify the file during decompression, and if the temporary synchronization file is damaged or incomplete, the decompression process will fail.

[0198] Optionally, when the temporary synchronization file is a text file or a data file, the file content can be directly compared to check whether the content of the source file and the temporary synchronization file are exactly the same. For example, a script (such as a Python script, a PowerShell script) is used to automatically check whether the file list and number in the temporary synchronization file are consistent with the file list and number in the source file. When the file list and number in the temporary synchronization file are consistent with the file list and number in the source file, it is determined that there is no problem with the integrity of the temporary synchronization file, and at the same time, the consistency of the temporary synchronization file and the source file is verified.

[0199] Optionally, when the temporary synchronization file is a binary file, a file comparison tool (such as a diff tool) may be used to compare the file contents to check whether the contents of the source file and the temporary synchronization file are exactly the same.

[0200] Verifying whether the function of the temporary synchronization file is normal can ensure that the temporary synchronization file can still work normally after synchronization, thereby improving the stability of file synchronization. Exemplarily, when the temporary synchronization file is an executable file or an application file, the temporary synchronization file is functionally tested. For example, the temporary synchronization file is run and the output result of the run is checked; the temporary synchronization file is opened to check whether the file content is displayed correctly, etc.

[0201] S304: When the temporary synchronization file passes verification, the temporary synchronization file is synchronized to the file system.

[0202] Exemplarily, when the temporary synchronization file passes verification, a preset copy command or copy tool is used to copy the temporary synchronization file to a storage location specified in the file system.

[0203] In this implementation, the temporary synchronization file is copied to the storage location specified in the file system. The temporary synchronization file can also be temporarily stored in the temporary storage location. When a write error or system failure occurs in the specified storage location, the temporary synchronization file in the temporary storage location can be used as a backup file to restore the file when needed. If errors are found during the file synchronization process, the temporary synchronization file in the temporary storage location can be used to verify and correct these errors to ensure that the final synchronized file is accurate.

[0204] Optionally, when the temporary synchronization file passes verification, a preset move command or move tool is used to move the temporary synchronization file to a storage location specified in the file system.

[0205] In this implementation, the temporary synchronization file is moved to the specified storage location in the file system, and the temporary storage space is released in time, which facilitates the system to continue to perform other file synchronization tasks or store new files, thereby improving the efficiency of file synchronization.

[0206] The file synchronization method provided in the embodiment of the present application does not directly store the file to be synchronized in the file system when the file to be synchronized sent by the trusted electronic device is obtained, but generates a temporary synchronization file based on the file to be synchronized, verifies the temporary synchronization file, and synchronizes the temporary synchronization file to the file system when the temporary synchronization file passes the verification. Since the temporary synchronization file is verified, it can be ensured that the file received by the electronic device is consistent with the source file, the integrity and consistency of the file synchronization are guaranteed, the final synchronized file is accurate, and the accuracy of the file synchronization is improved. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively preventing the system of the electronic device in the trust ring from being attacked by malware or viruses, and improving the security of the file synchronization process.

[0207] Optionally, in a possible implementation, the step S302 of generating a temporary synchronization file according to the local file and the file to be synchronized may further include: performing incremental synchronization on the local file and the file to be synchronized to generate a temporary synchronization file.

[0208] Exemplarily, by comparing the differences between the local file and the file to be synchronized, the file that has changed since the last synchronization is determined, a temporary synchronization file is generated according to the changed file, and the temporary synchronization file is stored in a temporary storage location. Alternatively, the changed file is moved or copied to a temporary storage location, and the changed file is recorded as a temporary synchronization file. Afterwards, the temporary synchronization file is moved or copied from the temporary storage location to a storage location specified in the file system to complete the synchronization.

[0209] For example, obtain the data blocks corresponding to the local file and the data blocks corresponding to the file to be synchronized. Compare the data blocks of the local file and the data blocks of the file to be synchronized one by one to see where they are different. The different data blocks are the data blocks corresponding to the changed files. Generate data blocks corresponding to the temporary synchronization file based on the different data blocks, and store the data blocks corresponding to the temporary synchronization file in a temporary storage location. Afterwards, move or copy the data blocks of the temporary synchronization file from the temporary storage location to the storage location specified in the file system to complete the synchronization.

[0210] Optionally, in order to increase the speed of comparing local files with files to be synchronized, thereby increasing the speed of generating temporary synchronization files and further increasing the efficiency of file synchronization, local metadata of local files and metadata of files to be synchronized may be compared.

[0211] Exemplarily, obtain the local metadata of the local file and the source metadata of the file to be synchronized. Compare the differences between the local metadata and the source metadata one by one. Among them, the local metadata is used to describe the name of the local file, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read and write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file belongs to a hidden file, or a system file, or a read-only file, etc.), file system information, file version, file extension attributes (such as custom tags), relative paths, etc. It should be understood that the source metadata is similar to the local metadata, the difference is that the source metadata is used to describe the files to be synchronized, and the local metadata is used to describe local files.

[0212] For easier understanding, see Figure 8 , Figure 8 A schematic diagram of incremental synchronization shown in an embodiment of the present application.

[0213] like Figure 8 As shown, the source metadata includes data block 1, data block 2, data block 3, data block 4, data block 5, and data block 6; the new file includes data block 1, data block 2, changed data block 1, data block 3, changed data block 2, data block 5, and changed data block 6; and the local metadata includes data block 1, data block 2, data block 3, data block 4, and data block 5.

[0214] Exemplarily, the first data block of the local metadata and the source metadata are compared first, that is, data block 1 of the local metadata and data block 1 of the source metadata are compared, and the comparison result is that data block 1 of the local metadata is consistent with data block 1 of the source metadata. In other words, the file indicated by data block 1 of the source metadata has not changed compared with the file indicated by data block 1 of the local metadata.

[0215] Compare the other data blocks of local metadata and source metadata in turn. Data block 2 of source metadata is consistent with data block 2 of local metadata. Data block 3 of source metadata is compared with data block 3 of local metadata. Data block 3 of source metadata is added before data block 3 of local metadata. Figure 8 The changed data block 1 in the new file shown, correspondingly, the position of the data block 3 of the source metadata is shifted backwards, Figure 8 The data 3 shown in FIG. 3 is the data block 3 of the local metadata after the offset. Compared with the data block 4 of the local metadata, the data block 4 of the source metadata is deleted, and the data block 4 of the local metadata is added. Figure 8 The changed data block 2 in the new file is shown. Compared with the data block 5 of the local metadata, the data block 5 of the source metadata is shifted backwards due to the addition of the changed data block 2. Figure 8 The data 5 shown in the figure is the data block 5 of the local metadata after the offset. Compared with the local metadata, the source metadata also adds the following Figure 8 The changed data block 3 in the new file is shown.

[0216] like Figure 8 As shown, the new file shows the differences between the source metadata and the local metadata, which is equivalent to determining the files that have changed since the last synchronization. A temporary synchronization file can be generated based on the changed files and stored in a temporary storage location to facilitate subsequent synchronization of the temporary synchronization file to the file system of the electronic device.

[0217] This method of using incremental synchronization to complete multi-terminal synchronization of files can effectively reduce the amount of data transferred by files and save bandwidth. And because the amount of data transferred is reduced, the file synchronization process is accelerated, improving the overall data synchronization efficiency. At the same time, since the electronic device only needs to process the files that have changed, the load during the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0218] Optionally, in one possible implementation, Figure 8 The corresponding embodiments can also be implemented in a trusted electronic device. For example, the trusted electronic device compares the metadata of the current file, i.e., the source metadata, with the metadata corresponding to the file at the last synchronization, and can determine the files that have changed in the trusted electronic device since the last synchronization through the differences between the two. The files to be synchronized can be generated based on the changed files, so that the files to be synchronized can be sent to the electronic device later, thereby achieving file synchronization.

[0219] It is worth noting that, whether in the implementation scenario of an electronic device or in the implementation scenario of a trusted electronic device, when comparing the source metadata and the local metadata, the local metadata can be used as a reference to traverse each data block in the source metadata in turn to determine whether each data block in the source metadata has a consistent data block in the local metadata, and if not, it is determined to be a changed data block. Alternatively, the source metadata can be used as a reference to traverse each data block in the local metadata in turn to determine whether each data block in the local metadata has a consistent data block in the source metadata, and if not, it is determined to be a changed data block.

[0220] Optionally, in a possible implementation, the above step S303 may also include step S3031 and step S3033, as follows.

[0221] See also Fig. 9 , Fig. 9 This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0222] S3031. Obtain source metadata sent by at least one trusted electronic device.

[0223] The source-side metadata is used to describe the name of the file to be synchronized, file size, file creation time, file last modification time, file last access time, file type, file permissions (such as read-write permissions, write permissions, execute permissions, etc.), file owner, file attribute flags (such as specific flags used to indicate that the file is a hidden file, a system file, or a read-only file, etc.), file system information, file version, file extended attributes (such as custom tags), relative path, etc.

[0224] In one example, the electronic device or the trusted electronic device triggers a file synchronization request, the trusted electronic device carries source metadata in the file to be synchronized sent to the electronic device, and the electronic device extracts the source metadata from the file to be synchronized.

[0225] In another example, the electronic device sends a metadata acquisition request to the trusted electronic device, where the metadata acquisition request is used to trigger the trusted electronic device to send source metadata to the electronic device, and the electronic device receives the source metadata sent by the trusted electronic device.

[0226] S3032. Generate a check value corresponding to the temporary synchronization file and a check value corresponding to the source metadata.

[0227] The check value of the temporary synchronization file and the check value of the source metadata may include a weak hash value, a strong hash value, a checksum, a hash-based message authentication code (Hash-based Message Authentication Code, HMAC), etc.

[0228] Exemplarily, the hash value corresponding to the temporary synchronization file and the hash value corresponding to the source metadata can be calculated by using the MD5 (Message Digest Algorithm 5) algorithm, the SHA-1 (Secure Hash Algorithm 1) algorithm, the SHA-2 (Secure Hash Algorithm 2) algorithm, etc.

[0229] Among them, the MD5 algorithm and the SHA-1 algorithm can be used to calculate the weak hash value corresponding to the temporary synchronization file and the weak hash value corresponding to the source metadata.

[0230] In an embodiment of the present application, the check value of the metadata of the temporary synchronization file can be used to represent the check value of the temporary synchronization file. Exemplarily, the metadata of the temporary synchronization file is obtained, and the hash function corresponding to the MD5 algorithm is determined. The metadata of the temporary synchronization file is input into the hash function, and the hash function processes the metadata of the temporary synchronization file and outputs a weak hash value of a fixed length. Similarly, the source metadata is input into the hash function, and the hash function processes the source metadata and outputs a weak hash value of a fixed length.

[0231] In this implementation, since the weak hash value calculation is simple and efficient, it can improve the efficiency of file synchronization and enhance the user experience while ensuring the security of the file synchronization process.

[0232] Optionally, a verification tool (such as md5sum, sha1sum, sha256sum, etc.) may be used to generate a verification value corresponding to the temporary synchronization file and a verification value corresponding to the source-end metadata.

[0233] S3033: When it is detected that the verification value of the temporary synchronization file is consistent with the verification value of the source metadata, it is determined that the temporary synchronization file has passed the verification.

[0234] Exemplarily, when it is detected that the check value of the temporary synchronization file is consistent with the check value of the source metadata, it means that the temporary synchronization file to be synchronized by the electronic device is consistent with the source file in the trusted electronic device. It can be generally understood that when the check value of the temporary synchronization file is consistent with the check value of the source metadata, there is no problem with the file to be synchronized sent by the trusted electronic device to the electronic device, and the electronic device synchronizes based on the temporary synchronization file, and the final synchronized file is accurate.

[0235] After confirming that the temporary synchronization file has passed verification, the temporary synchronization file can be moved or copied to a specified storage location in the file system.

[0236] Optionally, when it is detected that the verification value of the temporary synchronization file is inconsistent with the verification value of the source metadata, it means that the temporary synchronization file to be synchronized by the electronic device is inconsistent with the source file in the trusted electronic device. Continuing the file synchronization may affect the accuracy of the file synchronization result, so the file synchronization is not performed.

[0237] This implementation is equivalent to performing a consistency check on the temporary synchronization file and the source file. When the temporary synchronization file and the source file are consistent, the file is synchronized again, which can make the final synchronized file accurate and improve the accuracy of file synchronization. Verifying the temporary synchronization file can also ensure that the synchronized file is not tampered with and the synchronization process is not prone to errors, effectively preventing the system of the electronic device in the trust ring from being attacked by malware or viruses, and improving the security of the file synchronization process.

[0238] Optionally, in a possible implementation, the above step S304 may also include steps S3041 to S3043, as follows.

[0239] See also Fig.10 , Fig.10 The following is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0240] S3041. Delete the local file corresponding to the temporary synchronization file in the file system.

[0241] S3042. Modify the file name of the temporary synchronization file.

[0242] S3043. Store the temporary synchronization file with the modified file name in the file system.

[0243] For example, if the temporary synchronization file is generated based on the difference between the local file and the file to be synchronized, that is, the temporary synchronization file is generated based on the file that has changed since the last synchronization, then the temporary synchronization file is stored in the specified storage location in the file system by incremental synchronization, that is, based on the local file, the changed file is stored in the specified storage location. Figure 8 On the basis of the local metadata shown, newly added changed data blocks 1, 2 and 3 are added to the corresponding storage locations of the local metadata, and data block 4 in the local metadata is deleted to obtain a synchronized new file.

[0244] This method of using incremental synchronization to complete multi-terminal synchronization of files can effectively reduce the amount of data transferred by files and save bandwidth. And because the amount of data transferred is reduced, the file synchronization process is accelerated, improving the overall data synchronization efficiency. At the same time, since the electronic device only needs to process the files that have changed, the load during the file synchronization process is effectively reduced, and the power consumption of the electronic device is reduced.

[0245] If the temporary synchronization file includes changed files and local files, that is, the temporary synchronization file is already a synchronized file, the local file corresponding to the temporary synchronization file is deleted in the file system. The file name of the temporary synchronization file is changed to a file name different from the local file name, so that users can easily distinguish the synchronized files by the file name.

[0246] Optionally, the file name of the temporary synchronization file can be modified to be consistent with the local file name, that is, the modified file name of the temporary synchronization file is consistent with the file name of the local file. This can better ensure the consistency before and after file synchronization, and facilitate users and file systems to identify and process synchronized files.

[0247] Afterwards, the temporary synchronization file with the modified file name is copied or moved from the temporary storage location to the storage location specified in the file system to achieve file synchronization.

[0248] In this implementation, the local file is deleted first, and then the file name of the temporary synchronization file is modified. This can avoid file name conflicts, reduce errors caused by inconsistent file names or file versions, and help ensure the integrity and consistency of file synchronization.

[0249] Optionally, in a possible implementation, the file synchronization method provided in the embodiment of the present application may further include steps S401 to S405 before obtaining the file to be synchronized sent by at least one trusted electronic device, as follows.

[0250] See also Fig.11 , Fig.11 The following is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0251] S401: Obtain local metadata.

[0252] The file synchronization service module in the electronic device may include a REPO management module and a file synchronization management module, wherein the REPO management module may include a REPO directory, and the REPO management module may be used to manage the REPO directory.

[0253] Exemplarily, for a local file, there is a local metadata corresponding to the local file in the file system, and the file synchronization management module obtains the local metadata from the file system of the electronic device.

[0254] The file synchronization management module detects whether the local metadata matches the local file. For example, it detects whether the file name, file size, file creation time, file last modification time, file last access time, file type, file permission, file owner, file attribute flag, file system information, file version, file extended attribute, relative path and other information in the local metadata are consistent with the file name, file size, file creation time, file last modification time, file last access time, file type, file permission, file owner, file attribute flag, file system information, file version, file extended attribute, relative path and other information of the local file.

[0255] If they are inconsistent, it means that the local file has changed in the electronic device, or that there is a problem with the local file. Continuing to synchronize the file will affect the accuracy of the file synchronization result. Therefore, the file synchronization management module notifies the REPO management module that the file synchronization has failed.

[0256] If they are consistent, it means that the local file has not changed in the electronic device, or that there is no problem with the local file, and then step S402 is continued.

[0257] In this implementation, the local metadata and the local file are first verified, and when the local metadata and the local file match, the subsequent file synchronization process is executed, which can ensure the accuracy of the subsequent file synchronization results.

[0258] S402: When it is detected that the local metadata matches the local file, compare the local metadata with the source metadata to see if they are consistent.

[0259] The file synchronization management module compares the local metadata with the source metadata to see if they are consistent. In essence, it compares the data blocks of the local metadata with the data blocks of the source metadata to see if they are consistent. Figure 8 The description in the corresponding embodiments will not be repeated here.

[0260] When the local metadata is consistent with the source metadata, step S403 is executed; when the local metadata is inconsistent with the source metadata, step S404 is executed.

[0261] S403: When the local metadata is consistent with the source metadata, update the local file.

[0262] Exemplarily, when the local metadata is consistent with the source metadata, it means that the file to be synchronized has not changed compared with the local file, that is, it has not changed since the last time the trusted electronic device synchronized the file with the electronic device. At this time, no operation can be performed on the local file, or the attributes of the local file can be updated. For example, the file synchronization management module sends the synchronization time, the last access time of the file, etc. to the file system, and the file system updates the synchronization time, the last access time of the local file, etc.

[0263] Exemplarily, when the local metadata is inconsistent with the source metadata, it means that the file to be synchronized has not changed compared with the local file, that is, the file has changed since the last time the trusted electronic device synchronized the file with the electronic device, and the local file needs to be synchronized. At this time, step S404 can be executed.

[0264] In this implementation, the local metadata and the local files, as well as the local metadata and the source metadata are verified, and the subsequent file synchronization process is executed when the verification passes, which can ensure the accuracy of the subsequent file synchronization results.

[0265] S404: When the local metadata is inconsistent with the source metadata, determine the difference data between the local metadata and the source metadata.

[0266] For example, if the local metadata is inconsistent with the source metadata, the file synchronization management module can determine the difference data blocks between the local metadata data blocks and the source metadata data blocks when comparing the local metadata data blocks with the source metadata data blocks, that is, determine the difference data between the local metadata and the source metadata. Figure 8 The relevant descriptions in the corresponding embodiments are not repeated here.

[0267] S405: Send the difference data to at least one trusted electronic device.

[0268] The difference data is used to trigger at least one trusted electronic device to send the file to be synchronized to the electronic device.

[0269] The file synchronization management module sends the difference data to the file synchronization management module of the trusted electronic device, and the file synchronization management module of the trusted electronic device sends the to-be-synchronized file to the file synchronization management module of the electronic device.

[0270] In this implementation, when it is determined that the local file is different from the source file, the difference data is sent to the trusted electronic device, triggering the trusted electronic device to send the file to be synchronized to the electronic device, thereby providing a guarantee for achieving file synchronization.

[0271] Optionally, in a possible implementation, when the file synchronization management module compares the data block of the local metadata with the data block of the source metadata, when determining the first difference data block, the first difference data block can be sent to the file synchronization management module of the trusted electronic device. The first difference data block refers to the first different data block between the source metadata and the local metadata, and the first difference data block is also used to trigger the trusted electronic device to send the file to be synchronized to the electronic device.

[0272] It should be understood that when the file synchronization management module of the electronic device sends the first difference data block to the file synchronization management module of the trusted electronic device, the first difference data block is carried with it.

[0273] In this implementation, when the first different data block between the source metadata and the local metadata is determined, the first difference data block is sent to the trusted electronic device without comparing all the data, which can significantly reduce computing resources, improve file synchronization efficiency, and save file synchronization time. And only sending the first difference data block can reduce the use of network bandwidth, reduce the load on electronic devices, and improve the overall performance of the system.

[0274] Optionally, in a possible implementation, the file synchronization method provided by the present application may further include: sending source metadata and difference data to at least one trusted electronic device.

[0275] The source metadata is used by at least one trusted electronic device to verify whether the source metadata matches a local file in at least one trusted electronic device; the difference data is used to trigger at least one trusted electronic device to send a file to be synchronized to the electronic device when the source metadata matches a local file in at least one trusted electronic device.

[0276] Exemplarily, the file synchronization management module of the electronic device sends the previously acquired source metadata and the determined difference data or the first difference data block to the file synchronization management module of the trusted electronic device.

[0277] Exemplarily, for a local file of a trusted electronic device, there is also a metadata corresponding to the local file in the file system of the trusted electronic device, and the file synchronization management module of the trusted electronic device obtains the metadata from the file system of the trusted electronic device. The file synchronization management module of the trusted electronic device detects whether the metadata matches the local file of the trusted electronic device. The specific detection method can refer to the similar description in the above step S401, which will not be repeated here.

[0278] When the metadata does not match the local file of the trusted electronic device, it means that the local file has changed in the trusted electronic device, or that there is a problem with the local file. Continuing the file synchronization will affect the accuracy of the file synchronization result. Therefore, the file synchronization management module of the trusted electronic device notifies the file synchronization management module of the electronic device that the file synchronization has failed.

[0279] When the metadata matches the local file of the trusted electronic device, it means that the local file has not changed in the trusted electronic device, or that there is no problem with the local file. Then the file synchronization management module of the trusted electronic device determines the starting point in the file system (such as the beginning of the source file, the position after the last synchronization, etc.), reads the source file block by block from the starting point, and generates a file to be synchronized. The file synchronization management module of the trusted electronic device sends the file to be synchronized to the file synchronization management module of the electronic device, and the file synchronization management module of the electronic device generates a temporary synchronization file based on the file to be synchronized, and then synchronizes based on the temporary synchronization file.

[0280] In this implementation, the source file and metadata of the trusted electronic device are first verified, and the subsequent file synchronization process is executed when there is no problem with the source file, which can ensure the accuracy of the subsequent file synchronization results.

[0281] See also Fig.12 , Fig.12 The following is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0282] S501: A file synchronization management module of an electronic device obtains local metadata.

[0283] S502: The file synchronization management module of the electronic device checks whether the local metadata matches the local file.

[0284] S503: When the file synchronization management module of the electronic device detects that the local metadata does not match the local file, it notifies the REPO management module that the file synchronization fails.

[0285] S504: When the file synchronization management module of the electronic device detects that the local metadata matches the local file, it compares the local metadata with the source metadata to see whether they are consistent.

[0286] S505: When the file synchronization management module of the electronic device detects that the local metadata is consistent with the source metadata, the local file is updated.

[0287] S506: When the file synchronization management module of the electronic device detects that the local metadata is inconsistent with the source metadata, it determines the difference data between the local metadata and the source metadata.

[0288] S507: The file synchronization management module of the electronic device sends the source metadata and the difference data to the file synchronization management module of the trusted electronic device.

[0289] S508: The file synchronization management module of the trusted electronic device obtains metadata from the file system of the trusted electronic device.

[0290] S509: The file synchronization management module of the trusted electronic device verifies whether the source metadata is consistent with the metadata of the local file.

[0291] S510: The file synchronization management module of the trusted electronic device detects that the source metadata and the local file metadata are inconsistent, and the file synchronization management module of the trusted electronic device notifies the file synchronization management module of the electronic device that the file synchronization fails.

[0292] S511: The file synchronization management module of the trusted electronic device detects that the source metadata is consistent with the metadata of the local file, and generates a file to be synchronized based on the file system of the trusted electronic device.

[0293] S512: The file synchronization management module of the trusted electronic device sends the file to be synchronized to the file synchronization management module of the electronic device.

[0294] S513: The file synchronization management module of the electronic device generates a temporary synchronization file based on the file to be synchronized.

[0295] The specific implementation of the above steps S501 to S513 can refer to the relevant descriptions in the previous embodiments, which will not be repeated here.

[0296] See also Fig.13 , Fig.13 This is a flowchart of another file synchronization method according to an embodiment of the present application. The method includes:

[0297] S601: A file synchronization management module of an electronic device generates a check value corresponding to a temporary synchronization file.

[0298] S602: The file synchronization management module of the electronic device checks whether the check value of the temporary synchronization file is consistent with the check value of the source metadata.

[0299] S603: When it is detected that the check value of the temporary synchronization file is consistent with the check value of the source metadata, the local file corresponding to the temporary synchronization file is deleted in the file system.

[0300] S604: Modify the file name of the temporary synchronization file, and store the temporary synchronization file after the file name is modified in the file system.

[0301] S605: The file synchronization management module of the electronic device notifies the REPO management module that the file synchronization is successful.

[0302] The specific implementation of the above steps S601 to S605 can refer to the relevant descriptions in the previous embodiments, which will not be repeated here.

[0303] The file synchronization method provided in the embodiment of the present application is applicable to any scenario requiring file synchronization in near field communication.

[0304] In the process of file synchronization between electronic devices within the trust ring, it is necessary to monitor and scan the files in the electronic devices, or to monitor and scan the file paths / file directories corresponding to the files. When it is necessary to monitor and scan multiple file paths / file directories, even if there is an inclusion relationship between the multiple file paths / file directories, the relevant technology still requires monitoring and scanning each file path / file directory, and each monitoring requires the creation of a corresponding monitoring task, or each monitoring requires the start of a corresponding monitoring thread, resulting in an increase in the number of started monitoring threads and excessive scanning of file paths / file directories, which ultimately leads to low file synchronization efficiency and high power consumption of electronic devices.

[0305] In view of this, an embodiment of the present application also provides a method for processing data, which is applied to an electronic device. The trust ring in which the electronic device is located also includes at least one trusted electronic device. Files in the electronic device can be synchronized to at least one trusted electronic device. The method for processing data includes: obtaining a file synchronization request; determining multiple scanning tasks corresponding to the file synchronization request; determining an associated file path among multiple file paths, and merging the scanning tasks corresponding to the associated file path.

[0306] Among them, the associated file path is a file path with an inclusion relationship; the file path with an inclusion relationship includes at least one child file path and one parent file path, and the scanning result corresponding to the child file path is notified to the scanning task corresponding to the parent file path, that is, the scanning result corresponding to the child file path in the file path with an inclusion relationship will be notified to the parent file path in the file path with an inclusion relationship.

[0307] Optionally, each scanning task corresponds to a file path, and each file path corresponds to a file directory. By scanning the file path, the file pointed to by the file path and the file content of the file can be found.

[0308] Optionally, the scanning task may include monitoring and scanning of a file path.

[0309] In this implementation, after determining the file paths with inclusion relationships, the scanning tasks corresponding to the file paths with inclusion relationships are merged. Since the sub-file paths in the file paths with inclusion relationships have their corresponding scanning results notified to the scanning tasks corresponding to the parent file paths, even if the scanning tasks are merged, it can be ensured that the scanning tasks corresponding to the file paths with inclusion relationships are successfully completed. And since the scanning tasks are merged, in the process of executing the merged scanning tasks, it is possible to avoid multiple scans of the same file path, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0310] Optionally, merging the scanning tasks corresponding to the associated file paths includes: obtaining at least two scanning time intervals corresponding to the associated file paths; merging the at least two scanning tasks corresponding to the associated file paths into a target scanning task, and setting a target scanning time interval of the target scanning task according to the at least two scanning time intervals. The scanning time intervals corresponding to different file paths are different; the target scanning time interval is greater than or equal to the smallest scanning time interval of at least two scanning time intervals, and less than the largest scanning time interval of at least two scanning time intervals. In this implementation, since the scanning tasks are merged, multiple scans of the same file path can be effectively avoided during the execution of the merged scanning tasks, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0311] Optionally, the method for processing data may further include: scanning the file path corresponding to the target scanning task according to the target scanning time interval to obtain a scanned file. The scanned file is used to synchronize to at least one trusted electronic device in the trust ring. In this implementation, other file paths are not considered, and the file path corresponding to the target scanning task is scanned purposefully, which improves the scanning efficiency, thereby speeding up the entire file synchronization process and improving the subsequent file synchronization efficiency.

[0312] Optionally, the method for processing data may further include: obtaining a list to be scanned, scanning each file path in the list to be scanned according to a target scanning time interval, and when any file path in the associated file path is scanned, obtaining a scanning result of any file path; and feeding back the scanning result to a scanning task corresponding to each file path in the associated file path. The list to be scanned includes associated file paths, file paths not associated with scanning tasks, and non-associated file paths associated with scanning tasks. In other words, the list to be scanned includes all file paths.

[0313] In this implementation, when an associated file path is scanned, it can ensure that each scanning task corresponding to the associated file path receives a scanning result notification, which facilitates the subsequent synchronization of the files scanned based on each scanning task to the trusted electronic device, thereby reducing the number of scans and the power consumption of electronic devices while providing a guarantee for the accuracy of file synchronization.

[0314] Optionally, the method for processing data may further include: setting the scanning start time of the target scanning task according to the target scanning time interval; and starting scanning when the current time reaches the scanning start time. In this implementation, the method of setting the scanning start time first and then starting to scan the file path can accurately record the execution time of each scanning operation to avoid scanning errors. And determining the start and end time of each scanning operation helps to reasonably allocate system resources.

[0315] Optionally, feeding back the scan result to the scan task corresponding to each file path in the associated file path includes: adding the scan result to a preset notification list, wherein the notification list is used to feed back the scan result to the scan task corresponding to each file path in the associated file path.

[0316] Optionally, the scan result can be obtained by calling a callback function.

[0317] This implementation method is conducive to the subsequent synchronization of files scanned based on each scanning task to the trusted electronic device, thereby reducing the number of scans and the power consumption of the electronic device while providing a guarantee for the accuracy of file synchronization.

[0318] Optionally, the method for processing data may further include: after scanning each file path in the to-be-scanned list, deleting all scan results in the notification list. In this implementation, all scan results in the notification list are deleted at once, which simplifies the deletion steps and improves the deletion efficiency.

[0319] Optionally, the method for processing data may further include: after scanning any file path in the associated file path, deleting the scan result corresponding to any file path in the notification list. In this implementation, deleting a corresponding scan result after scanning each file path can save storage space, avoid false feedback, and improve the accuracy of file synchronization.

[0320] Optionally, the method for processing data may further include: obtaining a scan cancellation notification, and clearing the scan start time of the target scan task. The scan cancellation notification is used to cancel any scan task corresponding to the associated file path. In this implementation, when the scan cancellation notification is obtained, clearing the relevant information of the scan task can release more system resources, reduce the system processing burden, and improve the system processing speed. At the same time, it promptly responds to the different needs of users in the file synchronization scenario and improves the user experience.

[0321] Optionally, clearing the scan start time of the target scan task includes: determining that there is no inclusion relationship between the other multiple file paths; clearing the scan start time of the target scan task. The other multiple file paths are multiple file paths other than the file path corresponding to any scan task. In this implementation, when it is determined that there is no inclusion relationship between the other multiple file paths, the relevant information of the scan task is cleared to avoid the clearing of the relevant information of the scan task affecting other scan tasks, thereby ensuring that other scan tasks can be successfully completed.

[0322] Optionally, after receiving the scan cancellation notification, the method for processing data may further include: determining that there is an inclusion relationship between other multiple file paths; and merging scan tasks corresponding to other multiple file paths having the inclusion relationship.

[0323] Optionally, determine whether there is an inclusion relationship between multiple other file paths, obtain the scanning time interval corresponding to each of the file paths with the inclusion relationship, merge the scanning tasks corresponding to the file paths with the inclusion relationship into a new target scanning task, and set a new scanning time interval corresponding to the new target scanning task according to the scanning time interval corresponding to each of the file paths with the inclusion relationship.

[0324] The new scanning time interval is greater than or equal to the smallest scanning time interval among the scanning time intervals corresponding to the file paths having the inclusion relationship, and is less than the largest scanning time interval among the scanning time intervals corresponding to the file paths having the inclusion relationship.

[0325] In this implementation, after receiving the scan cancellation notification, the scan tasks corresponding to the remaining file paths with inclusion relationships are merged, so that when executing the merged scan tasks, it is possible to avoid multiple scans of the same file path, thereby effectively reducing the number of scans, that is, reducing the workload of repeated scanning, reducing the power consumption of electronic devices, optimizing resource allocation in the system, speeding up the entire file synchronization process, and improving the efficiency of subsequent file synchronization.

[0326] It is worth noting that the method for processing data provided by the present application can be applied to any scenario where files need to be monitored or scanned. When files are synchronized between electronic devices within a trusted ring, the method for processing data can be applied to electronic devices or to trusted electronic devices.

[0327] In the related art, when files are synchronized between electronic devices within a trusted ring, if at least two different directories in the electronic device need to synchronize the same file from the trusted electronic device, or in other words, the same file in the source device (i.e., the trusted electronic device) needs to be synchronized to different directories in the electronic device. Normally, the trusted electronic device will send the same file to the electronic device at least twice, that is, the trusted electronic device sends the same file to different directories in the electronic device. However, in the process of file synchronization, each time a file is sent across devices, the file needs to be verified. The trusted electronic device sends the same file to the electronic device multiple times, which means that the same file needs to be verified multiple times, resulting in a complex and cumbersome file transfer process. Repeated transmission of the same file will increase the use of network bandwidth and processing time, which will not only affect the synchronization of other files, but also reduce the efficiency of file synchronization. And repeated transmissions will also increase the power consumption of electronic devices and trusted electronic devices, increase the risk of data leakage, and reduce the security of file synchronization.

[0328] In view of this, an embodiment of the present application also provides a file synchronization method, which is applied to an electronic device, and the trust ring in which the electronic device is located also includes at least one trusted electronic device. The method includes: determining that at least two directories in the electronic device synchronize the same file from at least one trusted electronic device; any directory requests to obtain the same file from at least one trusted electronic device; any directory is any one of the at least two directories; any directory sends the obtained same file to other directories, and the other directories are directories of the at least two directories except any one of the directories.

[0329] In this implementation, any directory in the electronic device first obtains the same file to be synchronized from the trusted electronic device, and then sends the same file to other directories in the electronic device. During the entire file synchronization process, for the electronic device and the trusted electronic device, the same file is only transmitted across devices once, and the entire file transfer process is simple and convenient. Due to the small number of file transfers, the use of network bandwidth and processing time are reduced, while reducing the power consumption of the electronic device and the trusted electronic device, the efficiency of file synchronization is also improved. Reducing the number of file transfers can also reduce the risk of data leakage and improve the security of file synchronization.

[0330] Moreover, any directory in an electronic device sends the same file to other directories in the electronic device. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost and is not easily affected by network fluctuations or external interference, which improves the reliability of transmission. Moreover, when performing file operations in the same electronic device, the operating system and file system of the electronic device can better maintain the attributes and permissions of the file and ensure the integrity of the file.

[0331] Optionally, determining that at least two directories in an electronic device synchronize the same file from at least one trusted electronic device includes: obtaining a list of files to be synchronized; comparing the files to be synchronized corresponding to at least two directories; when the files to be synchronized corresponding to at least two directories are consistent, determining that at least two directories synchronize the same file from at least one trusted electronic device. The list of files to be synchronized includes the files to be synchronized corresponding to at least two directories. In this implementation, the files to be synchronized corresponding to at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files finally synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0332] Optionally, comparing the files to be synchronized corresponding to at least two directories respectively includes: obtaining metadata of the files to be synchronized corresponding to the at least two directories; when the metadata of the files to be synchronized corresponding to the at least two directories are consistent, determining that the at least two directories synchronize the same file from at least one trusted electronic device. In this implementation, the metadata of the files to be synchronized corresponding to the at least two directories are verified to ensure that the at least two directories are indeed synchronizing the same file from the trusted electronic device, so that the files finally synchronized to each directory are accurate, thereby improving the accuracy of file synchronization.

[0333] Optionally, any directory requests to obtain the same file from at least one trusted electronic device, including: any directory initiates a file synchronization request to at least one trusted electronic device, the file synchronization request is used to trigger at least one trusted electronic device to send the same file to the electronic device; marking other directories to synchronize the same file with any directory. In this implementation, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after any subsequent directory obtains the same file, it can quickly and accurately send the same file to other marked directories, so that the files finally synchronized to each directory are accurate, and the accuracy of file synchronization is improved.

[0334] Optionally, any directory sends the same acquired file to other directories, including: acquiring the file path of other marked directories; copying the same file to the file path of other marked directories. In this implementation, after any directory in the electronic device acquires the same file to be synchronized, it copies the same file to the file path of other directories according to the file path of other marked directories. Since the files are transferred in the same electronic device, the transmission speed is fast and the risk is low, which improves the efficiency and security of file synchronization. No additional network bandwidth is consumed during the transmission process, which reduces the transmission cost, is not easily affected by network fluctuations or external interference, and improves the reliability of transmission. In addition, when performing file operations in the same electronic device, the operating system and file system of the electronic device can better maintain the attributes and permissions of the file and ensure the integrity of the file.

[0335] Optionally, the trust ring in which the electronic device is located also includes at least two trusted electronic devices, and the same synchronization file is respectively stored in at least two trusted electronic devices. The file synchronization method may also include: obtaining the influencing factor of each trusted electronic device; determining the synchronization source device in at least two trusted electronic devices according to the influencing factor of each trusted electronic device; synchronizing the synchronization file from the synchronization source device. The influencing factor is used to influence the determination of the synchronization source device, that is, the influencing factor is a factor used to influence the decision of which trusted electronic device to use as the synchronization source device. Different synchronization source devices have different file synchronization effects, that is, the influencing factor can be used to affect the file synchronization effect between the electronic device and the trusted electronic device. The influencing factors include at least one of the power status, device type, network status, device performance, current device power consumption, and user preference.

[0336] In this implementation, the influencing factors of each trusted electronic device are taken into consideration, so that the most suitable synchronization source device can be selected from multiple trusted electronic devices, which can ensure more efficient synchronization operations and help maintain the consistency and accuracy of synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0337] Optionally, according to the influencing factors of each trusted electronic device, a synchronization source device is determined in at least two trusted electronic devices, including: calculating a synchronization suitability score for each trusted electronic device according to the influencing factors of each trusted electronic device; determining a synchronization source device in at least two trusted electronic devices according to the synchronization suitability score of each trusted electronic device. In this implementation, the synchronization suitability score is calculated for the trusted electronic device, and the process of determining the synchronization source device for file synchronization according to the synchronization suitability score can select the most suitable synchronization source device from multiple trusted electronic devices, which can ensure that the synchronization operation is more efficient and is conducive to maintaining the consistency and accuracy of the synchronized files. At the same time, it can avoid overload, ensure that device resources are reasonably allocated and optimized, reduce unnecessary resource consumption, reduce file synchronization costs, and enhance the reliability of file synchronization.

[0338] Optionally, at least two trusted electronic devices are of different device types, and according to the influencing factors of each trusted electronic device, a synchronization source device is determined in at least two trusted electronic devices, including: determining the priority of each trusted electronic device according to the influencing factors of each trusted electronic device; and determining the synchronization source device in at least two trusted electronic devices according to the priority of each trusted electronic device. In this implementation, by determining the synchronization source device by determining the priority of the device, resources can be reasonably allocated according to the importance and functions of different devices, and a suitable synchronization source device can be selected, thereby improving the efficiency and accuracy of subsequent file synchronization.

[0339] The file synchronization method provided in the embodiment of the present application is described above in conjunction with the flow chart. The hardware structure of the electronic device involved in the embodiment of the present application is briefly introduced below in conjunction with the accompanying drawings.

[0340] In some embodiments of the present application, the electronic device may be a mobile phone, a tablet computer, a wearable device, a television, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA), etc., or may be other devices or apparatuses capable of performing scene recognition. The embodiments of the present application do not impose any restrictions on the specific type of the electronic device.

[0341] Please refer to Fig.14 , Fig.14 A schematic diagram of the hardware structure of an electronic device shown in an embodiment of the present application.

[0342] like Fig.14 As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0343] It is to be understood that the structure shown in the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include Fig.14 More or fewer components than those shown, or the electronic device 100 may include Fig.14 A combination of some of the components shown, or the electronic device 100 may include Fig.14 Subassemblies of some of the components shown. Fig.14 The components shown may be implemented in hardware, software, or a combination of software and hardware.

[0344] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc.

[0345] It is understandable that the interface connection relationship between the modules shown in this embodiment is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0346] The electronic device 100 can realize the display function through the GPU, the display screen 194 and the application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU can also be used to perform mathematical and posture calculations for graphics rendering, etc. The processor 110 may include one or more GPUs, which can generate or change display information by executing program instructions.

[0347] The display screen 194 can be used to display images or videos, and can also display a series of graphical user interfaces (GUIs), which are the main screens of the electronic device 100. Generally speaking, the size of the display screen 194 of the electronic device 100 is fixed, and only limited controls can be displayed on the display screen 194 of the electronic device 100. A control is a GUI element, which is a software component included in an application program, and controls all data processed by the application program and interactive operations on the data. Users can interact with the control through direct manipulation to read or edit relevant information of the application program. Generally speaking, a control can include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets, etc.

[0348] The display screen 194 in the embodiment of the present application may be a touch screen. A touch sensor 180K may be integrated in the display screen 194. The touch sensor 180K may also be referred to as a "touch panel". In other words, the display screen 194 may include a display panel and a touch panel, and the touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen". The touch sensor 180K is used to detect touch operations acting on or near it. After the touch operation detected by the touch sensor 180K, it can be passed to the upper layer by the driver of the kernel layer (such as the TP driver) to determine the type of touch event. Visual output related to the touch operation can be provided by the display screen 194. In other embodiments, the touch sensor 180K may also be arranged on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0349] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0350] The internal memory 121 can be used to store computer executable program codes, and the executable program codes include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an APP required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc.

[0351] In addition, the internal memory 121 may include a high-speed random access memory; the internal memory 121 may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (Universal Flash Storage, UFS), etc.

[0352] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0353] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback.

[0354] The file synchronization method and the file synchronization method provided in the embodiments of the present application can be implemented in the electronic device 100 having the above-mentioned hardware structure.

[0355] The following describes the file synchronization method provided by this application in conjunction with the software structure. Fig.15 , Fig.15 A schematic diagram of the software structure of an electronic device shown in an embodiment of the present application.

[0356] Exemplarily, the layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In the embodiment of the present application, the electronic device is an Android system as an example for explanation. The Android system is divided into an application (Application, App) layer, an application framework (Framework) layer, and a hardware abstraction layer.

[0357] The application layer may include a series of application packages, such as a trusted ring application. In the embodiment of the present application, a file synchronization SDK is integrated into the trusted ring application, thereby configuring the trusted ring application with the capability of file synchronization.

[0358] Optionally, the application layer may also include a database, which provides functions such as data storage, data modification, data deletion, data addition, and data query for the application.

[0359] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0360] As an example of the present application, the application framework layer includes a file synchronization service module, which may include a REPO management module, a monitoring scanning management module, and a timer. The REPO management module may include a REPO directory, and the REPO management module may be used to manage the REPO directory.

[0361] Optionally, the application framework layer may also include a database.

[0362] Optionally, the database can also interact with the hardware abstraction layer, such as through operating system calls and manage data in the file system.

[0363] Optionally, the hardware abstraction layer may include a file system.

[0364] The trusted ring application, the file synchronization service module, the database and the file system interact with each other to implement the data processing method and the file synchronization method in the above-mentioned method embodiments. For details, please refer to the relevant descriptions in the above-mentioned embodiments, which will not be repeated here.

[0365] The above describes in detail an example of a file synchronization method provided by an embodiment of the present application. It is understandable that, in order to implement the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the units and algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to exceed the scope of the present application.

[0366] The embodiment of the present application can divide the functional modules of the electronic device according to the above method example. For example, each function can be divided into each functional module, or two or more functions can be integrated into one module. The above integrated module can be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiment of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation.

[0367] It should be noted that all relevant contents of each step involved in the above method embodiment can be referred to the functional description of the corresponding functional module and will not be repeated here.

[0368] The electronic device provided in this embodiment is used to execute the above-mentioned file synchronization method, and thus can achieve the same effect as the above-mentioned implementation method.

[0369] In the case of an integrated unit, the electronic device may further include a processing module, a storage module and a communication module. The processing module may be used to control and manage the actions of the electronic device. The storage module may be used to support the electronic device to execute stored program codes and data, etc. The communication module may be used to support the electronic device to communicate with other devices.

[0370] Among them, the processing module can be a processor or a controller. It can implement or execute various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other electronic devices, such as a radio frequency circuit, a Bluetooth chip, a WiFi chip, etc.

[0371] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the processor executes the file synchronization method of any of the above embodiments.

[0372] An embodiment of the present application also provides a device, which may specifically be a chip, component or module, and the device may include a connected processor and memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory so that the chip executes the data processing method and the file synchronization method in the above-mentioned method embodiments.

[0373] The embodiment of the present application also provides a computer program product. When the computer program product is run on a computer, the computer is caused to execute the above-mentioned related steps to implement the file synchronization method in the above-mentioned embodiment.

[0374] The present application also provides a chip. Fig.16 , Fig.16 A schematic diagram of the structure of a chip shown in an embodiment of the present application. Fig.16 The chip shown can be a general-purpose processor or a dedicated processor. The chip includes a processor 210. The processor 210 is used to execute the data processing method and file synchronization method of any of the above embodiments.

[0375] Optionally, the chip further includes a transceiver 220, which is used to accept control of the processor and to support the communication device in executing the technical solution shown above.

[0376] Optional, Fig.16 The chip shown may further include: a storage medium 230 .

[0377] It should be noted that Fig.16 The chip shown can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits that can perform the various functions described throughout this application.

[0378] Among them, the electronic device, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above and will not be repeated here.

[0379] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.

[0380] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0381] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0382] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0383] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.

[0384] The above contents are only specific implementation methods of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A file synchronization method, characterized in that: Applied to an electronic device, the trust ring in which the electronic device is located also includes at least one trusted electronic device, and the method includes: Acquire a file to be synchronized sent by the at least one trusted electronic device; Generate a temporary synchronization file according to the file to be synchronized; Verifying the temporary synchronization file; When the temporary synchronization file passes the verification, the temporary synchronization file is synchronized to the file system.

2. The method according to claim 1, characterized in that The verifying the temporary synchronization file comprises: Acquiring source metadata sent by the at least one trusted electronic device; Generate a check value corresponding to the temporary synchronization file and a check value corresponding to the source end metadata; When it is detected that the check value of the temporary synchronization file is consistent with the check value of the source-end metadata, it is determined that the temporary synchronization file has passed the check.

3. The method according to claim 1 or 2, characterized in that: The step of synchronizing the temporary synchronization file to the file system includes: Deleting the local file corresponding to the temporary synchronization file in the file system; Modify the file name of the temporary synchronization file; The temporary synchronization file with the modified file name is stored in the file system.

4. The method according to claim 3, characterized in that The step of generating a temporary synchronization file according to the file to be synchronized includes: Incrementally synchronize the local file and the file to be synchronized to generate the temporary synchronization file.

5. The method according to claim 3 or 4, characterized in that: Before acquiring the to-be-synchronized file sent by the at least one trusted electronic device, the method further includes: Get local metadata; When it is detected that the local metadata matches the local file, comparing the local metadata with the source-end metadata to see whether they are consistent; When the local metadata is consistent with the source metadata, the local file is updated.

6. The method according to claim 5, characterized in that When the local metadata is detected to match the local file, after comparing whether the local metadata is consistent with the source metadata, the method further includes: When the local metadata is inconsistent with the source metadata, determining difference data between the local metadata and the source metadata; The difference data is sent to the at least one trusted electronic device, where the difference data is used to trigger the at least one trusted electronic device to send the file to be synchronized to the electronic device.

7. The method according to claim 6, characterized in that When the local metadata is inconsistent with the source metadata, after determining the difference data between the local metadata and the source metadata, the method further includes: The source metadata and the difference data are sent to the at least one trusted electronic device, the source metadata is used by the at least one trusted electronic device to verify whether the source metadata matches the local file in the at least one trusted electronic device; the difference data is used to trigger the at least one trusted electronic device to send the file to be synchronized to the electronic device when the source metadata matches the local file in the at least one trusted electronic device.

8. The method according to any one of claims 2 to 7, characterized in that: The check value of the temporary synchronization file includes a weak hash value.

9. The method according to any one of claims 3 to 8, characterized in that: The modified file name of the temporary synchronization file is consistent with the file name of the local file.

10. An electronic device, characterized in that: include: one or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method according to any one of claims 1 to 9.

11. A chip, characterized in that: include: A processor, used to call and run a computer program from a memory, so that an electronic device equipped with the chip executes a method as claimed in any one of claims 1 to 9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the processor is caused to execute the method according to any one of claims 1 to 9.

Citation Information

Patent Citations

  • Data sharing method, electronic equipment and system

    CN114329020A

  • File synchronization method and device and electronic equipment

    CN115878573A

  • Image security using source identification

    CN116194923A

  • File verification method and device, electronic equipment and storage medium

    CN117763627A

  • Searching for entities based on trust score and geography

    US20170235792A1