[go: up one dir, main page]

CN119248737B - File synchronization methods, electronic devices and storage media - Google Patents

File synchronization methods, electronic devices and storage media

Info

Publication number
CN119248737B
CN119248737B CN202410389113.9A CN202410389113A CN119248737B CN 119248737 B CN119248737 B CN 119248737B CN 202410389113 A CN202410389113 A CN 202410389113A CN 119248737 B CN119248737 B CN 119248737B
Authority
CN
China
Prior art keywords
file
electronic device
synchronization
directories
directory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410389113.9A
Other languages
Chinese (zh)
Other versions
CN119248737A (en
Inventor
刘能宾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Honor Device Co Ltd
Original Assignee
Honor Device Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Honor Device Co Ltd filed Critical Honor Device Co Ltd
Priority to CN202410389113.9A priority Critical patent/CN119248737B/en
Publication of CN119248737A publication Critical patent/CN119248737A/en
Application granted granted Critical
Publication of CN119248737B publication Critical patent/CN119248737B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/178Techniques for file synchronisation in file systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application 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 electronic equipment, the trust ring where the electronic equipment is located further comprises at least one trusted electronic equipment, the method comprises the steps of determining that at least two catalogues in the electronic equipment synchronize the same file from the at least one trusted electronic equipment, requesting to acquire the same file from the at least one trusted electronic equipment by any catalogue, wherein any catalogue is any catalogue in the at least two catalogues, and sending the acquired same file to other catalogues by any catalogue. In the implementation mode, the same file is transmitted only once across devices for the electronic device and the trusted electronic device, and the whole file transmission process is simple and convenient. Because the file transmission times are less, the use and processing time of network bandwidth are reduced, and the efficiency of file synchronization is improved while the power consumption of the electronic equipment and the trusted electronic equipment is reduced.

Description

File synchronization method, electronic device and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a file synchronization method, an electronic device, and a storage medium.
Background
With the development of communication technology, distributed technology is increasingly applied to electronic devices. The distributed technology brings easier and more convenient experience for users in some scenes such as offices, data storage, data access and the like.
For example, in a distributed file synchronization scenario, cell phones and other electronic devices (e.g., tablet computers, notebook computers, home storage devices, etc.) communicate via near field. For example, near field communication such as wireless fidelity (WIRELESS FIDELITY, wi-Fi), bluetooth (BT), peer-to-peer (P2P) is used to form a local area network, and a trust ring is established to synchronize files in the mobile phone to other electronic devices.
However, in use, the file synchronization process in the related art is complex and cumbersome, so that the efficiency of file synchronization is reduced, and the power consumption of the electronic device is increased.
Disclosure of Invention
The application provides a file synchronization method, electronic equipment and a storage medium, which can reduce the number of file transmission times, reduce the use and processing time of network bandwidth, reduce the power consumption of the electronic equipment and trusted electronic equipment and improve the efficiency of file synchronization in the file synchronization process.
In a first aspect, the application provides a file synchronization method applied to electronic equipment, wherein a trust ring where the electronic equipment is located also comprises at least one trusted electronic equipment, and the method comprises the steps of determining that at least two directories in the electronic equipment synchronize the same file from the at least one trusted electronic equipment; any one catalogue requests to acquire the same file from at least one trusted electronic device, and any one catalogue sends the acquired same file to other catalogues.
Any one of the directories is any one of at least two directories, and the other directories are other than any one of the at least two directories.
Optionally, the storage space corresponding to the directory in the electronic device is used for storing the file to be synchronized, that is, storing the same file sent by the trusted electronic device.
Alternatively, the hierarchy of directories may be represented by file paths. At least two directories in the electronic equipment are different, namely at least two directories in the electronic equipment correspond to different file paths respectively.
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. In the whole file synchronization process, the same file is transmitted only once across devices for the electronic device and the trusted electronic device, and the whole file transmission process is simple and convenient. Because the file transmission times are less, the use and processing time of network bandwidth are reduced, and the efficiency of file synchronization is improved while the power consumption of the electronic equipment and the trusted electronic equipment is reduced. The file transmission times are reduced, the risk of data leakage can be reduced, and the safety of file synchronization is improved.
And any directory in the electronic equipment transmits the same file to other directories in the electronic equipment, and the file is transmitted in the same electronic equipment, so that the transmission speed is high, the risk is low, and the efficiency and the safety of file synchronization are improved. No extra network bandwidth is consumed in the transmission process, the transmission cost is reduced, the influence of network fluctuation or external interference is not easy to occur, and the transmission reliability is improved. And the file operation is carried out in the same electronic equipment, so that the operating system and the file system of the electronic equipment can better maintain the attribute and the authority of the file and ensure the integrity of the file.
With reference to the first aspect, in some implementations of the first aspect, determining that at least two directories in the electronic device each synchronize a same file from at least one trusted electronic device includes obtaining a list of files to be synchronized, comparing files to be synchronized corresponding to the at least two directories, and determining that the at least two directories each synchronize a same file from the at least one trusted electronic device when the files to be synchronized corresponding to the at least two directories are consistent.
The file list to be synchronized comprises files to be synchronized corresponding to at least two catalogues respectively.
In the implementation manner, the files to be synchronized corresponding to the at least two catalogues are checked to ensure that the at least two catalogues are truly synchronized with the same file from the trusted electronic equipment, so that the files finally synchronized into each catalogue can be accurate, and the accuracy of file synchronization is improved.
With reference to the first aspect, in some implementations of the first aspect, comparing 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, and determining that the at least two directories synchronize the same file from at least one trusted electronic device when the metadata of the files to be synchronized corresponding to the at least two directories are consistent.
The metadata of the file to be synchronized is used to describe the name, the file size, the file creation time, the file last modification time, the file last access time, the file type, the file authority (such as read-write authority, execution authority, etc.), the file owner, the file attribute flag (such as a specific flag bit, which is used to indicate that the file belongs to a hidden file, or a system file, or a read-only file, etc.), the file system information, the file version, the file extension attribute (such as a custom tag), the relative path, etc.
In the implementation manner, the metadata of the files to be synchronized corresponding to the at least two directories are checked to ensure that the at least two directories are truly synchronized with the same file from the trusted electronic equipment, so that the files finally synchronized into each directory can be accurate, and the accuracy of file synchronization is improved.
With reference to the first aspect, in some implementations of the first aspect, any directory request obtains a same file from at least one trusted electronic device, including any directory initiating a file synchronization request to at least one trusted electronic device, the file synchronization request being used to trigger the at least one trusted electronic device to send the same file to the electronic device, and marking other directories to synchronize the same file with any directory.
In the implementation mode, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after the same file is acquired by any subsequent directory, the same file is quickly and accurately sent to the marked other directories, the file which is finally synchronized to each directory can be accurate, and the accuracy of file synchronization is improved.
With reference to the first aspect, in some implementations of the first aspect, any directory sends the obtained same file to other directories, including obtaining file paths of the marked other directories, and copying the same file to the file paths of the marked other directories.
In the implementation mode, after any directory in the electronic equipment acquires the same file to be synchronized, the same file is copied into the file paths of other directories according to the file paths of other marked directories, and the file is transmitted in the same electronic equipment, so that the transmission speed is high, the risk is low, and the efficiency and the safety of file synchronization are improved. No extra network bandwidth is consumed in the transmission process, the transmission cost is reduced, the influence of network fluctuation or external interference is not easy to occur, and the transmission reliability is improved. And the file operation is carried out in the same electronic equipment, so that the operating system and the file system of the electronic equipment can better maintain the attribute and the authority of the file and ensure the integrity of the file.
With reference to the first aspect, in some implementation manners of the first aspect, the trust ring where the electronic device is located further includes at least two trusted electronic devices, where at least two trusted electronic devices respectively store the same synchronization file, and the file synchronization method may further include obtaining an influence factor of each trusted electronic device, determining a synchronization source device in at least two trusted electronic devices according to the influence factor of each trusted electronic device, and synchronizing the synchronization file from the synchronization source device.
The influencing factor is used to influence the determination of the synchronization source device, i.e. the influencing factor is a factor for influencing which trusted electronic device is chosen as synchronization source device. The synchronization source device is different and the file synchronization effect is different, that is, influencing factors may be used to influence the file synchronization effect between the electronic device and the trusted electronic device.
The influencing factors include at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, and a user preference.
In the implementation manner, the influence factors of each trusted electronic device are considered, so that the most proper synchronous source device can be selected from a plurality of trusted electronic devices, the synchronous operation can be ensured to be more efficient, and the consistency and the accuracy of the synchronous files are favorably kept. Meanwhile, the overload condition can be avoided, the reasonable allocation and optimized use of equipment resources are ensured, unnecessary resource consumption is reduced, the file synchronization cost is reduced, and the reliability of file synchronization is enhanced.
With reference to the first aspect, in some implementations of the first aspect, determining a synchronization source device among at least two trusted electronic devices based on the influencing factor of each trusted electronic device includes calculating a synchronization suitability score for each trusted electronic device based on the influencing factor of each trusted electronic device, and determining a synchronization source device among at least two trusted electronic devices based on the synchronization suitability score of each trusted electronic device.
In the implementation manner, the synchronization suitability score is calculated for the trusted electronic equipment, and the process of synchronizing the files by the synchronization source equipment is determined according to the synchronization suitability score, so that the most suitable synchronization source equipment can be selected from a plurality of trusted electronic equipment, the higher efficiency of synchronization operation can be ensured, and the consistency and accuracy of the synchronized files are maintained. Meanwhile, the overload condition can be avoided, the reasonable allocation and optimized use of equipment resources are ensured, unnecessary resource consumption is reduced, the file synchronization cost is reduced, and the reliability of file synchronization is enhanced.
With reference to the first aspect, in some implementations of the first aspect, the device types of the at least two trusted electronic devices are different, and determining the synchronization source device in the at least two trusted electronic devices according to the influencing factor of each trusted electronic device includes determining a priority of each trusted electronic device according to the influencing factor of each trusted electronic device, and determining the synchronization source device in the at least two trusted electronic devices according to the priority of each trusted electronic device.
In the implementation mode, the synchronous source equipment is determined by determining the priority of the equipment, and resources can be reasonably allocated according to the importance and the functions of different equipment, so that the proper synchronous source equipment can be chosen, and the efficiency and the accuracy of the subsequent file synchronization are improved.
In a second aspect, the application provides an electronic device comprising one or more processors, one or more memories, a module having a plurality of applications installed thereon, the memories storing one or more programs which, when executed by the processors, cause the electronic device to perform the method of the first aspect and any of its possible implementations.
In a third aspect, the application provides an apparatus for processing data, comprising means for performing any of the methods of the first aspect. The device may be a server, an electronic device, or a chip in the electronic device. The apparatus may include an input unit and a processing unit.
When the apparatus is an electronic device, the processing unit may be a processor and the input unit may be a communication interface; the electronic device may further comprise a memory for storing computer program code which, when executed by the processor, causes the electronic device to perform any of the methods of the first aspect.
When the apparatus is a chip in an electronic device, the processing unit may be a processing unit inside the chip, the input unit may be an output interface, a pin, a circuit, or the like, the chip may further include a memory, which may be a memory (e.g., a register, a cache, or the like) inside the chip, or a memory (e.g., a read-only memory, a random access memory, or the like) located outside the chip, and the memory is configured to store computer program code, where the processor executes the computer program code stored in the memory, to cause the chip to perform any one of the methods of the first aspect.
In a fourth aspect, the present application provides a chip comprising a processor. The processor is configured to read and execute a computer program stored in the memory to perform the method of the first aspect and any possible implementation thereof.
Optionally, the chip further comprises a memory, and the memory is connected with the processor through a circuit or a wire.
Optionally, the chip further comprises a communication interface.
In a fifth aspect, the present application provides a computer readable storage medium having stored therein a computer program which, when executed by a processor, causes the processor to perform the method of the first aspect and any possible implementation thereof.
In a sixth aspect, the application provides a computer program product comprising computer program code which, when run on an electronic device, causes the electronic device to perform the method of the first aspect and any possible implementation thereof.
The technical effects obtained by the second, third, fourth, fifth and sixth aspects are similar to the technical effects obtained by the corresponding technical means in the first aspect, and are not described herein.
Drawings
FIG. 1 is a schematic diagram of a system architecture to which the file synchronization method according to the embodiment of the present application is applied;
FIG. 2 is a schematic diagram of another system architecture to which the file synchronization method according to the embodiment of the present application is applicable;
Fig. 3 is a schematic diagram of an application scenario of file synchronization according to an embodiment of the present application;
FIG. 4 is a schematic diagram of external storage-based backup data according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a process of backing up data according to an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating a process of file synchronization according to an embodiment of the present application;
FIG. 7 is a schematic diagram of file transfer according to an embodiment of the present application;
FIG. 8 is a flowchart of a file synchronization method according to an embodiment of the present application;
FIG. 9 is a schematic diagram of another file transfer according to an embodiment of the present application;
FIG. 10 is a flowchart of another file synchronization method according to an embodiment of the present application;
FIG. 11 is a flowchart illustrating another file synchronization method according to an embodiment of the present application;
FIG. 12 is a flowchart of another file synchronization method according to an embodiment of the present application;
FIG. 13 is a flowchart of another file synchronization method according to an embodiment of the present application;
FIG. 14 is a schematic diagram of file synchronization according to an embodiment of the present application;
FIG. 15 is a flowchart of a file synchronization method according to an embodiment of the present application;
fig. 16 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application;
FIG. 17 is a schematic diagram of a software architecture of an electronic device according to an embodiment of the present application;
Fig. 18 is a schematic structural diagram of a chip according to an embodiment of the present application.
Detailed Description
The technical scheme of the application will be described below with reference to the accompanying drawings.
In the description of the embodiments of the present application, unless otherwise indicated, "/" means or, for example, a/B may represent a or B, and "and/or" herein is merely an association relationship describing an association object, and means that there may be three relationships, for example, a and/or B, and that there may be three cases where a exists alone, while a and B exist together, and B exists alone. In addition, in the description of the embodiments of the present application, "plurality" means two or more than two.
The terms "first" and "second" are used below for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include one or more such feature. In the description of the present embodiment, unless otherwise specified, the meaning of "plurality" is two or more.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
For a better understanding of the embodiments of the present application, some terms involved in the embodiments of the present application are explained first below to facilitate understanding by those skilled in the art.
1. Trust ring and trusted electronic device
And the two or more electronic devices establish trust relationship through trusted authentication to form a trust ring.
The electronic devices can be trusted and authenticated by any one of the following methods, a trust relationship is established, and a trust ring is formed, wherein 1) the same account number is respectively logged in two or more electronic devices, and the electronic devices under the same account number trust each other, so that the two or more electronic devices form the trust ring. For example, two mobile phones of the same user, or a mobile phone, a tablet computer, a notebook computer, a home storage device (Network Attached Storage, NAS) and the like of the same user can perform trusted authentication by logging in an account number of the user, and a trust relationship is established to form a trust ring. 2) And carrying out trusted authentication on two or more electronic devices through a private protocol, and establishing a trust relationship to form a trust ring. 3) And (3) performing trusted authentication on two or more electronic devices through logging in the cloud, and establishing a trust relationship to form a trust ring. It will be appreciated that the above several ways of constructing a trust ring are for illustration only and are not to be construed as limiting the application in any way.
Electronic equipment in the trust ring forms a local area network through near field communication, and data can be synchronized through the local area network, so that the coordination of the equipment is realized. In embodiments of the present application, synchronization of data includes, but is not limited to, file synchronization.
The electronic device in the trust ring that actively initiates the synchronization request may be referred to as a master device, and other electronic devices that mutually pass the trusted authentication with the master device and have a trust relationship are referred to as trusted electronic devices. For example, the mobile phone, the tablet computer and the notebook computer form a trust ring, the mobile phone actively initiates a synchronization request in the trust ring, and applies for synchronizing files in the mobile phone to the tablet computer and the notebook computer, so that the mobile phone is a main device, and the tablet computer and the notebook computer are trusted electronic devices.
2. Cross-end mount (mount) access file
The storage devices transfer, share, and access files between different operating systems and electronic devices.
3. Trust ring application
The trust ring application represents an application in an electronic device within the trust ring. The user can set functions such as file backup, file synchronization and the like through the trust ring application.
By way of example, trust ring applications may include file management applications, setup applications, near field transmission applications, gallery applications, third party file synchronization applications, multimedia applications, social applications, web applications, educational applications, and the like.
4. Software development kit (Software Development Kit SDK)
Typically refers to a collection of development tools by which a software engineer builds an application program for a particular software package, software framework, hardware platform, operating system, or the like. In other words, an SDK is a collection of related documents, paradigms, and tools that facilitate the development of a certain class of applications, which facilitates the creation of the applications through compilers, debuggers, software frameworks, and the like.
In an embodiment of the present application, the SDK may include a file synchronization SDK. The file synchronization SDK may be integrated in an application program, such as in a trust ring application, thereby configuring the trust ring application with the capability of file synchronization.
5. Directory and folder
Directory and folder generally refer to the same concept, both being containers used to organize and store files and other directories/folders. In the embodiment of the application, the two words are used alternately in different application scenes, but the meaning and the function represented by the words are the same.
6. Water level synchronization
Water level synchronization is a concept in the field of real-time data processing that is used to ensure consistency and integrity of data in a distributed system. In the embodiment of the application, the water level synchronization is used for ensuring the consistency and the integrity of files in different electronic devices and different operating systems.
7. Incremental synchronization (INCREMENTAL SYNCHRONIZATION)
Incremental synchronization is a file synchronization technique that focuses on synchronizing only files that have changed since the last file synchronization.
8. Link (Link)
Links may include hard links (hard links) and soft links (symbolic link).
Wherein hard links are treated as a separate file in the file system, and soft links are similar to a file containing text pointing to the file path. Both links can be created under different directories, thereby achieving the effect of accessing the same file at multiple storage locations.
The foregoing is a simplified description of the terminology involved in the embodiments of the present application, and is not described in detail below.
Electronic equipment in the trust ring forms a local area network through near field communication, and data can be synchronized through the local area network. For example, file synchronization may be performed between electronic devices within a trust ring.
Referring to fig. 1, fig. 1 is a schematic diagram of a system architecture to which a file synchronization method according to an embodiment of the present application is applicable. As shown in fig. 1, the electronic device 100, the electronic device 200, and the electronic device 300 establish a trust relationship through trusted authentication, and form a trust ring. It should be understood that the number of electronic devices included in the trust ring may be greater or less than the number of electronic devices shown in fig. 1, which is not limited in terms of practical requirements.
In an embodiment of the present application, electronic device 100, electronic device 200, and electronic device 300 may be a master device and a trusted electronic device with respect to each other.
Taking the electronic device 100 as a mobile phone, the electronic device 200 as a tablet computer, and the electronic device 300 as a notebook computer as an example. For example, when the mobile phone initiates a synchronization request to the tablet computer and the notebook computer, and applies for synchronizing files in the mobile phone to the tablet computer and the notebook computer, the mobile phone is a master device, and the tablet computer and the notebook computer are trusted electronic devices. For another example, when the mobile phone and the tablet computer initiate a synchronization request to the notebook computer, and the file in the mobile phone and the tablet computer is applied to be synchronized to the notebook computer, the mobile phone and the tablet computer are the main devices, and the notebook computer is the trusted electronic device. This is merely illustrative and is not limiting.
Referring to fig. 2, fig. 2 is a schematic diagram of another system architecture to which the file synchronization method according to the embodiment of the present application is applicable. As shown in fig. 2, the electronic device 100, the electronic device 200, and the electronic device 400 establish a trust relationship through trusted authentication, and form a trust ring. Unlike the trust ring shown in fig. 1, the trust ring shown in fig. 2 may include an electronic device 400 that is a NAS. In the embodiment of the application, the mobile phone and/or the tablet computer initiates a synchronization request to the NAS, and applies for synchronizing files in the mobile phone and/or the tablet computer to the NAS. The NAS may also perform cross-end mount access to files, for example, the NAS may transmit and share files to and may access files in the mobile phone and/or the tablet computer.
An application scenario of data synchronization between electronic devices in a trust ring is described below with reference to the accompanying drawings.
The trust ring provided by the embodiment of the application can comprise a mobile phone and an NAS, and is exemplified by synchronizing files in the mobile phone to the NAS.
Referring to fig. 3, fig. 3 is a schematic diagram of an application scenario of file synchronization according to an embodiment of the present application.
Illustratively, a setting application in the mobile phone is opened, a "system and update" option is selected in a display interface corresponding to the setting application, and the mobile phone displays an interface as shown in (a) of fig. 3. Clicking on control 101 in the interface shown in fig. 3 (a), i.e., clicking on the "backup and restore" option, the handset displays the interface shown in fig. 3 (b).
In the interface shown in fig. 3 (b), various data backup and restoration modes, such as cloud backup, external storage, mobile phone assistant, and the like, are displayed. The cloud backup can be used for backing up the whole machine data of the mobile phone to the cloud server, and if necessary, the whole machine data stored in the cloud server can be restored to the mobile phone through the cloud backup. The overall machine data may include gallery, contacts, text messages, call records, memos, input methods, harassment interception, wireless local area network (wireless local area networks, WLAN) settings, contextual smarts, cell phone households, clocks, weather, cameras, calendars, desktop icon layouts, system settings, applications, chat records, browsing records, and the like.
The external storage is used for connecting with an external storage device to backup and restore data. The external storage devices may include external memory cards, universal serial bus (Universal Serial Bus, USB) storage devices, NAS, and the like.
The mobile phone assistant is used for connecting the computer to backup and restore data.
In the embodiment of the application, the files in the mobile phone are backed up to the NAS in an external storage mode. It should be noted that synchronization also belongs to a backup method, and in the present application, the file in the mobile phone is also called as synchronizing to the NAS. In addition, it should be further noted 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, contact, sms, call record, memo, input method, harassment interception, wireless local area network (wireless local area networks, WLAN) setting, scenario smart, mobile phone manager, clock, weather, camera, calendar, desktop icon layout, system setting, application, chat record, browsing record, etc.
Referring to fig. 4 and fig. 5, fig. 4 is a schematic diagram of an embodiment of the application, in which backup data is based on external storage, and fig. 5 is a schematic diagram of a backup data process according to an embodiment of the application.
Illustratively, clicking on control 102 in the interface shown in fig. 3 (b), i.e., clicking on the "external store" option, the handset displays the interface shown in fig. 4 (a). In the interface shown in fig. 4 (a), identification information corresponding to various external storage devices, such as an external memory card, USB storage, shared folder, etc., is displayed. The external memory card is used for backing up data in the mobile phone to the external memory card when the external memory card is detected, the USB memory is used for backing up the data in the mobile phone to the USB when the USB memory is connected to the USB, and the shared folder is used for backing up the data in the mobile phone to the home NAS device when the shared folder in the same network is found by scanning.
In this example, the shared folder is used to backup the data in the handset to the NAS. Illustratively, clicking on control 103 in the interface shown in fig. 4 (a), i.e., clicking on the "shared folder" option, the handset displays the interface shown in fig. 4 (b). At this time, the mobile phone finds out NAS storage devices in the same network through WLAN scanning, or the mobile phone finds out NAS storage devices in a trust ring, and after the NAS storage devices appear, the user can click to access and add a shared folder under the NAS storage devices.
Illustratively, clicking on control 104 in the interface shown in fig. 4 (c), i.e., clicking on the "device name" option, the handset displays the interface shown in fig. 5 (a). In the interface shown in fig. 5 (a), the device names of NAS storage devices are displayed, the storage space that the NAS storage devices have used (1.58 TB has been used) and the total storage space (e.g., 3.92 TB).
In the interface shown in fig. 5 (a), an automatic backup control 105, a switch control 106, and a select backup data item control 107 are also displayed. The switch control 106 is used to turn on the automatic backup function or turn off the automatic backup function, and fig. 5 (a) shows a scenario of turning on the automatic backup function.
For example, in the case where the automatic backup function is turned on, the user may set the period of automatic backup according to the need. For example, the mobile phone is automatically backed up every other day when the mobile phone is off, and the mobile phone is automatically backed up every seven days when the mobile phone is off.
Selecting the backup data item control 107 is used by the user to select the data item that needs to be backed up. Illustratively, clicking on the select backup data item control 107 in the interface shown in fig. 5 (a), i.e., clicking on the "auto backup data item" option, the handset displays the interface shown in fig. 5 (b).
In the interface shown in fig. 5 (b), a full selection control 108 and a start backup control 109 are displayed. The full selection control 108 is checked, and all data items to be backed up can be selected by one key, for example, data items such as music, pictures, videos, contacts, documents, system settings and the like shown in (b) in fig. 5 are selected by one key. It should be understood that this is merely illustrative, and that a user may also sort one or more data items that need to be backed up according to his/her needs.
After selecting the data item to be backed up, click on the start backup control 109 in the interface shown in fig. 5 (b), i.e. click on the "start backup" option, the handset displays the interface shown in fig. 5 (c). The mobile phone performs preparation data processing, such as calculating the number of items and the data size corresponding to each data item to be backed up, and displays the calculated items and the data size in an interface as shown in fig. 5 (c). After the data is ready, the mobile phone starts to backup the data, namely, the data items selected by the user in the mobile phone are backed up to the NAS, or, each file selected by the user in the mobile phone is synchronized to the NAS.
In the embodiment of the application, the distributed management service is adopted to manage each electronic device in the trust ring, so that data can be stored and accessed among different electronic devices (such as mobile phones, tablet computers, notebook computers, NAS (network attached storage) and the like), different operating systems (such as Android systems, IOS operating systems, sambur (Symbian) operating systems, blackberry (blackberry) operating systems, linux operating systems, windows operating systems and the like), and data storage and access among cross-device and cross-system data are realized, so that a data access channel of near-field communication among the electronic devices is opened.
The application scenario of file synchronization is described above in connection with user operation, and the specific process of file synchronization between electronic devices in a trust ring is described below in connection with the accompanying drawings.
The trust ring provided by the embodiment of the application can comprise a mobile phone and a personal computer (Personal Computer, PC), and the PC can comprise a desktop computer, a notebook computer, a small notebook computer, a tablet personal computer, an ultrabook and the like, so that the file in the mobile phone is synchronized into the tablet personal computer for illustration.
Referring to fig. 6, fig. 6 is a schematic diagram illustrating a file synchronization process according to an embodiment of the application.
S101, the trust ring application acquires a file synchronization request and invokes a file synchronization SDK.
The trust ring application represents an application in an electronic device within the trust ring. The user can set functions such as file backup starting, file synchronization and the like through the trust ring application, or functions such as file backup closing, file synchronization and the like.
In the embodiment of the application, the trust ring application can comprise a file management application, a setting application, a near field transmission application, a gallery application, a third party file synchronization application, a multimedia application, a social application, a network application, an education application and the like.
The file synchronization SDK is pre-integrated in the trust ring application, so that the trust ring application can conveniently create a shared directory/shared folder by calling the file synchronization SDK.
The file synchronization request is used for requesting to synchronize a file in an electronic device to which the trust ring application belongs to at least one trusted electronic device that the trust ring also comprises. For example, the electronic device to which the trust ring application belongs is a mobile phone, the trusted electronic device that the trust ring further includes is a tablet computer, and the file synchronization request is used for requesting to synchronize a file in the mobile phone to the tablet computer.
The file synchronization request may be triggered by the electronic device to which the trust ring application belongs, or may be triggered by the trusted electronic device. Illustratively, the trust ring application installed on the mobile phone receives an operation that a user sets to start a file synchronization function, and triggers a file synchronization request. Or the trusted electronic device initiates a file synchronization request to the electronic device to which the trust ring application belongs, the electronic device to which the trust ring application belongs receives the file synchronization request, for example, the tablet computer initiates the file synchronization request to the mobile phone, and the mobile phone receives the file synchronization request.
Illustratively, when the trust ring application obtains the file synchronization request, the file synchronization SDK is invoked by pre-written code in the trust ring application.
S102, the file synchronization SDK calls a file synchronization service module to create a shared directory/shared folder.
Illustratively, the file synchronization service module is deployed at the application framework layer, and is a software component specifically designed in the present application to synchronize files between different electronic devices and different operating systems.
In an embodiment of the present application, the shared directory may be represented by a REPO directory, which may be shared by electronic devices within the trust ring. The REPO directory may include information such as a file path, a scan start time, a scan time interval, REPO identification information, an electronic device name, file synchronization configuration information, a callback function of the file path, and the like.
The file path refers to a path corresponding to the file to be synchronized, that is, a path where the file to be synchronized to the trusted electronic device is located. For example, the user wants to synchronize the pictures on the mobile phone to the tablet computer, and selects a path corresponding to the gallery on the mobile phone, or selects a directory corresponding to the gallery on the mobile phone, where the selected path or the selected directory is a file path.
The scan start time is the time when the electronic device starts scanning the file path. The time when the electronic device starts scanning the file path for the first time is generally determined according to the time when the user sets the file synchronization function to be started for the first time. For example, when the user selects to immediately start synchronizing the file when the user first sets to start the file synchronization function, the electronic device immediately starts scanning the file path, that is, the scanning start time is the time when the user starts to start the file synchronization function.
The time when the electronic device starts scanning the file path for the non-first time is determined according to the file synchronization period set by the user, i.e. according to the scanning time interval. For example, the user sets to automatically synchronize a file once every other day, or automatically synchronize a file once every seven days, or the like, then the electronic device scans a file path once every other day, or scans a file path once every seven days, or the like, after scanning the file path for the first time.
The REPO identification information is an Identifier (ID) of the REPO for uniquely identifying the REPO of the electronic device.
The file synchronization configuration information may include a number of file syncs, a version of the file syncs, a name of the trusted electronic device, REPO identification information of the trusted electronic device, a file path of the trusted electronic device, a filter file, and the like.
Wherein 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 to be 1.0, when the file is changed for the second time, the file synchronization version is recorded to be 1.1, and when the file is changed for the third time, the file synchronization version is recorded to be 1.2.
The REPO identification information of the trusted electronic device, i.e. the ID of the REPO of the trusted electronic device, is used to uniquely identify the REPO of the trusted electronic device. For example, 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 may perform file synchronization.
The file path of the trusted electronic device refers to a path for storing files to be synchronized, i.e. a path for storing files synchronized in the electronic device. For example, the user wants to synchronize the picture on the mobile phone to a specific path in the tablet computer, where the specific path is a file path of the trusted electronic device.
Filtering files refers to files that do not use synchronization. In the embodiment of the application, the file is not scanned and filtered, so that the power consumption of the electronic equipment can be reduced, the time for scanning the file in the file synchronization process is effectively reduced, and the file synchronization efficiency is improved.
Illustratively, the file synchronization SDK invokes the file synchronization service module to cause the file synchronization service module to create a shared directory/shared folder, such as to create a REPO directory, using an application programming interface (Application Programming Interface, API) function or method provided by the file synchronization SDK.
S103, the file synchronization service module performs data persistence processing on the shared directory/shared folder.
Data persistence refers to the long-term storage of data on a persistable storage medium so that the data may still be accessed after an application or operating system reboots.
In the embodiment of the application, the REPO catalog can be stored in the local database of the mobile phone which can be stored permanently, so that after the user sets the file synchronization function, even if the mobile phone is restarted or the trust ring application is restarted, the related information of the file synchronization function set by the user can be read from the local database, and the related information of the REPO catalog is ensured not to be lost. For the user, the related information of the file synchronization function is only required to be set once, so that the user can always apply the file synchronization function without resetting the related information of the file synchronization function after the mobile phone is restarted or the trust ring application is restarted each time, and the user experience is improved.
In the above steps S101 to S103, the electronic device (e.g. mobile phone) creates a shared directory/shared folder, such as a scenario of creating a REPO directory, when acquiring the file synchronization request. In one possible implementation, the electronic device (e.g., a cell phone) may also pre-create the shared directory/shared folder, such as pre-creating the REPO directory, i.e., the electronic device (e.g., a cell phone) creates the REPO directory before acquiring the file synchronization request. For example, the trust ring application invokes a file synchronization SDK that invokes a file synchronization service module to create a REPO directory, which performs data persistence processing on the REPO directory.
The method for creating the REPO catalog in the electronic equipment in advance is beneficial to the electronic equipment in the follow-up trust ring to directly utilize the REPO catalog for file synchronization, and improves the efficiency of file synchronization.
Alternatively, in one possible implementation, the trusted electronic device may create a shared directory/shared folder, such as a REPO directory, using a method similar to that described above in steps S101 through S103. As shown in fig. 6, the method specifically includes:
S201, a trust ring application in the trusted electronic equipment acquires a file synchronization request and invokes a file synchronization SDK.
S202, the file synchronization SDK calls a file synchronization service module in the trusted electronic device, and a shared directory/shared folder is created.
S203, the file synchronization service module performs data persistence processing on the shared directory/shared folder.
For the description of step S201 to step S203, reference may be made to the specific description of step S101 to step S103, which is not repeated here.
The trusted electronic device (e.g., tablet computer) creates a shared directory/shared folder, such as a scene of creating a REPO directory, when acquiring the file synchronization request in steps S201 to S203. In one possible implementation, the trusted electronic device (e.g., tablet) may also pre-create the shared directory/shared folder, such as pre-creating the REPO directory, i.e., the trusted electronic device (e.g., tablet) creates the REPO directory before acquiring the file synchronization request.
The method for creating the REPO catalog in the trusted electronic equipment in advance is beneficial to the electronic equipment in the subsequent trust ring to directly utilize the REPO catalog for file synchronization, and improves the efficiency of file synchronization.
S104, sharing the REPO directory with the trusted electronic device.
For example, the electronic device (such as a mobile phone) determines a file to be synchronized according to the file synchronization request, scans a file path in the electronic device (such as the mobile phone) based on the file to be synchronized, and records a file synchronization version for each scanning result.
For example, a first scan of a file path in an electronic device (e.g., a mobile phone) based on a file to be synchronized records a file synchronization version 1.0 for a first scan result, a second scan of a file path in an electronic device (e.g., a mobile phone) based on a file to be synchronized detects a change in the file to be synchronized compared with the first scan result, records a file synchronization version 1.1 for a second scan result, a third scan of a file path in an electronic device (e.g., a mobile phone) based on a file to be synchronized detects no change in the file to be synchronized compared with the second scan result, records a file synchronization version 1.1 for a third scan result, and so on.
The electronic device (e.g., a cell phone) shares the synchronized version of the file recorded each time with a trusted electronic device (e.g., a tablet computer). For example, the electronic device (e.g., a mobile phone) records the file synchronization version recorded each time in the REPO directory and shares the file synchronization version with the trusted electronic device (e.g., a tablet computer), and the trusted electronic device (e.g., the tablet computer) shares changes that can be read from the REPO directory to the file synchronization version, thereby quickly determining changes in the synchronized file.
S105, the REPO catalog metadata synchronization processing is carried out with the trusted electronic equipment.
Metadata (Metadata) is used to describe data attributes, and the REPO directory Metadata refers to information such as a file path, a scan start time, a scan time interval, REPO identification information, an electronic device name, and file synchronization configuration information included in the REPO directory.
REPO directory metadata synchronization is understood to mean that an electronic device (e.g., a cell phone) and a trusted electronic device (e.g., a tablet computer) are level synchronized based on REPO directories. For example, the electronic device (such as a mobile phone) synchronizes the information including the file path, the scanning start time, the scanning time interval, the REPO identification information, the electronic device name, the file synchronization configuration information and the like in the REPO catalog with the trusted electronic device (such as a tablet computer), so as to provide guarantee for consistency and integrity of the subsequent files in different electronic devices and different operating systems.
S106, the file synchronization service module monitors a file system.
The file synchronization service module may include a listening scan management module for listening, scanning a file system in an electronic device (e.g., a cell phone).
The mobile phone determines the file to be synchronized according to the file synchronization request, monitors and scans the file path of the file to be synchronized in the file system. For example, the user wants to synchronize the pictures on the mobile phone to the tablet computer, and monitors and scans the path corresponding to the gallery on the mobile phone.
When the monitored and scanned file to be synchronized changes, if the monitored and scanned file to be synchronized changes such as new addition, deletion, modification and the like, the file synchronization service module is notified of the changes.
For example, the file to be synchronized is a picture, and a picture discovery change in any application program related to the picture affects the file to be synchronized. Such as camera applications, social applications, sharing applications, etc., and/or delete and/or modify pictures, and notify the file synchronization service module of the corresponding changes.
The file synchronization service module generates a file change record according to the change of the file, and performs data persistence processing on the file change record. The file change record may include operations such as adding, deleting, modifying, etc. to the file, and operation times corresponding to the respective operations.
The file change record is illustratively stored in a local database of the handset that is persistable so that it can be read from the local database even if the handset is restarted, or the trust ring application is restarted, or any application associated with the file to be synchronized is restarted.
S107, the file synchronization service module reads the file change record from the local database.
The file synchronization service module periodically reads file change records from the local database according to a file synchronization period set by a user. For example, the file synchronization service module reads a file change record from the local database every time the electronic device listens to, scans the file system.
S108, carrying out file metadata synchronization processing with the trusted electronic equipment.
The file metadata refers to information such as file name, electronic device to which the file belongs, file size, file addition time, file deletion time, file modification time, and the like.
File metadata synchronization is understood to mean that an electronic device (e.g., a cell phone) synchronizes file metadata with a trusted electronic device (e.g., a tablet computer). In the implementation mode, the file metadata is firstly synchronized with the trusted electronic equipment, and then the file content can be directly synchronized, so that the file synchronization efficiency is improved, and errors are not easy to occur.
It should be understood that, the electronic device performs file metadata synchronization processing with the trusted electronic device, and 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 the file metadata of the trusted electronic device. As shown in fig. 6, the comparison method specifically includes:
s204, the trusted electronic equipment performs file metadata comparison processing.
The alignment process (Comparison Processing) is a data analysis technique for identifying differences and similarities between file metadata sent by an electronic device and file metadata of a trusted electronic device.
For example, the tablet computer compares the file metadata in its own file system with the file metadata sent by the mobile phone one by using the file synchronization service module. If the comparison result is inconsistent, the file metadata sent by the mobile phone is used as the reference, namely the file metadata in the tablet computer is modified into the file metadata sent by the mobile phone.
In the implementation mode, the file metadata in the electronic equipment and the file metadata in the trusted electronic equipment are synchronized, and then the file contents can be directly synchronized, so that the file synchronization efficiency is improved, and errors are not easy to occur.
Optionally, in one possible implementation, after the trusted electronic device performs the file metadata comparison process, the data persistence process is performed on the file metadata sent by the electronic device. For example, the modified file metadata is stored in a local database.
And S109, performing file content synchronization processing with the trusted electronic equipment.
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, and if the file to be synchronized is music, the file content is the audio itself.
The file synchronization service module in the electronic device, for example, reads 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. As shown in fig. 6, the preservation method specifically includes:
s205, the trusted electronic equipment performs file disc dropping processing on the file content.
File dropping generally refers to writing data from a temporary storage area to a permanent storage device. In the embodiment of the application, the trusted electronic equipment stores the file content sent by the electronic equipment into a local database of the trusted electronic equipment. Optionally, in one possible implementation, the trusted electronic device saves the file content sent by the electronic device to a file system, and saves the file content in the file system to a local database. Thus, even if the trusted electronic device is restarted or the trust ring application is restarted, the synchronized file is not affected, and the synchronized file can still be read from the local database.
It should be noted that, when describing the specific process of file synchronization between electronic devices in the trust ring, the description is given taking the example of synchronizing the files in the mobile phone to the tablet computer, so the method executed by the mobile phone side is mainly described. It can be understood that when the file in the tablet computer needs to be synchronized to the 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.
It can be appreciated that, in the embodiment of the present application, the Android operating system is taken as an example for illustration, but the basic principles are equally applicable to electronic devices based on the IOS, symbian, black Berry, linux, windows and other operating systems.
In the embodiment of the 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 service for file synchronization between electronic devices in the trust ring. Illustratively, the file synchronization service module completes sensing of file changes and generation of file metadata by listening and scanning the local file system. Meanwhile, the trust ring self-discovery and self-networking capability provided by the system can enable the electronic equipment to quickly discover the peripheral equipment, so that REPO catalog sharing, REPO metadata synchronization, file metadata synchronization and file content synchronization of the electronic equipment and the trusted electronic equipment in the trust ring are realized, cross-equipment and cross-system data storage and access are realized, and a data access channel of near field communication between the electronic equipment is opened.
In the related art, when file synchronization is performed between electronic devices in a trust ring, if at least two different directories in the electronic devices need to synchronize the same file from the trusted electronic device, or the same file in a source device (i.e., the trusted electronic device) needs to be synchronized under different directories in the electronic device. Typically, the trusted electronic device will send the same file to the electronic device at least twice, i.e. the trusted electronic device will send the same file to different directories in the electronic device, respectively. However, in the file synchronization process, the file needs to be checked every time the file is transmitted across devices, and the trusted electronic device transmits the same file to the electronic device for multiple times, which means that the same file needs to be checked for multiple times, so that the file transmission process is complex and tedious. Repeated transmission of the same file increases the use of network bandwidth and processing time, not only affects other file synchronization, but also reduces the efficiency of file synchronization. And repeated transmission for many times can also increase the power consumption of the electronic equipment and the trusted electronic equipment, increase the risk of data leakage and reduce the security of file synchronization.
For ease of understanding, please refer to fig. 7, fig. 7 is a schematic diagram illustrating file transfer according to an embodiment of the present application.
As shown in fig. 7, the source side represents the side where the source file is located, that is, the source side is the side where the file to be synchronized is transmitted, and the target side is the side where the file to be synchronized is received. In the embodiment of the present application, device a represents a source side, device B represents a target side, device a includes a Repo directory and a Repo directory, repo directory is a subdirectory of Repo directory, and correspondingly Repo directory is a parent directory of Repo2 directory, and a storage space corresponding to Repo directory is used for storing source files (i.e. files to be synchronized, i.e. the same files as described above).
The device B includes a Repo directory and a Repo directory, and it should be noted that the Repo directory and the Repo directory in the device B correspond to different file paths respectively. The storage space corresponding to the Repo directory in the device B is used for storing the file to be synchronized (i.e., the same file) sent by the device a, and the storage space corresponding to the Repo directory in the device B is also used for storing the file to be synchronized (i.e., the same file) sent by the device a.
The Repo directory in device a maps directly with the Repo directory of device B, the Repo directory in device a maps directly with the Repo directory of device B, and file 1 in device a belongs to both the Repo directory and Repo directory in device a.
In a file synchronization scene, a trust relationship is established between the equipment A and the equipment B through trusted authentication, and a trust ring is formed. File 1 in the Repo directory of device a needs to be synchronized/backed up to both the Repo1 directory and the Repo directory of device B, or both the Repo directory and the Repo2 directory of device B need to synchronize/backup file 1 from the Repo2 directory of device a. In this application scenario, in the related art, the device a typically transmits the file 1 in the Repo directory to the device B twice. For example, device a sends file 1 in the Repo directory to the Repo directory in device B, and device a sends file 1 in the Repo directory to the Repo directory in device B.
In this processing manner, the file 1 is transferred twice across devices, and the file 1 needs to be checked every time the file 1 is transferred, which results in complex and tedious file transfer process. Repeated transmission of file 1 increases the use of network bandwidth and processing time, not only affecting other file synchronization, but also reducing the efficiency of file synchronization. And repeated transmission for many times can also increase the power consumption of the electronic equipment and the trusted electronic equipment, increase the risk of data leakage and reduce the security of file synchronization.
In view of the above, the embodiment of the application provides a file synchronization method, which is applied to electronic equipment, wherein a trust ring where the electronic equipment is located also comprises at least one trusted electronic equipment, and the method comprises the steps of determining that at least two directories in the electronic equipment synchronize the same file from the at least one trusted electronic equipment; any catalogue requests to acquire the same file from at least one trusted electronic device, any catalogue is any one catalogue of at least two catalogues, the acquired same file is sent to other catalogues by any catalogue, and the other catalogues are catalogues of at least two catalogues except any catalogue.
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. In the whole file synchronization process, the same file is transmitted only once across devices for the electronic device and the trusted electronic device, and the whole file transmission process is simple and convenient. Because the file transmission times are less, the use and processing time of network bandwidth are reduced, and the efficiency of file synchronization is improved while the power consumption of the electronic equipment and the trusted electronic equipment is reduced. The file transmission times are reduced, the risk of data leakage can be reduced, and the safety of file synchronization is improved.
And any directory in the electronic equipment transmits the same file to other directories in the electronic equipment, and the file is transmitted in the same electronic equipment, so that the transmission speed is high, the risk is low, and the efficiency and the safety of file synchronization are improved. No extra network bandwidth is consumed in the transmission process, the transmission cost is reduced, the influence of network fluctuation or external interference is not easy to occur, and the transmission reliability is improved. And the file operation is carried out in the same electronic equipment, so that the operating system and the file system of the electronic equipment can better maintain the attribute and the authority of the file and ensure the integrity of the file.
The file synchronization method provided by the embodiment of the application is described below with reference to a flowchart.
Referring to fig. 8, fig. 8 is a flowchart illustrating a file synchronization method according to an embodiment of the application. The method comprises the following steps:
S301, determining that at least two directories in the electronic equipment synchronize the same file from at least one trusted electronic equipment.
And the two or more electronic devices establish trust relationship through trusted authentication to form a trust ring. In the embodiment of the application, the trust ring where the electronic device is located also comprises at least one trusted electronic device, and the files in the trusted electronic device can be synchronized into the electronic device, and correspondingly, the files in the electronic device can also be synchronized into the trusted electronic device.
The storage space corresponding to the directory in the electronic device is used for storing the file to be synchronized, namely storing the same file sent by the trusted electronic device.
The hierarchy of directories may be represented by file paths. At least two directories in the electronic device are different, that is, at least two directories in the electronic device correspond to different file paths, respectively.
In one example, it is determined from a file synchronization request that at least two directories in an electronic device each synchronize the same file from at least one trusted electronic device. The electronic device triggers a file synchronization request for requesting the trusted electronic device to send a file to be synchronized to the electronic device. For example, a user may want to synchronize pictures on a trusted electronic device (e.g., a mobile phone) to two different directories of the electronic device (e.g., a tablet computer), and initiate a file synchronization request through the electronic device (e.g., the tablet computer), where the file synchronization request may include identification information of files that each directory wants to synchronize, requested file content, and a file path of the files that want to synchronize. The picture is the file to be synchronized.
By comparing the identification information of the file that each directory wants to synchronize, the requested file content, and the file path of the file that wants to synchronize, it can be determined whether at least two directories in the electronic device are both to synchronize the same file from the trusted electronic device. It will be appreciated that when it is determined that at least two directories in an electronic device are both to synchronize the picture from a trusted electronic device, the picture is the same file.
In another example, a list of files to be synchronized may be obtained, where the list of files to be synchronized includes files to be synchronized by each directory, and when the files to be synchronized by each directory are consistent, it is determined that at least two directories in the electronic device are both to synchronize the same file from the trusted electronic device, as compared to the files to be synchronized by each directory.
For ease of understanding, please refer to fig. 9, fig. 9 is a schematic diagram illustrating another file transfer according to an embodiment of the present application.
As shown in fig. 9, the source side indicates the side where the source file is located, that is, the side where the file to be synchronized is transmitted, that is, the side where the same file is located. The target side is the side receiving the file to be synchronized, i.e. the side receiving the same file. In the embodiment of the present application, the device a may be a trusted electronic device, and the device B may be an electronic device. And the device A and the device B establish a trust relationship through trusted authentication to form a trust ring.
In a file synchronization scenario, file 1 in the Repo directory of device a is determined according to a file synchronization request or a to-be-synchronized list, and needs to be synchronized/backed up to the Repo directory and the Repo directory of device B, or, in other words, the Repo directory and the Repo directory in device B need to synchronize/backup file 1 from the Repo directory of device a.
Optionally, in one possible implementation, the child directory in which the same file in the trusted electronic device is located is directly mapped with one of the at least two directories of the electronic device, and the parent directory in which the same file in the trusted electronic device is located is directly mapped with the other of the at least two directories of the electronic device. As shown in fig. 9, the Repo directory in device a directly maps with the Repo directory of device B, and the Repo directory in device a directly maps with the Repo directory of device B.
Optionally, in one possible implementation, there is an inclusion relationship in a directory to which the same file in the trusted electronic device belongs, or in other words, there is an inclusion relationship in a file path corresponding to the directory to which the same file in the trusted electronic device belongs. As shown in fig. 9, file 1 in device a belongs to both the Repo directory and the Repo directory in device a, the Repo directory in device a is a child directory of the Repo directory, and the Repo directory is a parent directory of the Repo2 directory. Accordingly, the file path corresponding to the Repo directory in the device a is a child file path of the file path corresponding to the Repo directory, and the file path corresponding to the Repo directory is a parent file path of the file path corresponding to the Repo directory. Under the condition, the same file in the subdirectory of the trusted electronic equipment is synchronized/backed up to different catalogues in the electronic equipment, so that the safety of the same file can be better ensured.
S302, any directory requests to acquire the same file from at least one trusted electronic device.
Any directory is any one of at least two directories.
In one example, one directory is randomly selected from at least two directories, and a file synchronization request is initiated to the trusted electronic device through the randomly selected directory, where the file synchronization request is used to trigger the trusted electronic device to send the same file to the directory in which the electronic device initiated the file synchronization request, i.e., to either directory.
The file synchronization request may include identification information of the file, the content of the requested file, the file path, a designated storage location, and the like. Wherein the designated storage location refers to a location in the electronic device for storing the same file, such as any directory. It should be noted that, actually storing the file content is a storage space corresponding to a directory, that is, actually storing the file content of the same file in a storage space corresponding to any directory.
The trusted electronic device scans in a file system according to the identification information of the file, the content of the requested file and the file path to obtain the same file, and then sends the same file to any directory of the electronic device according to the designated storage position.
As described in connection with fig. 9, the Repo directory is selected from the Repo directory and the Repo directory of the device B, and a file synchronization request is initiated to the device a through the Repo directory of the device B, where the device a scans the file system according to the file synchronization request to obtain the file 1 under the Repo directory. Device a sends file 1 to device B in its Repo directory.
In another example, each directory corresponds to a file synchronization request, the file synchronization request of any directory is reserved, the file synchronization requests corresponding to other directories of the at least two directories except any directory are deleted, and the file synchronization requests are initiated to the trusted electronic device through any directory. The trusted electronic device scans in a file system according to the identification information of the file, the content of the requested file, the file path and the like to obtain the same file, and then sends the same file to any directory of the electronic device according to the designated storage position.
In the implementation mode, the file synchronization request corresponding to other catalogues is deleted, so that only any one catalogue can be ensured to initiate the file synchronization request to the trusted electronic equipment, the file synchronization request is prevented from being repeatedly initiated by other catalogues, and the guarantee is provided for reducing the times of cross-equipment transmission.
S303, any directory transmits the acquired same file to other directories.
The other directories are one of at least two directories except any one directory.
In one example, a link corresponding to the same file is created, the link being used to point to the same file. Any directory sends the links corresponding to the same file to other directories. For example, any directory sends a link corresponding to the same file to other directories through a move command. For another example, a clip operation is performed on links corresponding to the same file in any one directory, and a paste operation is performed in other directories, so as to move links corresponding to the same file to other directories.
In another example, any directory copies the same file obtained to other directories. For example, when the number of other directories is one, one and the same file is copied in any one directory, the copied same file is transmitted to the other directory by a move command. When the number of other catalogs is multiple, multiple identical files with the same number can be copied in any catalogue first, the copied multiple identical files are respectively sent to each other catalogue through a moving command, one identical file can be copied in any catalogue first, the copied identical file is sent to one other catalogue through the moving command, then the identical file is copied in any catalogue, the copied identical file is sent to the other catalogue through the moving command, and the like.
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. In the whole file synchronization process, the same file is transmitted only once across devices for the electronic device and the trusted electronic device, and the whole file transmission process is simple and convenient. Because the file transmission times are less, the use and processing time of network bandwidth are reduced, and the efficiency of file synchronization is improved while the power consumption of the electronic equipment and the trusted electronic equipment is reduced. The file transmission times are reduced, the risk of data leakage can be reduced, and the safety of file synchronization is improved.
And any directory in the electronic equipment transmits the same file to other directories in the electronic equipment, and the file is transmitted in the same electronic equipment, so that the transmission speed is high, the risk is low, and the efficiency and the safety of file synchronization are improved. No extra network bandwidth is consumed in the transmission process, the transmission cost is reduced, the influence of network fluctuation or external interference is not easy to occur, and the transmission reliability is improved. And the file operation is carried out in the same electronic equipment, so that the operating system and the file system of the electronic equipment can better maintain the attribute and the authority of the file and ensure the integrity of the file.
Optionally, in one possible implementation manner, when the same file in the trusted electronic device changes, any directory request is triggered to acquire the changed same file from the trusted electronic device, and when the changed same file is acquired, the changed same file is sent to other directories. In the implementation mode, the updated files are synchronized in time, so that the files in all the catalogues can be guaranteed to be the latest, and the consistency of file synchronization is improved.
Optionally, in a possible implementation manner, the step S301 may further include a step S3011 and a step S3013, which are specifically as follows.
Referring to fig. 10, fig. 10 is a flowchart illustrating another file synchronization method according to an embodiment of the application. The method comprises the following steps:
s3011, acquiring a file list to be synchronized.
For example, the file to be synchronized list may include files to be synchronized corresponding to at least two directories, respectively, and each file to be synchronized may include a file name, a file path, a file size, a creation date, a last modification time, a file type, a file version, and the like.
In the embodiment of the present application, the REPO directory created above may include a file list to be synchronized, and the file list to be synchronized is directly obtained from the REPO directory.
S3012, comparing files to be synchronized corresponding to the at least two catalogues respectively.
The file name, the file path, the file size, the creation date, the last modification time, the file type, the file version and the like of the file to be synchronized, which are respectively corresponding to at least two directories, are compared one by one.
For example, the file name, the file path, the file size, the creation date, the last modification time, the file type, and the file version of the file 1 corresponding to the Repo directory of the device B are compared with the file name, the file path, the file size, the creation date, the last modification time, the file type, and the file version of the file 1 corresponding to the Repo directory of the device B, respectively, described with reference to fig. 9.
S3013, determining that at least two catalogues synchronize the same file from at least one trusted electronic device when the files to be synchronized corresponding to the at least two catalogues are consistent.
In an exemplary embodiment, when the comparison result indicates that the files to be synchronized corresponding to the at least two directories are inconsistent, it is determined that the files synchronized from the trusted electronic device by the at least two directories are inconsistent. In this scenario, the directories are required to initiate file synchronization requests to the trusted electronic device, respectively, so that files required by the directories are obtained from the trusted electronic device through the file synchronization requests sent by the directories.
And when the comparison result is that the files to be synchronized corresponding to the at least two catalogues are consistent, determining that the at least two catalogues synchronize the same file from at least one trusted electronic device. And then, any one of the at least two directories requests to acquire the same file from the trusted electronic equipment, and the any one directory sends the acquired same file to other directories.
In the implementation manner, the files to be synchronized corresponding to the at least two catalogues are checked to ensure that the at least two catalogues are truly synchronized with the same file from the trusted electronic equipment, so that the files finally synchronized into each catalogue can be accurate, and the accuracy of file synchronization is improved.
Optionally, in one possible implementation manner, a list of files to be synchronized corresponding to each of the at least two directories is obtained, where each list of files to be synchronized includes files to be synchronized corresponding to each of the directories, and each file to be synchronized may include a file name, a file path, a file size, a creation date, a last modification time, a file type, a file version, and the like.
Traversing the file list to be synchronized corresponding to each directory, and determining whether at least two directories respectively correspond to the files to be synchronized. And when the fact that the files to be synchronized corresponding to the at least two directories are consistent is detected, determining that the at least two directories synchronize the same file from at least one trusted electronic device.
In the implementation manner, the file list to be synchronized corresponding to each directory is traversed, so that the situation that the file lists to be synchronized corresponding to each directory are different can be avoided, and the follow-up synchronization operation can be executed correctly.
Optionally, in one possible implementation manner, the step S3012 may further include a step S30121 and a step S30122, which are specifically as follows.
Referring to fig. 11, fig. 11 is a flowchart illustrating another file synchronization method according to an embodiment of the application. The method comprises the following steps:
S30321, metadata of files to be synchronized corresponding to at least two catalogues are obtained.
Metadata of the files to be synchronized is used to describe names of the files to be synchronized, file sizes, file creation time, file last modification time, file last access time, file types, file rights (e.g., read-write rights, execution rights, etc.), file owners, file attribute flags (e.g., specific flag bits used to indicate that the files belong to hidden files, or system files, or read-only files, etc.), file system information, file versions, file extension attributes (e.g., custom tags), relative paths, etc.
Illustratively, metadata of the files to be synchronized corresponding to each directory may be obtained by traversing the list of files to be synchronized. For example, scripts (such as Python scripts, powerShell scripts, etc.) may be used to traverse the list of files to be synchronized, and extract metadata of the files to be synchronized corresponding to each directory.
S30322, 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.
Illustratively, a check value is generated for each metadata. The check value may include a weak Hash value, a strong Hash value, a checksum, a Hash-based message authentication code (Hash-based Message Authentication Code, HMAC), and the like.
For example, the hash value corresponding to each metadata may be calculated by MD5 (MESSAGE DIGEST Algorithm 5) Algorithm, SHA-1 (Secure Hash Algorithm 1) Algorithm, SHA-2 (Secure Hash Algorithm 2) Algorithm, or the like.
The MD5 algorithm and the SHA-1 algorithm can be used for calculating weak hash values corresponding to each metadata.
Illustratively, metadata of a file to be synchronized is acquired, and a hash function corresponding to an MD5 algorithm is determined. And inputting the metadata of the file to be synchronized into a hash function, processing the metadata of the file to be synchronized by the hash function, and outputting a weak hash value with a fixed length.
In the implementation mode, the weak hash value is simple and efficient to calculate, so that the efficiency of the subsequent file synchronization can be improved under the condition that the safety of the file synchronization process is ensured, and the user experience is improved.
Alternatively, the check value corresponding to each metadata may also be generated by a check tool (such as md5sum, sha1sum, sha256sum, etc.).
And when detecting that the check values 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.
As described in connection with fig. 9, metadata of file 1 corresponding to the Repo directory of the device B and metadata of file 1 corresponding to the Repo directory are exemplarily obtained. Generating a check value of metadata of the file 1 corresponding to the Repo directory and a check value of metadata of the file 1 corresponding to the Repo directory, and determining that both the Repo directory and the Repo directory of the device B synchronize the file 1 from the device A when the two check values are consistent.
In the implementation manner, the metadata of the files to be synchronized corresponding to the at least two directories are checked to ensure that the at least two directories are truly synchronized with the same file from the trusted electronic equipment, so that the files finally synchronized into each directory can be accurate, and the accuracy of file synchronization is improved.
Optionally, in one possible implementation manner, the step S302 may further include a step S3021 and a step S3022, which are specifically as follows.
Referring to fig. 12, fig. 12 is a flowchart illustrating another file synchronization method according to an embodiment of the application. The method comprises the following steps:
s3021, any directory initiates a file synchronization request to at least one trusted electronic device.
The file synchronization request is used to trigger the at least one trusted electronic device to send the same file to any directory of the electronic device. The file synchronization request may include identification information of the file, the content of the requested file, the file path, a designated storage location, and the like.
For example, a file synchronization request is initiated to the device a through the Repo directory in the device B, and the device a scans the file system according to the file synchronization request to obtain the file 1 under the Repo directory. Device a sends file 1 to device B in its Repo directory.
S3022, marking other catalogs and synchronizing the same file with any catalogs.
Optionally, in an embodiment of the present application, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories may be marked, for example, to mark that the other directory is identical to the file synchronized with the any directory.
In one example, one state file may be created in each directory that is used to store the synchronization state information for each directory. The synchronous state information is used for recording that the catalogue and any catalogue synchronize the same file.
In another example, the file extension attribute in the metadata of the file to be synchronized corresponding to the other directory is used for a custom tag, the file extension attribute corresponding to the other directory can be changed, and the custom tag of the file extension attribute is used for indicating that the file to be synchronized to which the metadata belongs is the same as the file to be synchronized of any directory.
In yet another example, file paths of other directories are marked, the marked file paths representing that the corresponding directory is synchronized with the same file as any directory. For example, the file path may be marked by adding a specific extension or prefix to the file name corresponding to the other directory.
In the implementation mode, after any directory initiates a file synchronization request to at least one trusted electronic device, other directories are marked, so that after the same file is acquired by any subsequent directory, the same file is quickly and accurately sent to the marked other directories, the file which is finally synchronized to each directory can be accurate, and the accuracy of file synchronization is improved.
Optionally, in a possible implementation manner, the step S303 may further include a step S3031 and a step S3032, which are specifically as follows.
Referring to fig. 13, fig. 13 is a flowchart illustrating another file synchronization method according to an embodiment of the application. The method comprises the following steps:
s3031, acquiring file paths of other marked catalogues.
In one example, the file paths of the tagged other directories may be obtained using command line tools (e.g., command hints, ls commands, etc.) by detecting synchronization status information in the status file corresponding to each directory, determining the tagged other directory.
In another example, the tagged other directories may be determined by detecting file extension attributes in metadata of the file to be synchronized corresponding to each directory, and then obtaining file paths of the tagged other directories using a command line tool.
In yet another example, the tagged other directories may be determined by detecting the file name corresponding to each directory, after which the command line tool is employed to retrieve the file paths of the tagged other directories.
S3032, the same file is copied into the file paths of the marked other catalogues.
Illustratively, when the number of other directories is one, one and the same file is copied in any one directory, the copied same file is sent to the file path of the marked other directory by a move command.
When the number of other catalogues is multiple, the same number of the same files can be copied in any catalogue, the copied files are respectively sent to the file paths of the other catalogues to be marked through a moving command, one file can be copied in any catalogue, the copied files are sent to the file paths of the other catalogues to be marked through the moving command, one file is copied in any catalogue, the copied files are sent to the file paths of the other catalogues to be marked through the moving command, and the like.
In the implementation mode, after any directory in the electronic equipment acquires the same file to be synchronized, the same file is copied into the file paths of other directories according to the file paths of other marked directories, and the file is transmitted in the same electronic equipment, so that the transmission speed is high, the risk is low, and the efficiency and the safety of file synchronization are improved. No extra network bandwidth is consumed in the transmission process, the transmission cost is reduced, the influence of network fluctuation or external interference is not easy to occur, and the transmission reliability is improved. And the file operation is carried out in the same electronic equipment, so that the operating system and the file system of the electronic equipment can better maintain the attribute and the authority of the file and ensure the integrity of the file.
When file synchronization is performed between electronic devices in the trust ring, if the files to be synchronized of the electronic devices are stored in at least two trusted electronic devices, or the files to be synchronized of the electronic devices are stored in at least two source devices (i.e. the trusted electronic devices). Then it is necessary to determine from which source device (i.e. trusted electronic device) the file is synchronized, i.e. the synchronization source device that is ultimately used for synchronization, before file synchronization begins.
For ease of understanding, please refer to fig. 14, fig. 14 is a schematic diagram illustrating file synchronization according to an embodiment of the present application.
As shown in fig. 14, devices a and B represent source devices (i.e., trusted electronic devices) and device C represents a target device (i.e., electronic device). The device A and the device B are one sides for transmitting the files to be synchronized, and the device C is one side for receiving the files to be synchronized.
As shown in fig. 14, the device a includes a Repo directory, and a storage space corresponding to the Repo directory is used for storing a source file (i.e., a file to be synchronized), which is denoted by a file 1 in fig. 14. The device B includes a Repo directory, and a storage space corresponding to the Repo directory is also used for storing a source file (i.e. a file to be synchronized), which is denoted by a file 1 in fig. 14.
File 1 corresponding to the Repo directory in device a is the same as file 1 corresponding to the Repo directory in device B, and the versions of file 1 are all the latest versions. The Repo directory in device a and the Repo directory in device B correspond to different file paths, such as file path 1 and file path 2 shown in fig. 14, respectively.
Since the latest version of file 1 is stored in both device a and device B, it is necessary to determine whether to synchronize the file from device a or device B, i.e. whether to determine the synchronization source device that is ultimately used to synchronize file 1 to device C, before file synchronization begins.
In view of the above, the embodiment of the application also provides a file synchronization method, which is applied to electronic equipment, wherein a trust ring where the electronic equipment is located also comprises at least two trusted electronic equipment, the at least two trusted electronic equipment respectively store the same synchronization files, the method further comprises the steps of calculating a synchronization suitability score for each trusted electronic equipment according to a preset synchronization strategy, determining a synchronization source device in the at least two trusted electronic equipment according to the synchronization suitability score, and acquiring the synchronization files from the synchronization source device.
In the implementation manner, according to the preset synchronization strategy, the synchronization suitability score is calculated for the trusted electronic equipment, and the process of synchronizing the files by the synchronization source equipment is determined according to the synchronization suitability score, so that the most suitable synchronization source equipment can be selected from a plurality of trusted electronic equipment, the higher efficiency of synchronization operation can be ensured, and the consistency and accuracy of the synchronized files are maintained. Meanwhile, the overload condition can be avoided, the reasonable allocation and optimized use of equipment resources are ensured, unnecessary resource consumption is reduced, the file synchronization cost is reduced, and the reliability of file synchronization is enhanced.
And proper synchronous source equipment is selected through automatic scoring of a preset synchronous strategy, so that the complexity of manual decision making is simplified, and the human error is reduced.
The file synchronization method provided by the embodiment of the application is described below with reference to a flowchart.
Referring to fig. 15, fig. 15 is a flowchart of a file synchronization method according to an embodiment of the application. The method comprises the following steps:
S401, obtaining influence factors of each trusted electronic device.
And more than two pieces of electronic equipment pass through the trusted authentication, establish a trust relationship and form a trust ring. In the embodiment of the application, the trust ring where the electronic device is located also comprises at least two trusted electronic devices, and files to be synchronized by the electronic device are stored in the at least two trusted electronic devices.
For example, the same synchronization file is stored in at least two trusted electronic devices, respectively, and the versions of the synchronization files in at least two trusted electronic devices are all the latest versions.
The influencing factor is used to influence the determination of the synchronization source device, i.e. the influencing factor is a factor for influencing which trusted electronic device is chosen as synchronization source device. The synchronization source device is different and the file synchronization effect is different, that is, influencing factors may be used to influence the file synchronization effect between the electronic device and the trusted electronic device.
The influencing factors may include at least one of a power state, a device type, a network state, a device performance, a current power consumption of the device, a frequency of use of the device, and user preferences.
The device types may include NAS, PC, cell phone, wearable device, augmented Reality (AR)/Virtual Reality (VR) device, television, personal Digital Assistant (PDA), etc., among others. The PC may include a desktop, notebook, mini notebook, tablet, netbook, ultrabook, and the like.
The network state may include states of network bandwidth, network load, network security, etc. The network bandwidth is used for representing the data transmission rate, usually in units of bits per second, the network load is used for representing the transmitted data quantity and reflecting the busyness of the network, and the network security represents whether the trusted electronic equipment is safe currently through the running states of a firewall, an intrusion detection system, an intrusion prevention system and the like.
Device performance may include processor performance, memory capacity, storage performance, network connection speed, heat dissipation efficiency, operating system performance, multitasking capability, stability, and the like. The performance of the processor is embodied by a CPU model, a core number, a clock frequency, a cache size, an instruction set and the like; the storage performance is represented by the capacity, the read-write speed, the interface type and the like of a hard disk or a solid state disk, the network connection speed is represented by the speed, the quality and the supported network standard of a network interface, the heat dissipation efficiency is represented by the design, the fan speed, the heat dissipation material and the like of a heat dissipation system, the performance of an operating system is represented by the starting time, the loading time of an application program, the efficiency of system updating and maintenance and the like, the performance of the multitasking capability is represented by the simultaneous running of a plurality of application programs or processes, and the stability is used for representing the stability of the trusted electronic equipment under long-time running or high-load.
Illustratively, since the electronic device and at least two trusted electronic devices are both in the same trust ring, the electronic device in the trust ring can obtain the electric quantity state, the device type, the network state, the device performance, the current power consumption of the device, the user preference and the like of the trusted electronic device connected with the electronic device through the trust ring technology.
For example, the electronic device obtains the influencing factors of the trusted electronic device through the invocation of system services and application programming interfaces (Application Programming Interface, APIs) with the trusted electronic device.
Alternatively, the user preferences may be stored in the user's account settings and the electronic device may access the user preferences settings of the user on a different electronic device using a trust ring.
Alternatively, the trusted electronic device may also send the respective influencing factors to the electronic device.
S402, determining a synchronous source device in at least two trusted electronic devices according to the influence factors of each trusted electronic device.
In one example, a synchronization source device is determined among at least two trusted electronic devices based on any of the influencing factors. Any factor may be selected randomly or specified by the user, which is not limited.
For example, any one of the factors is a state of charge, which may include a remaining amount of power. And comparing the obtained residual electric quantity of each trusted electronic device, and determining the trusted electronic devices with more residual electric quantity as synchronous source devices.
In another example, a synchronization source device is determined among at least two trusted electronic devices based on any number of factors of influence. Any number of factors may be selected randomly or may be specified by the user, which is not limited.
S403, synchronizing the synchronous file from the synchronous source device.
The electronic equipment initiates a file synchronization request to the synchronization source equipment, and the synchronization source equipment sends the synchronization file to the electronic equipment after receiving the file synchronization request.
As described in connection with fig. 14, illustratively, device a is determined to be the synchronization source device, and device C initiates a file synchronization request to device a. Device a sends file 1 in the Repo directory to device C in the Repo directory.
In the implementation manner, the influence factors of each trusted electronic device are considered, so that the most proper synchronous source device can be selected from a plurality of trusted electronic devices, the synchronous operation can be ensured to be more efficient, and the consistency and the accuracy of the synchronous files are favorably kept. Meanwhile, the overload condition can be avoided, the reasonable allocation and optimized use of equipment resources are ensured, unnecessary resource consumption is reduced, the file synchronization cost is reduced, and the reliability of file synchronization is enhanced.
And proper synchronous source equipment is selected through automatic scoring of a preset synchronous strategy, so that the complexity of manual decision making is simplified, and the human error is reduced.
Optionally, in one possible implementation, determining the synchronization source device among the at least two trusted electronic devices based on the influencing factor of each trusted electronic device may include calculating a synchronization suitability score for each trusted electronic device based on the influencing factor of each trusted electronic device, and determining the synchronization source device among the at least two trusted electronic devices based on the synchronization suitability score of each trusted electronic device.
Illustratively, a scoring policy is set in advance for each of the influencing factors, and the scoring policy may include a scoring interval and a scoring rule. For example, the score interval corresponding to the battery status is 0 to 100 minutes, the score rule is that the battery is greater than 80% and 100 minutes, the battery is greater than 40% and less than or equal to 80% and 50 minutes, the battery is less than or equal to 40% and 0 minutes, the score interval corresponding to the device type is 0 to 80 minutes, the score rule is that the device type is NAS 80 minutes, the device type is PC 60 minutes, the device type is PAD 40 minutes, the device type is 20 minutes, the score interval corresponding to the network status is 0 to 100 minutes, the score rule is that the network status is a strong network connection status (such as low delay and high speed) is 100 minutes, the network status is a medium network connection status is 50 minutes, the network status is a weak network connection status (such as high delay and low speed) is 10 minutes, the score interval corresponding to the device use frequency is 1 to 50 minutes, the score rule is frequently used 50 minutes, the use is 25 minutes, the use is rarely 0 minutes, and the like, which is only illustrative and the score rule is occasionally used.
For example, for each trusted electronic device, the influence factor of the trusted electronic device is obtained, the score of each factor is calculated according to the scoring strategy corresponding to each factor, and then the sum of the scores corresponding to each factor is calculated to obtain the synchronization suitability score of each trusted electronic device.
In the implementation manner, the synchronization suitability score is calculated for the trusted electronic equipment, and the process of synchronizing the files by the synchronization source equipment is determined according to the synchronization suitability score, so that the most suitable synchronization source equipment can be selected from a plurality of trusted electronic equipment, the higher efficiency of synchronization operation can be ensured, and the consistency and accuracy of the synchronized files are maintained. Meanwhile, the overload condition can be avoided, the reasonable allocation and optimized use of equipment resources are ensured, unnecessary resource consumption is reduced, the file synchronization cost is reduced, and the reliability of file synchronization is enhanced.
Optionally, a weight value is assigned to each of the influencing factors based on a scoring strategy set in advance for each of the influencing factors, and the weight value may be determined based on a percentage or may be a fixed value.
The score of each factor is calculated according to the scoring strategy, the score of each factor is weighted in a weighted average mode, the score corresponding to each factor after being weighted is calculated, and the sum of the scores after being weighted is calculated to obtain the synchronization suitability score of each trusted electronic device.
In this implementation, by assigning different weights to different influencing factors, the accuracy of the final synchronization suitability score can be improved, so as to determine a more appropriate synchronization source device.
Alternatively, in one possible implementation, a machine learning model, such as a scoring model, may be pre-trained by which a synchronization suitability score is calculated for each trusted electronic device. For example, the influence factors corresponding to each trusted electronic device are obtained, each of the influence factors is input into a scoring model for processing, and the scoring model outputs the synchronization suitability score corresponding to each trusted electronic device.
In the implementation mode, the synchronization suitability score corresponding to each trusted electronic device is calculated through the pre-trained scoring model, so that the efficiency and accuracy of calculating the synchronization suitability score can be improved, and the efficiency and accuracy of synchronizing subsequent files are improved.
Optionally, in one possible implementation, when the device types of the at least two trusted electronic devices are different, determining the synchronization source device in the at least two trusted electronic devices according to the influencing factor of each trusted electronic device may include determining a priority of each trusted electronic device according to the influencing factor of each trusted electronic device, and determining the synchronization source device in the at least two trusted electronic devices according to the priority of each trusted electronic device.
Illustratively, each trusted electronic device is assigned a priority based on any one or more of its influencing factors. A trusted electronic device with a high priority is determined to be a synchronization source device.
For example, any one factor is the state of charge, the priority of the trusted electronic device with more residual power is higher than the priority of the trusted electronic device with less residual power, the first priority is allocated to the trusted electronic device with more residual power, and the second priority is allocated to the trusted electronic device with less residual power. Wherein the first priority is higher than the second priority. And determining the trusted electronic device corresponding to the first priority as the synchronous source device.
As another example, any number of factors are a state of charge and a device type, with the device type of each trusted electronic device within the trust ring being different. For example, the plurality of trusted electronic devices are NAS, PC, PAD and a mobile phone respectively, the priority of the NAS is determined to be larger than that of the PC according to the electric quantity state and the device type, the priority of the PC is larger than that of the PAD, and the priority of the PAD is larger than that of the mobile phone, and then the NAS in the trust ring is determined to be the synchronous source device.
Optionally, in one possible implementation, different priorities are determined for the trusted electronic devices of different device types in advance according to any one or more of the influencing factors. And acquiring the device type of each trusted electronic device in the trust ring, and determining the trusted electronic device with the device type with high priority as the synchronization source device. For example, the NAS priority is determined to be greater than the PC, the PC priority is greater than the PAD, and the PAD priority is greater than the handset according to the state of charge and the device type. And if the device types of the plurality of trusted electronic devices in the current trust ring are NAS and PAD respectively, determining the NAS as a synchronous source device.
In the implementation mode, the synchronous source equipment is determined by determining the priority of the equipment, and resources can be reasonably allocated according to the importance and the functions of different equipment, so that the proper synchronous source equipment can be chosen, and the efficiency and the accuracy of the subsequent file synchronization are improved.
Optionally, if the synchronization source device has a problem, other devices can be automatically determined as standby synchronization source devices, so that continuity of file synchronization operation is ensured.
The file synchronization method provided by the embodiment of the application is suitable for any scene requiring file synchronization in near field communication.
In the process of file synchronization between electronic devices in a trust ring, files in the electronic devices need to be monitored and scanned, or file paths/file catalogues corresponding to the files need to be monitored and scanned. When a plurality of file paths/file directories need to be monitored and scanned, even if the inclusion relationship exists among the plurality of file paths/file directories, in the related art, each file path/file directory needs to be monitored and scanned, and each monitoring needs to create a corresponding monitoring task, or each monitoring needs to start a corresponding monitoring thread, so that the number of started monitoring threads is increased, the number of times of scanning the file paths/file directories is excessive, and finally, the file synchronization efficiency is low and the power consumption of the electronic equipment is high.
In view of the above, the embodiment of the application also provides a method for processing data, which is applied to an electronic device, wherein a trust ring where the electronic device is located also comprises at least one trusted electronic device, and files in the electronic device can be synchronized into the at least one trusted electronic device.
The associated file path is a file path with a containing relation, the file path with the containing relation at least comprises a sub file path and a parent file path, a scanning result corresponding to the sub file path is notified to a scanning task corresponding to the parent file path, namely, a scanning result corresponding to the sub file path in the file path with the containing relation is notified to the parent file path in the file path with the containing relation.
Optionally, each scanning task corresponds to a file path, each file path corresponds to a file directory, and a file pointed by the file path and file content of the file can be found by scanning the file path.
Alternatively, the scanning task may include listening and scanning for file paths.
In the implementation manner, after the file paths with the inclusion relationship are determined, the scanning tasks corresponding to the file paths with the inclusion relationship are combined, and as the sub-file paths in the file paths with the inclusion relationship are notified of the scanning tasks corresponding to the parent file paths, even if the scanning tasks are combined, the scanning tasks corresponding to the file paths with the inclusion relationship can be ensured to be completed smoothly. And because the scanning tasks are combined, in the process of executing the combined scanning tasks, the same file path can be prevented from being scanned for multiple times, so that the scanning times are effectively reduced, namely the workload of repeated scanning is reduced, the power consumption of the electronic equipment is reduced, the resource allocation in the system is optimized, the whole file synchronization process is accelerated, and the subsequent file synchronization efficiency is improved.
Optionally, merging the scanning tasks corresponding to the associated file paths comprises 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 the target scanning time intervals of the target scanning task according to the at least two scanning time intervals. The target scanning time interval is larger than or equal to the smallest scanning time interval in at least two scanning time intervals and smaller than the largest scanning time interval in at least two scanning time intervals. In the implementation mode, as the scanning tasks are combined, the same file path can be effectively prevented from being scanned for multiple times in the process of executing the combined scanning tasks, so that the scanning times are effectively reduced, namely the workload of repeated scanning is reduced, the power consumption of electronic equipment is reduced, the resource allocation in a system is optimized, the whole file synchronization process is accelerated, and the subsequent file synchronization efficiency is improved.
Optionally, the method for processing the data can further comprise the step of scanning a file path corresponding to the target scanning task according to the target scanning time interval to obtain a scanned file. The scan file is used to synchronize into at least one trusted electronic device within the trust ring. In the implementation mode, the file paths corresponding to the target scanning task are purposefully scanned without considering other file paths, so that the scanning efficiency is improved, the whole file synchronization process is further accelerated, and the subsequent file synchronization efficiency is improved.
Optionally, the method for processing the data further comprises the steps of obtaining a list to be scanned, scanning each file path in the list to be scanned according to a target scanning time interval, obtaining a scanning result of any file path when any file path in the associated file paths is scanned, and feeding back the scanning result to a scanning task corresponding to each file path in the associated file paths. The list to be scanned includes associated file paths, file paths of unassociated scanning tasks, and unassociated file paths of associated scanning tasks. Alternatively, the list to be scanned includes all file paths.
In the implementation mode, when the associated file path is scanned, each scanning task corresponding to the associated file path can be ensured to receive the notification of the scanning result, so that the files scanned based on each scanning task can be conveniently and subsequently synchronized to the trusted electronic equipment, the scanning times are reduced, the power consumption of the electronic equipment is reduced, and meanwhile, the accuracy of file synchronization is ensured.
Optionally, the method for processing data can further comprise setting a 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 the implementation mode, the mode of setting the scanning starting time and then starting to scan the file path is adopted, so that the execution time of each scanning operation can be accurately recorded, and scanning errors are avoided. And determines the start and end times of each scanning operation, which helps to reasonably allocate system resources.
Optionally, feeding back the scanning result to the scanning task corresponding to each file path in the associated file paths, including adding the scanning result to a preset notification list. The notification list is used for feeding back the scanning result to the scanning task corresponding to each file path in the associated file paths.
Alternatively, the scan result may be obtained by calling a callback function.
In the implementation mode, the file scanned based on each scanning task is conveniently synchronized to the trusted electronic equipment, so that the scanning times are reduced, the power consumption of the electronic equipment is reduced, and meanwhile, the accuracy of file synchronization is guaranteed.
Optionally, the method for processing data can further comprise deleting all scanning results in the notification list after scanning each file path in the list to be scanned. In the implementation mode, all scanning results in the notification list are deleted once, so that the deleting step is simplified, and the deleting efficiency is improved.
Optionally, the method for processing data may further include deleting a scan result corresponding to any file path in the notification list after any file path in the associated file paths is scanned. In the implementation mode, a corresponding scanning result is deleted every time a file path is scanned, so that the storage space can be saved, the situation of error feedback is avoided, and the accuracy of file synchronization is improved.
Optionally, the method for processing data can further comprise acquiring a cancel scan notification and clearing a scan start time of the target scan task. The scan cancellation notification is used for canceling any scan task corresponding to the associated file path. In the implementation mode, when the cancellation of the scanning notification is acquired, the related information of the scanning task is cleared, so that more resources of the system can be released, the processing load of the system is reduced, and the processing speed of the system is improved. Meanwhile, different requirements of users in the file synchronization scene are responded in time, and user experience is improved.
Optionally, clearing the scan start time of the target scan job includes determining that no containment relationship exists between other plurality of file paths and clearing the scan start time of the target scan job. The other file paths are multiple file paths except the file path corresponding to any scanning task. When the implementation mode determines that the inclusion relation does not exist among other multiple file paths, the related information of the scanning task is cleared, the influence of the related information of the clearing scanning task on other scanning tasks is avoided, and the other scanning tasks can be successfully completed.
Optionally, after receiving the scan cancellation notification, the method for processing data may further include determining that an inclusion relationship exists between other multiple file paths, and merging scan tasks corresponding to the other multiple file paths having the inclusion relationship.
Optionally, determining that a containing relationship exists among other multiple file paths, acquiring scanning time intervals corresponding to the file paths with the containing relationship, merging scanning tasks corresponding to the file paths with the containing relationship into a new target scanning task, and setting the new scanning time intervals corresponding to the new target scanning task according to the scanning time intervals corresponding to the file paths with the containing relationship.
The new scanning time interval is larger than or equal to the smallest scanning time interval in the scanning time intervals corresponding to the file paths with the inclusion relationship, and smaller than the largest scanning time interval in the scanning time intervals corresponding to the file paths with the inclusion relationship.
In the implementation mode, after the cancellation of the scanning notification is obtained, the scanning tasks corresponding to the residual file paths with the inclusion relationship are combined, so that the repeated scanning of the same file path can be avoided when the combined scanning tasks are executed, the scanning times are effectively reduced, namely the repeated scanning workload is reduced, the power consumption of the electronic equipment is reduced, the resource allocation in the system is optimized, the whole file synchronization process is accelerated, and the subsequent file synchronization efficiency is improved.
It should be noted that the method for processing data provided by the application can be applied to any scene in which files need to be monitored and scanned. When file synchronization is performed between electronic devices in a trust ring, the method for processing data can be applied to the electronic devices and also can be applied to the trusted electronic devices.
In the related art, when file synchronization is performed between electronic devices in a trust ring, the synchronized files cannot be checked, so that inconsistency between the synchronized files and source files can occur, and the integrity of file synchronization is affected. If the synchronized file is tampered, security risks are brought to the electronic equipment in the trust ring, so that the whole file synchronization process is unsafe and is easy to make mistakes.
In view of the above, the embodiment of the application also provides a file synchronization method, which is applied to electronic equipment, wherein the trust ring where the electronic equipment is located also comprises at least one trusted electronic equipment, and the method comprises the steps of obtaining a file to be synchronized sent by the at least one trusted electronic equipment; generating a temporary synchronous file according to the file to be synchronized, checking the temporary synchronous file, and synchronizing the temporary synchronous file into a file system when the temporary synchronous file passes the check. Alternatively, verifying the temporary synchronization file may include verifying the integrity of the temporary synchronization file, the consistency of the temporary synchronization file with the source file, whether the temporary synchronization file functions properly, and the like.
In the implementation mode, the temporary synchronous file is checked, so that the file received by the electronic equipment is consistent with the source file, the integrity of file synchronization is ensured, and the accuracy of file synchronization is improved. The temporary synchronous file is checked, so that the synchronous file is not tampered, the system of the electronic equipment in the trust ring is prevented from being attacked by malicious software or viruses, and the safety of the file synchronization process is improved.
Optionally, checking the temporary synchronous file comprises obtaining source end metadata sent by at least one trusted electronic device, generating a check value corresponding to the temporary synchronous file and a check value corresponding to the source end metadata, and determining that the temporary synchronous file passes the check when the check value of the temporary synchronous file is detected to be consistent with the check value of the source end metadata. Optionally, the check value of the temporary synchronization file and the check value of the source metadata may each include a weak hash value, a strong hash value, a checksum, a hash-based message authentication code, and the like. In the implementation mode, the consistency check is equivalent to that of the temporary synchronous file and the source file, and the file is synchronized when the temporary synchronous file and the source file are consistent, so that the finally synchronized file is accurate, and the accuracy of file synchronization is improved. The temporary synchronous file is checked, the synchronous file is not tampered, the error is not easy to occur in the synchronous process, the system of the electronic equipment in the trust ring is effectively prevented from being attacked by malicious software or viruses, and the safety of the file synchronous process is improved.
Optionally, synchronizing the temporary synchronization file into the file system comprises 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 into the file system. Optionally, the file name of the temporary synchronization file after modification is consistent with the file name of the local file. In the implementation mode, the local file is deleted first, and then the file name of the temporary synchronous file is modified, so that file name conflict can be avoided, errors caused by inconsistent file names or file versions are reduced, and the integrity and consistency of file synchronization are guaranteed.
Optionally, generating the 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. In the implementation mode, the multi-terminal synchronization of the file is completed in an incremental synchronization mode, so that the data volume of file transmission can be effectively reduced, and the bandwidth is saved. And the data volume of transmission is reduced, so that the file synchronization process is quickened, and the overall data synchronization efficiency is improved. Meanwhile, the electronic equipment only needs to process the changed files, so that the load in the file synchronization process is effectively reduced, and the power consumption of the electronic equipment is reduced.
Optionally, before acquiring the file to be synchronized sent by the at least one trusted electronic device, the file synchronization method further comprises the steps of acquiring local metadata, comparing whether the local metadata are consistent with source metadata or not when the local metadata are detected to be matched with the local file, and updating the local file when the local metadata are consistent with the source metadata. In the implementation mode, the local metadata and the local file, and the local metadata and the source metadata are checked, and when the verification is passed, the subsequent file synchronization flow is executed, so that the accuracy of the subsequent file synchronization result can be ensured.
Optionally, the file synchronization method can further comprise determining difference data between the local metadata and the source metadata when the local metadata and the source metadata are inconsistent after comparing whether the local metadata and the source metadata are consistent when the local metadata and the local file are detected to be matched, and sending the difference data to at least one trusted electronic device.
The difference data is used for triggering at least one trusted electronic device to send a file to be synchronized to the electronic device. In the implementation mode, when the local file is determined to be different from the source file, the difference data is sent to the trusted electronic equipment, the trusted electronic equipment is triggered to send the file to be synchronized to the electronic equipment, and the guarantee is provided for achieving file synchronization.
Optionally, the file synchronization method may further include transmitting the source metadata and the difference data to at least one trusted electronic device after determining the difference data between the local metadata and the source metadata when the local metadata and the source metadata are inconsistent. The method comprises the steps of receiving source metadata from a trusted electronic device, sending the source metadata to the trusted electronic device to verify whether the source metadata is matched with a local file in the trusted electronic device, and sending difference data to trigger the trusted electronic device to send a file to be synchronized to the electronic device when the source metadata is matched with the local file in the trusted electronic device. In the implementation mode, the source file and the metadata of the trusted electronic equipment are checked first, and the subsequent file synchronization flow is executed under the condition that the source file has no problem, so that the accuracy of the subsequent file synchronization result can be ensured.
The file synchronization method provided by the embodiment of the application is described above with reference to the flowchart, and the hardware structure of the electronic device related to the embodiment of the application is briefly introduced with reference to the accompanying drawings.
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 (augmented reality, AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer, a UMPC, a netbook, a Personal Digital Assistant (PDA), or the like, or may be other devices or apparatuses capable of performing scene recognition, and the embodiments of the present application are not limited in any way with respect to the specific type of electronic device.
Referring to fig. 16, fig. 16 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the application.
As shown in fig. 16, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus, USB) interface 130, a charge 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, keys 190, a motor 191, an indicator 192, a camera 193, a display 194, a subscriber identity module (subscriber identification module, SIM) card interface 195, and the like. The sensor module 180 may include a pressure sensor 180A, a gyro sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.
It should be understood that the illustrated structure of the embodiment of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the application, electronic device 100 may include more or fewer components than those shown in FIG. 16, or electronic device 100 may include a combination of some of the components shown in FIG. 16, or electronic device 100 may include sub-components of some of the components shown in FIG. 16. The components shown in fig. 16 may be implemented in hardware, software, or a combination of software and hardware.
The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor (IMAGE SIGNAL processor, ISP), a controller, a video codec, a digital signal processor (DIGITAL SIGNAL processor, DSP), a baseband processor, and/or a neural network processor (neural-network processing unit, NPU), etc.
It should be understood that the connection relationship between the modules illustrated in this embodiment is only illustrative, and does not limit the structure of the electronic device 100. In other embodiments, the electronic device 100 may also employ different interfaces in the above embodiments, or a combination of interfaces.
The electronic device 100 may implement display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, and is connected to the display 194 and the application processor. GPUs can also be used to perform mathematical and pose calculations, for graphics rendering, and the like. Processor 110 may include one or more GPUs, the execution of which may generate or change display information.
The display 194 may be used to display images or video and may also display a series of graphical user interfaces (GRAPHICAL USER INTERFACE, GUIs), all of which are the home screen of the electronic device 100. Generally, the size of the display 194 of the electronic device 100 is fixed and only limited controls can be displayed in the display 194 of the electronic device 100. A control is a GUI element that is a software component that is included in an application program, controls all data processed by the application program and interactive operations on the data, and a user can interact with the control by direct operations (direct manipulation) to read or edit information about the application program. In general, controls may include visual interface elements such as icons, buttons, menus, tabs, text boxes, dialog boxes, status bars, navigation bars, widgets (widgets), and the like.
The display screen 194 in embodiments of the present application may be a touch screen. The display 194 may have the touch sensor 180K integrated therein. The touch sensor 180K may also be referred to as a "touch panel". That is, the display screen 194 may include a display panel and a touch panel, and a touch screen, also referred to as a "touch screen", is composed of the touch sensor 180K and the display screen 194. The touch sensor 180K is for detecting a touch operation acting thereon or thereabout. After a touch operation detected by the touch sensor 180K, a driving (e.g., TP driving) of the kernel layer may be transferred to an upper layer to determine a touch event type. Visual output related to the touch operation may be provided through the display 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the electronic device 100 at a different location than the display 194.
The external memory interface 120 may be used to connect an external memory card, such as a Micro SD card, to enable expansion of the memory capabilities of the electronic device 100. The external memory card communicates with the processor 110 through an external memory interface 120 to implement data storage functions. For example, files such as music, video, etc. are stored in an external memory card.
The internal memory 121 may be used to store computer-executable program code that includes instructions. The processor 110 executes various functional applications of the electronic device 100 and data processing by executing instructions stored in the internal memory 121. The internal memory 121 may include a storage program area and a storage data area. The storage program area may store an operating system, an APP (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like. The storage data area may store data created during use of the electronic device 100 (e.g., audio data, phonebook, etc.), and so on.
In addition, the internal memory 121 may include a high-speed random access memory, and the internal memory 121 may further include a nonvolatile memory such as at least one magnetic disk storage device, a flash memory device, a universal flash memory (Universal Flash Storage, UFS), and the like.
The keys 190 include a power-on key, a volume key, etc. The keys 190 may be mechanical keys. Or may be a touch key. The electronic device 100 may receive key inputs, generating key signal inputs related to user settings and function controls of the electronic device 100.
The motor 191 may generate a vibration cue. The motor 191 may be used for incoming call vibration alerting as well as for touch vibration feedback.
The file synchronization method and the file synchronization method provided in the embodiments of the present application may be implemented in the electronic device 100 having the above-described hardware structure.
The file synchronization method provided by the application is described below in connection with a software structure. Referring to fig. 17, fig. 17 is a schematic software structure of an electronic device according to an embodiment of the application.
Illustratively, the layered architecture divides the software into several layers, each with distinct roles and branches. The layers communicate with each other through a software interface. In the embodiment of the present application, an Android system is described as an example, and the Android system is divided into an Application (App) layer, an Application Framework (Framework) layer, and a hardware abstraction layer.
The application layer may include a series of application packages, such as a trust ring application, among others. In the embodiment of the application, the file synchronization SDK is integrated in the trust ring application, so that the trust ring application is configured with the file synchronization capability.
Optionally, the application layer may also include a database. The database provides functions such as data storage, data modification, data deletion, data addition, data query and the like for the application program.
The application framework layer provides an application programming interface (Application Programming Interface, API) and programming framework for the application of the application layer. The application framework layer includes a number of predefined functions.
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 listening scan management module, and a timer. Wherein the REPO management module may include a REPO catalog, and the REPO management module may be used to manage the REPO catalog.
Alternatively, the application framework layer may also include a database.
Alternatively, the database may interact with a hardware abstraction layer, such as by operating system calls and managing data in a file system.
Alternatively, the hardware abstraction layer may comprise a file system.
The trust ring application, the file synchronization service module, the database and the file system implement the method for processing data and the file synchronization method in the above method embodiments through interaction, and specific reference may be made to the descriptions related to the foregoing embodiments, which are not repeated herein.
Examples of the file synchronization method provided by the embodiment of the application are described in detail above. It will be appreciated that the electronic device, in order to achieve the above-described functions, includes corresponding hardware and/or software modules that perform the respective functions. Those of skill in the art will readily appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as hardware or combinations of hardware and computer software. Whether a function is implemented as hardware or computer software driven hardware depends upon the particular application and design constraints imposed on the solution. Those skilled in the art may implement the described functionality using different approaches for each particular application in conjunction with the embodiments, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The embodiment of the application can divide the functional modules of the electronic device according to the method example, for example, the functional modules can be divided into the functional modules corresponding to the functions, and two or more functions can be integrated in one module. The integrated modules may be implemented in hardware or in software functional modules. It should be noted that, in the embodiment of the present application, the division of the modules is schematic, which is merely a logic function division, and other division manners may be implemented in actual implementation.
It should be noted that, all relevant contents of each step related to the above method embodiment may be cited to the functional description of the corresponding functional module, which is not described herein.
The electronic device provided in this embodiment is configured to execute the file synchronization method, so that the same effect as that of the implementation method can be achieved.
In case an integrated unit is employed, the electronic device may further comprise a processing module, a storage module and a communication module. The processing module can be used for controlling and managing the actions of the electronic equipment. The memory module may be used to support the electronic device to execute stored program code, data, etc. And the communication module can be used for supporting the communication between the electronic device and other devices.
Wherein the processing module may be a processor or a controller. Which may implement or perform the various exemplary logic blocks, modules and circuits described in connection with this disclosure. A processor may also be a combination that performs computing functions, e.g., including one or more microprocessors, digital Signal Processing (DSP) and a combination of microprocessors, and the like. The memory module may be a memory. The communication module can be a radio frequency circuit, a Bluetooth chip, a WiFi chip and other equipment which interact with other electronic equipment.
The embodiment of the application also provides a computer readable storage medium, in which a computer program is stored, which when executed by a processor, causes the processor to execute the file synchronization method of any of the above embodiments.
The embodiment of the application also provides a device which can be a chip, a component or a module, and the device can comprise a processor and a memory which are connected, wherein the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory so that the chip can execute the method for processing data and the file synchronization method in the method embodiments.
The embodiment of the application also provides a computer program product, which when run on a computer, causes the computer to execute the above related steps to implement the file synchronization method in the above embodiment.
The embodiment of the application also provides a chip. Referring to fig. 18, fig. 18 is a schematic structural diagram of a chip according to an embodiment of the application. The chip shown in fig. 18 may be a general-purpose processor or a special-purpose processor. The chip includes a processor 210. The processor 210 is configured to perform the method for processing data and the file synchronization method according to any of the above embodiments.
Optionally, the chip further comprises a transceiver 220, and the transceiver 220 is configured to receive control of the processor and is configured to support the communication device to perform the foregoing technical solution.
Optionally, the chip shown in FIG. 18 may also include a storage medium 230.
It is noted that the chip shown in fig. 18 may be implemented using one or more field programmable gate arrays (field programmable GATE ARRAY, FPGAs), programmable logic devices (programmable logic device, PLDs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuit, or any combination of circuits capable of performing the various functions described throughout this application.
The electronic device, the computer readable storage medium, the computer program product or the chip provided in this embodiment are used to execute the corresponding method provided above, so that the beneficial effects thereof can be referred to the beneficial effects in the corresponding method provided above, and will not be described herein.
It will be appreciated by those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional modules is illustrated, and in practical application, the above-described functional allocation may be performed by different functional modules according to needs, i.e. the internal structure of the apparatus is divided into different functional modules to perform all or part of the functions described above.
In the several embodiments provided by the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another apparatus, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and the parts shown as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed in a plurality of different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a readable storage medium. Based on such understanding, the technical solution of the embodiments of the present application may be essentially or a part contributing to the prior art or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium, including several instructions for causing a device (may be a single-chip microcomputer, a chip or the like) or a processor (processor) to perform all or part of the steps of the methods of the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read Only Memory (ROM), a random access memory (random access memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
The foregoing is merely illustrative of the present application, and the present application is not limited thereto, and any person skilled in the art will readily recognize that variations or substitutions are within the scope of the present application. Therefore, the protection scope of the application is subject to the protection scope of the claims.

Claims (9)

1.一种文件同步方法,其特征在于,应用于电子设备,所述电子设备所在的信任环还包括至少两个受信任电子设备,所述方法包括:1. A file synchronization method, characterized in that it is applied to an electronic device, wherein the trust ring containing the electronic device further includes at least two trusted electronic devices, the method comprising: 获取每个受信任电子设备的影响因素;所述影响因素包括电量状态、设备类型、网络状态、设备性能、设备当前功耗以及用户偏好中的至少一项;Obtain the influencing factors for each trusted electronic device; the influencing factors include at least one of the following: battery status, device type, network status, device performance, current power consumption of the device, and user preferences; 根据所述影响因素,计算每个受信任电子设备对应的同步适宜度评分;根据每个受信任电子设备的同步适宜度评分,在所述至少两个受信任电子设备中确定同步源设备;Based on the aforementioned influencing factors, calculate the synchronization suitability score for each trusted electronic device; based on the synchronization suitability score for each trusted electronic device, determine the synchronization source device among the at least two trusted electronic devices; 确定所述电子设备中的至少两个目录均从所述同步源设备中同步同一文件;Determine that at least two directories in the electronic device are synchronizing the same file from the synchronization source device; 任一目录请求从所述同步源设备中获取所述同一文件;所述任一目录为所述至少两个目录中的任意一个目录;Any directory requests to obtain the same file from the synchronization source device; the any directory is any one of the at least two directories; 所述任一目录获取到所述同一文件后,创建所述同一文件对应的链接;所述链接用于指向所述同一文件;所述任一目录通过移动命令将所述链接发送给其他目录;所述其他目录为所述至少两个目录中除所述任一目录外的目录;其中,所述同一文件所属的目录存在包含关系,所述同一文件所属的子目录与所述任一目录直接映射,所述同一文件所属的父目录与所述其他目录直接映射。After any directory obtains the same file, it creates a link corresponding to the same file; the link is used to point to the same file; any directory sends the link to other directories via a move command; the other directories are directories other than any of the at least two directories; wherein, the directories to which the same file belongs have an inclusion relationship, the subdirectories to which the same file belongs are directly mapped to any of the directories, and the parent directories to which the same file belongs are directly mapped to the other directories. 2.根据权利要求1所述的方法,其特征在于,所述确定所述电子设备中的至少两个目录均从所述同步源设备中同步同一文件,包括;2. The method according to claim 1, wherein determining that at least two directories in the electronic device synchronize the same file from the synchronization source device includes; 获取待同步文件列表,所述待同步文件列表包括所述至少两个目录分别对应的待同步文件;Obtain a list of files to be synchronized, the list of files to be synchronized including the files to be synchronized corresponding to the at least two directories respectively; 对比所述至少两个目录分别对应的待同步文件;Compare the files to be synchronized corresponding to the at least two directories; 所述至少两个目录分别对应的待同步文件一致时,确定所述至少两个目录均从所述同步源设备中同步同一文件。When the files to be synchronized for the at least two directories are identical, it is determined that the at least two directories are synchronizing the same file from the synchronization source device. 3.根据权利要求2所述的方法,其特征在于,所述对比所述至少两个目录分别对应的待同步文件,包括:3. The method according to claim 2, wherein comparing the files to be synchronized corresponding to the at least two directories includes: 获取所述至少两个目录对应的待同步文件的元数据;Obtain the 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 is consistent, it is determined that the at least two directories are synchronizing the same file from the synchronization source device. 4.根据权利要求1至3任一项所述的方法,其特征在于,所述任一目录请求从所述同步源设备中获取所述同一文件,包括:4. The method according to any one of claims 1 to 3, characterized in that, the request for any directory to obtain the same file from the synchronization source device includes: 所述任一目录向所述同步源设备发起文件同步请求,所述文件同步请求用于触发所述同步源设备向所述电子设备发送所述同一文件;The directory initiates a file synchronization request to the synchronization source device, and the file synchronization request is used to trigger the synchronization source device to send the same file to the electronic device. 标记所述其他目录与所述任一目录同步同一文件。The other directories are marked as synchronizing the same file with any of the directories. 5.根据权利要求4所述的方法,其特征在于,所述任一目录请求从所述同步源设备中获取所述同一文件之后,所述方法还包括:5. The method according to claim 4, characterized in that, after any directory request obtains the same file from the synchronization source device, the method further includes: 获取被标记的其他目录的文件路径;Get the file paths of other marked directories; 将所述同一文件复制到被标记的其他目录的文件路径中。Copy the same file to the file path of the other tagged directory. 6.根据权利要求1所述的方法,其特征在于,所述至少两个受信任电子设备的设备类型不同,所述方法还包括:6. The method according to claim 1, wherein the at least two trusted electronic devices are of different device types, and the method further comprises: 根据每个受信任电子设备的影响因素,确定每个受信任电子设备的优先级;Based on the influencing factors of each trusted electronic device, determine the priority of each trusted electronic device; 根据每个所述受信任电子设备的优先级,在所述至少两个受信任电子设备中确定所述同步源设备。The synchronization source device is determined from the at least two trusted electronic devices according to the priority of each trusted electronic device. 7.一种电子设备,其特征在于,包括:一个或多个处理器;一个或多个存储器;所述存储器存储有一个或多个程序,当所述一个或者多个程序被所述处理器执行时,使得所述电子设备执行权利要求1至6中任一项所述的方法。7. An electronic device, characterized in that it comprises: one or more processors; one or more memories; said memories storing one or more programs, which, when executed by said one or more programs by said processors, cause the electronic device to perform the method of any one of claims 1 to 6. 8.一种芯片,其特征在于,包括:处理器,用于从存储器中调用并运行计算机程序,使得安装有所述芯片的电子设备执行如权利要求1至6中任一项所述的方法。8. A chip, characterized in that it comprises: a processor for calling and running a computer program from a memory, causing an electronic device on which the chip is mounted to perform the method as described in any one of claims 1 to 6. 9.一种计算机可读存储介质,其特征在于,所述计算机可读存储介质中存储了计算机程序,当所述计算机程序被处理器执行时,使得所述处理器执行权利要求1至6中任一项所述的方法。9. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program that, when executed by a processor, causes the processor to perform the method according to any one of claims 1 to 6.
CN202410389113.9A 2024-03-29 2024-03-29 File synchronization methods, electronic devices and storage media Active CN119248737B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410389113.9A CN119248737B (en) 2024-03-29 2024-03-29 File synchronization methods, electronic devices and storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410389113.9A CN119248737B (en) 2024-03-29 2024-03-29 File synchronization methods, electronic devices and storage media

Publications (2)

Publication Number Publication Date
CN119248737A CN119248737A (en) 2025-01-03
CN119248737B true CN119248737B (en) 2026-01-16

Family

ID=94018851

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410389113.9A Active CN119248737B (en) 2024-03-29 2024-03-29 File synchronization methods, electronic devices and storage media

Country Status (1)

Country Link
CN (1) CN119248737B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115348259A (en) * 2022-08-30 2022-11-15 中国银行股份有限公司 File transmission method, device, equipment and readable storage medium
CN116932479A (en) * 2022-03-31 2023-10-24 腾讯科技(深圳)有限公司 File transfer method and device

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103618795B (en) * 2013-11-29 2018-06-05 百度在线网络技术(北京)有限公司 Document handling method, the client and server of striding equipment
CN116009742A (en) * 2021-10-22 2023-04-25 华为技术有限公司 A cross-device file display method, device and system
CN117201510B (en) * 2022-05-30 2024-11-19 华为技术有限公司 File synchronization method, device, equipment and storage medium
CN116319826A (en) * 2022-12-30 2023-06-23 北京天融信网络安全技术有限公司 File synchronization method, system, electronic equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932479A (en) * 2022-03-31 2023-10-24 腾讯科技(深圳)有限公司 File transfer method and device
CN115348259A (en) * 2022-08-30 2022-11-15 中国银行股份有限公司 File transmission method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN119248737A (en) 2025-01-03

Similar Documents

Publication Publication Date Title
US9465696B2 (en) Methods and apparatus for multi-phase multi-source backup
US8255731B1 (en) Methods and apparatus for power state based backup
EP4321999A1 (en) Task transfer system and method
JP2016529599A (en) Content clipboard synchronization
CN106453589B (en) Method and device for synchronizing backup data
EP3016354A1 (en) Cloud-service-based data backup and operation method
US9930063B2 (en) Random identifier generation for offline database
US20140297586A1 (en) Device and method for cloud file management
CN118132204B (en) Container management method, device, equipment and medium
CN106599115B (en) Data protection method, device and terminal
WO2022042363A1 (en) Shared library multiplexing method and electronic device
CN114048469B (en) Directory operation management method, electronic device and readable storage medium
CN113938890B (en) Data sharing method and terminal equipment
CN119248737B (en) File synchronization methods, electronic devices and storage media
WO2022188683A1 (en) Flexibly authorized access control method, and related apparatus and system
CN119316420B (en) Device mounting methods, electronic devices and computer-readable storage media
CN116828588B (en) Communication method, readable medium, and electronic device
CN119248738B (en) Method for processing data, electronic device and storage medium
CN119248736B (en) File synchronization methods, electronic devices and storage media
WO2025050722A1 (en) Sandbox data processing method, and electronic device
CN104243572A (en) Data transmission method and device based on carry-on WiFi network
US10412586B2 (en) Limited-functionality accounts
CN116432218A (en) Methods for Resource Object Protection
CN114595203A (en) File synchronization method, terminal device and storage medium based on dual system
CN115599929B (en) File management method and electronic device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
CB02 Change of applicant information
CB02 Change of applicant information

Country or region after: China

Address after: Unit 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong 518040

Applicant after: Honor Terminal Co.,Ltd.

Address before: 3401, unit a, building 6, Shenye Zhongcheng, No. 8089, Hongli West Road, Donghai community, Xiangmihu street, Futian District, Shenzhen, Guangdong

Applicant before: Honor Device Co.,Ltd.

Country or region before: China

GR01 Patent grant
GR01 Patent grant