CN115269530A - Data synchronization method, electronic device and computer-readable storage medium - Google Patents

Data synchronization method, electronic device and computer-readable storage medium Download PDF

Info

Publication number
CN115269530A
CN115269530A CN202110474687.2A CN202110474687A CN115269530A CN 115269530 A CN115269530 A CN 115269530A CN 202110474687 A CN202110474687 A CN 202110474687A CN 115269530 A CN115269530 A CN 115269530A
Authority
CN
China
Prior art keywords
electronic device
data
data synchronization
file
electronic equipment
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.)
Pending
Application number
CN202110474687.2A
Other languages
Chinese (zh)
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110474687.2A priority Critical patent/CN115269530A/en
Publication of CN115269530A publication Critical patent/CN115269530A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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

Abstract

The embodiment of the application discloses a data synchronization method, electronic equipment and a computer readable storage medium, which relate to the technical field of communication, wherein the data synchronization method comprises the following steps: receiving a data synchronization request sent by the second electronic equipment, wherein the original data are stored in the second electronic equipment; and comparing the data size of the original data modified by the first electronic equipment with a preset threshold, and sending a synchronization strategy to the second electronic equipment according to the comparison result, wherein the second electronic equipment carries out data synchronization according to the synchronization strategy. Based on the embodiment of the application, the system resource waste of the electronic equipment can be avoided, the waiting time of a user is saved, and the user experience is improved.

Description

Data synchronization method, electronic device and computer-readable storage medium
Technical Field
The embodiment of the application relates to the technical field of communication, and in particular relates to a data synchronization method, electronic equipment and a computer-readable storage medium.
Background
File synchronization can be performed between two electronic devices, that is, after a file in one electronic device changes (also called differentiated data), a file in the other electronic device also changes correspondingly, which requires synchronization processing of files distributed in different devices.
When the electronic device synchronizes the file, one file may be divided into a plurality of file blocks and stored in a database or a disk of the electronic device. When one of the electronic devices modifies the file, that is, a plurality of file blocks are inserted into the file block, the file block at the modified position until the file block at the bottom end of the file is all transferred to the database or disk of the other electronic device. In this way, the input and output quantity of the electronic device is increased, the overall performance of the electronic device is reduced, and the use experience of the user is affected.
Disclosure of Invention
The embodiment of the application provides a data synchronization method, an electronic device and a computer readable storage medium.
In a first aspect, an embodiment of the present application provides a data synchronization method, which is applied to a first electronic device, and the method includes: receiving a data synchronization request sent by second electronic equipment, wherein the original data is stored in the second electronic equipment; and comparing the data size of the original data modified by the first electronic equipment with a preset threshold value, and sending a synchronization strategy to the second electronic equipment according to the comparison result, wherein the second electronic equipment carries out data synchronization according to the synchronization strategy.
By adopting the embodiment of the application, when the change of the original data of the first electronic equipment is confirmed, the data synchronization can be carried out on the second electronic equipment, and the synchronization strategy can be confirmed according to the comparison result of the data volume modified by the original data and the preset threshold value. Based on the design, the waste of system resources of the electronic equipment can be avoided, the power consumption of the system is saved, the waiting time of a user is saved, and the experience of the user is improved.
With reference to the first aspect, in a possible design, if the modified data amount is smaller than a preset threshold, a storage space is provided in the locally stored file block, where the storage space is used to place the modified data. Based on the design, the data in the local storage can be prevented from being completely transmitted to the second electronic equipment for synchronization.
With reference to the first aspect, in one possible design, the content of the file block is sent to a local storage of the second electronic device, and the second electronic device performs data synchronization according to the received file block.
With reference to the first aspect, in one possible design, if the modified data amount is greater than or equal to the preset threshold, a patch file is generated, and the generated patch file is sent to the second electronic device; and the second electronic equipment performs data synchronization according to the received patch file. Based on the design, the data in the local storage can be prevented from being sent to the second electronic equipment for synchronization.
With reference to the first aspect, in a possible design, the patch file includes a number of the current modification, a modification time, a modification location, a modified data size, and a modified file content.
With reference to the first aspect, in a possible design, if a first electronic device modifies a file block at the bottom end of a file, the file block at the bottom end of the file is sent to a second electronic device; and the second electronic equipment carries out data synchronization according to the file block at the bottom end of the file. By adopting the mode, the file block at the bottom end of the file can be sent to the second electronic equipment for data synchronization, the waste of system resources of the electronic equipment is avoided, and the user experience is improved.
In a second aspect, an embodiment of the present application further provides a data synchronization method, which is applied to a second electronic device, and the method includes: determining whether the original data of the first electronic equipment is changed; and if the original data of the first electronic equipment changes, sending a data synchronization request to the first electronic equipment, receiving a synchronization strategy sent by the first electronic equipment, and synchronizing data according to the synchronization strategy.
By adopting the embodiment of the application, the data synchronization can be requested after the original data of the first electronic equipment is changed, the waste of system resources of the electronic equipment can be avoided, the waiting time of a user is saved, and the experience of the user is improved.
With reference to the second aspect, in one possible design, it is determined whether metadata in a local storage of the second electronic device has changed; and if the metadata in the local storage is changed, determining that the second electronic equipment needs to perform data synchronization. Based on such a design, it is possible to determine whether data synchronization is required by determining whether metadata in the local storage has changed.
With reference to the second aspect, in one possible design, it is determined that the second electronic device does not need to perform data synchronization if the metadata in the local storage is not changed.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes a memory and a processor, and the processor is configured to implement the data synchronization method as described above when executing a computer program stored in the memory.
In a fourth aspect, embodiments of the present application further provide a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the data synchronization method as described above.
By adopting the data synchronization method, the electronic device and the computer readable storage medium provided by the embodiment of the application, when the change of the original data of the first electronic device is confirmed, the data synchronization can be performed on the second electronic device, and the synchronization strategy can be confirmed according to the comparison result of the modified data volume of the original data and the preset threshold value. Therefore, the data in the local storage can be prevented from being completely sent to the second electronic device for synchronization, the waste of system resources of the electronic device is avoided, the waiting time of a user is saved, and the experience of the user is improved.
Drawings
Fig. 1 is an architecture diagram of an application environment of a data synchronization method according to an embodiment of the present application.
Fig. 2 is a diagram of another application environment architecture of the data synchronization method provided in the embodiment of the present application.
Fig. 3 is a flowchart of a data synchronization method according to an embodiment of the present application.
Fig. 4 is another flowchart of a data synchronization method provided in an embodiment of the present application.
Fig. 5 is a diagram of another application environment of the data synchronization method according to the embodiment of the present application.
Fig. 6 is a schematic diagram of a first electronic device provided in an embodiment of the present application.
Fig. 7 is a schematic diagram of a second electronic device provided in an embodiment of the present application.
Description of the main elements
First electronic device 100
First memory 101
First processor 102
Second electronic device 200
Second memory 201
Second processor 202
The following detailed description will further illustrate the present application in conjunction with the above-described figures.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The term "and/or" in the present application is an association relationship describing an associated object, and means that there may be three relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The symbol "/" herein denotes a relationship in which the associated object is or, for example, a/B denotes a or B.
In the embodiments of the present application, the terms "first", "second", and the like are used only for distinguishing different objects, and are not intended to indicate or imply relative importance, nor order to indicate or imply order. For example, a first application, a second application, etc. is used to distinguish one application from another application and not to describe a particular order of applications, and features defined as "first" and "second" may explicitly or implicitly include one or more of the features.
In the description of the embodiments of the present application, the words "exemplary" or "such as" are used herein to mean serving as an example, instance, or illustration. Any embodiment or design described herein as "exemplary" or "e.g.," is not necessarily to be construed as preferred or advantageous over other embodiments or designs. Rather, use of the word "exemplary" or "such as" is intended to present concepts related in a concrete fashion.
When the electronic device performs data synchronization, when a plurality of file blocks are inserted into a file block of one of the electronic devices, all the file blocks at the modified position up to the file block at the bottom end of the file need to be transferred to the database or disk of the other electronic device. Therefore, the input and output quantity of the electronic equipment is increased, the overall performance of the electronic equipment is reduced, and the use experience of a user is influenced.
As shown in fig. 1, in some usage scenarios, for data synchronization of an electronic device, a hierarchical architecture concept may be applied, and a three-layer architecture mode (i.e., an application layer, a middle layer, and a data layer) is adopted.
The application layer may include an inventory management unit module, a business data management module, a procurement management module, and a delivery management module.
It can be understood that, in the embodiment of the present application, the middle layer may include a service logic layer and a data access layer. The inventory management module, the business data management module, the purchasing management module and the distribution management module are all connected with the business logic layer. Wherein the data layer may include a cloud storage database, which may be connected with a data access layer.
It can be understood that the data used for synchronization may be stored in the cloud storage database, and when the electronic device accesses the data, the electronic device may access the data through the cloud storage database in the cloud.
In the usage scenario described above, the electronic device may be in a local area network, that is, the electronic device cannot perform data synchronization by accessing the cloud. In addition, the time for carrying out data synchronization by accessing the cloud storage database is longer, and the user experience is reduced.
In another scenario, data used for synchronization is stored in each electronic device, and when one electronic device needs data synchronization, a data synchronization request needs to be initiated to another electronic device.
In the above usage scenario, if a data synchronization request is initiated to a single electronic device, the electronic device is often offline, and the user experience is affected.
Therefore, the embodiment of the application provides a data synchronization method and system, which can avoid the waste of system resources of electronic equipment, save the waiting time of a user, and improve the experience of the user.
As shown in fig. 2, the architecture of the data synchronization system provided in the embodiment of the present application may include: a first electronic device 100 and a second electronic device 200. The data synchronization method in the embodiment of the present application may be applied to an environment formed by two or more electronic devices, for example, the environment formed by the first electronic device 100 and the second electronic device 200.
The first electronic device 100 may establish a connection with the second electronic device 200 through a short-range wireless communication technology.
For example, the first electronic device 100 may establish a communication connection with the second electronic device 200 through Bluetooth (Bluetooth). The first electronic device 100 may also establish a connection with the second electronic device 200 through a Universal Serial Bus (USB).
In this embodiment, each of the first electronic device 100 and the second electronic device 200 may be a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware thereof includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
It is understood that the first electronic device 100 and the second electronic device 200 may store the same raw data. The first electronic device 100 may be, but is not limited to, a terminal device, a server, and the like, and the second electronic device may be, but is not limited to, a terminal device, a server, and the like.
In a possible usage scenario, when it is determined that the original data stored in the first electronic device 100 is not changed, that is, the original data of the first electronic device 100 and the original data of the second electronic device 200 are the same, the second electronic device 200 may read its own local data file, and no synchronization data is needed between the first electronic device 100 and the second electronic device 200.
In another possible usage scenario, the second electronic device 200 may need to synchronize data between the first electronic device 100 and the second electronic device 200 after determining that the original data stored in the first electronic device 100 is changed. For example, the second electronic device 200 may transmit a data synchronization request to the first electronic device 100.
Thus, after the second electronic device 200 receives the data synchronization request sent by the first electronic device, the second electronic device 200 may determine the synchronization policy according to the change of the modification point, the modification amount, the modification position, and the size degree of the local file.
The data synchronization system may be applicable to various scenes in which two different electronic devices store the same original data, for example, a primary-standby synchronization scene in which the first electronic device is a master device and the second electronic device is a slave device; for another example, the remote client synchronization system includes a scenario in which a central server and a remote client are synchronized, and in this scenario, the first electronic device is the central server, and the second electronic device is the remote client.
Optionally, the data synchronization system further includes other second electronic devices, the original data in each second electronic device is the same as the original data in the first electronic device, and any one of the second electronic devices may implement data synchronization with the first electronic device by using the data synchronization method.
The data synchronization method provided in the embodiment of the present application is suitable for a data synchronization system as shown in fig. 2, in which the first electronic device 100 and the second electronic device 200 may store the same original data.
In this embodiment, the data synchronization method may be applied to the second electronic device 200, and for the second electronic device 200 that needs to perform data synchronization, the data synchronization function provided by the method of the embodiment of the present application may be directly integrated on the second electronic device 200.
Please refer to fig. 3, which is a flowchart illustrating a data synchronization method according to an embodiment of the present application.
The data synchronization method may include the steps of:
step S31: it is determined whether the first electronic device 100 has already been networked with the second electronic device 200. If yes, go to step S32, otherwise, end.
In a specific scenario, the second electronic device 200 may determine whether the first electronic device 100 has already been networked with the second electronic device 200.
It is understood that, in the networking state of the first electronic device 100 and the second electronic device 200, resources stored by the first electronic device 100 and the second electronic device 200 may be shared in a designated network area. Therefore, when a certain electronic device specified in the network device node requests data synchronization, the electronic device can firstly inquire the cache file from the local computer and simultaneously send a data synchronization request to the network.
Step S32: the second electronic device determines whether the raw data of the first electronic device has changed. If so, the process proceeds to step S33, otherwise, the process proceeds to step S34.
For example, as shown in fig. 5, the metadata management in the second electronic device 200 may manage all data or files, and the metadata management may manage file metadata in a local storage.
It will be appreciated that the file metadata may be an index in a database, i.e. a collection of indexes, the metadata may be created by files in different electronic devices, belonging to a corpus.
Therefore, the second electronic device 200 may determine whether the second electronic device 200 needs to perform data synchronization by determining whether the index data is changed.
If the index data in the second electronic device 200 is changed, it may be determined that the original data of the first electronic device 100 is changed, that is, the original data of the first electronic device 100 is different from the original data of the second electronic device 200.
At this time, the second electronic device 200 needs to perform data synchronization operation, that is, the first electronic device 100 synchronizes data with the second electronic device 200.
Step S33: the second electronic device sends a data synchronization request to the first electronic device.
When the second electronic device 200 determines that the original data of the first electronic device 100 changes, that is, the first electronic device 100 has modified a file, at this time, the second electronic device 200 sends a data synchronization request to the first electronic device 100, and sends information such as a file identifier (changeID) in a local cache to the first electronic device 100.
Step S34: the second electronic device does not perform data synchronization.
If the index data in the second electronic device 200 is not changed, it may be determined that the original data of the first electronic device 100 is the same as the original data of the second electronic device 200. At this time, the second electronic device 200 does not need to perform an operation of data synchronization.
Step S35: and the second electronic equipment performs data synchronization.
In this embodiment of the application, after the second electronic device 200 sends the synchronization request to the first electronic device 100, the first electronic device 100 may determine the synchronization policy according to the change of the modification point, the modification amount, the modification position, and the size degree of the local file, and synchronize data to the second electronic device 200.
Please refer to fig. 4, which is a flowchart illustrating a data synchronization method according to another embodiment of the present application.
In this embodiment, the data synchronization method may be applied to the first electronic device 100, and for the first electronic device 100 that needs to perform multi-device communication, the data synchronization function provided by the method of the present application may be directly integrated on the first electronic device 100.
As shown in fig. 4, the data synchronization method specifically includes the following steps:
step S41: the first electronic device receives a data synchronization request of the second electronic device.
It is understood that after the first electronic device 100 modifies the file, the second electronic device 200 will send a data synchronization request to the first electronic device 100.
Step S42: the first electronic device determines a data synchronization policy.
In a possible implementation manner, the first electronic device 100 may determine the data synchronization policy according to a modification point, a modification amount, a modification position, and a size degree change of the local file.
Specifically, the first electronic device 100 may compare the data amount modified from the original data with a preset threshold, and may perform data synchronization on the second electronic device 200 according to the comparison result.
For example, the first electronic device 100 may select a first synchronization policy to synchronize data with the second electronic device 200 when it is determined that the modification amount of the data is less than a preset threshold.
For example, the first electronic device 100 may further select a second synchronization policy to synchronize the data with the second electronic device 200 when it is determined that the modification amount of the data is greater than or equal to the preset threshold.
Step S43: it is determined whether the modifier of the data is less than a preset threshold. If so, the process proceeds to step S44, otherwise, the process proceeds to step S45.
For example, if the application of the first electronic device 100 needs to modify the stored original data, the first electronic device 100 may obtain the size of the modifier of the data at this time, and further may determine whether the modifier of the data is smaller than a preset threshold.
Step S44: and reserving a storage space for the file blocks in the file content, wherein the storage space is used for placing the newly added file blocks.
In this embodiment, the file contents in the first electronic device 100 and the second electronic device 200 may be stored in a segment storage manner. The segment storage can store files in columns by dividing the files into specified sizes (XM).
For example, as shown in fig. 5, in the local storage of the first electronic device 100, the file content may include a file content block. Among them, the file content block may include a plurality of file blocks, such as file block 1, file block 2, file block 3, file block 4, and file block 5. The file block in the embodiment of the application may reserve a storage space, and the storage space in the file block may be used to place the newly added file block.
In this embodiment, when the file modifier is smaller than the preset threshold, the application of the first electronic device modifies the file by a small amount, that is, the storage space reserved in the file block can meet the storage requirement of the file modifier.
For example, if the modification amount of the application of the second electronic device 200 to the file block 2 in the file content is smaller than the preset threshold, that is, the storage space reserved in the file block 2 may satisfy the modification amount. Accordingly, the first electronic device 100 may transmit the contents of the file block 2 to the contents of the file stored locally in the second electronic device 200. Thereby, the operation of data synchronization of the first electronic device 100 to the second electronic device 200 can be completed.
If the modification amount of the application of the second electronic device 200 to the file block 3 in the file content is smaller than the preset threshold, the storage space reserved in the file block 3 at this time may satisfy the modification amount. Therefore, the first electronic device 100 may also transmit the content of the file block 3 to the file content stored locally in the second electronic device 200. Thereby, the operation of data synchronization of the first electronic device 100 to the second electronic device 200 can be completed.
Similarly, for another file block in the file content, for example, the modification amount of the file block 4 or the file block 5 is smaller than the preset threshold, the first electronic device 100 may also send the content of the other file block to the file content locally stored in the second electronic device 200. Thereby, the operation of the first electronic device 100 to synchronize data to the second electronic device 200 can be completed.
Based on such a method, after the first electronic device 100 completes data synchronization to the second electronic device 200, the application of the second electronic device 200 may use the data in the local storage.
It is understood that when the first electronic device 100 modifies the file, it will also modify the metadata information of the file blocks, where the metadata information of the file blocks may include a file block number and a modification time of the file block, for example, 0; 1; 2:1598002487.
Step S45: the first electronic equipment generates a patch file and updates original data stored in the second electronic equipment.
In the embodiment of the application, data can be stored in a different mode, namely the source file is not basically changed, and the modified file can be stored in a patch mode.
It is understood that the patch file may specifically include the following: 1. the number (changeID) of this time modification; 2. modification time (time); 3. modified position (offset); 4. modified data size (size); 5. locally modified file content (content).
When the modification amount of the first electronic device 100 to the stored original data is greater than a preset threshold, the first electronic device 100 generates a patch file, and updates the original data stored in the second electronic device 200 according to the patch file.
If the file is written into the local storage of the first electronic device 100, the content length, and the written offset address of the written file can be obtained. At this time, the local storage of the first electronic device 100 may generate a changeID according to the current time as a file name of a patch file, for example, 1604049133000.
In a possible implementation manner, the first electronic device 100 may determine a modification time (time) of each of the batch files in the file batch set, whether the modification time is after a time point when the first electronic device 100 and the second electronic device 200 generate a data difference, and perform a corresponding synchronization operation according to a determination result.
For example, as shown in fig. 5, if the modification time (time) of the patch1 of the file 1 is before the time point when the first electronic device 100 and the second electronic device 200 generate the data difference, the patch1 of the file 1 is not synchronized to the second electronic device 200. If the modification time (time) of the patch2 of the file 2 and the patch2 of the file 3 is after the time point when the first electronic device 100 and the second electronic device 200 generate the data difference, it is determined whether the total data size of the patch2 and the patch3 is larger than the chunk size. If the total data size of the patch2 and the patch3 is smaller than the block size, the patch2 of the file 2 and the patch3 of the file 3 are sent to the second electronic device 200, so as to synchronize the patch2 of the file 2 and the patch3 of the file 3 to the second electronic device 200. If the total data size of patch2 and patch3 is greater than the block size, the block (block) is synchronized to the second electronic device 200.
Specifically, the difference data between the modified data and the original data may be packaged into a patch file by the first electronic device 100, and the patch file may be sent to the second electronic device 200. The second electronic device 200 may parse the patch file to update the original data to the modified data stored in the second electronic device 200.
By adopting the mode, the data in the electronic equipment can be ensured to be updated in time, and meanwhile, the updating times of the data in the electronic equipment can be reduced, so that the performance of the electronic equipment is improved, and the user experience is improved.
It is understood that, in a possible implementation manner, if the second electronic device 200 modifies a file block in a bottom segment of the file content, for example, in the file content of the second electronic device 200, the file block 5 is a bottom file block, if a new file block is placed at the position of the file block 5, no patch file is generated regardless of the size of the new file block, and the file block 5 may be directly sent to the second electronic device 200.
By adopting the embodiment of the application, the data in the local storage can be prevented from being completely sent to the second electronic equipment for synchronization, the system resource waste of the electronic equipment is avoided, the user waiting time is saved, and the user experience is improved.
Referring to fig. 5, an application scenario diagram of the data synchronization method according to the embodiment of the present application is shown. As shown in fig. 5, the first electronic device 100 and the second electronic device 200 will be described as an example.
In one embodiment, the first electronic device 100 may be a master device and the second electronic device 200 may be a slave device.
In one possible implementation scenario, an application of the second electronic device 200 may access data in the local storage through a distributed file management framework and storage management. The distributed file management framework may manage file metadata in the local storage through metadata management, where the file metadata is an index in a database, and the second electronic device 200 may determine whether the second electronic device 200 needs to perform data synchronization with the first electronic device by determining whether the file metadata changes.
In a scenario of possible implementation, if the second electronic device 200 determines that data synchronization with the first electronic device 100 is required, a data synchronization request is sent to the first electronic device 100.
It is understood that the application of the first electronic device 100 may perform read and write operations of the file to its local storage through the distributed file management framework. If the file block written in the local storage of the first electronic device 100 is smaller than the preset threshold, the first electronic device 100 reserves a storage space for the file block in the file content, where the storage space is used to place the newly written file block, and sends the content of the file block to the file content locally stored in the second electronic device 200. If the file block written in the local storage of the first electronic device 100 is greater than or equal to the preset threshold, the patch file may be generated.
For example, if the data amount of the written file is greater than the predetermined threshold and the file is written into the file block 1, the storage management in the first electronic device 100 will generate a patch file patch1.
When the file is written into the file block 2, the storage management in the first electronic device 100 generates a patch file patch2, or when the file is written into the file block 3, the storage management in the first electronic device 100 generates a patch file patch3, so that a file patch set can be formed in the local storage of the first electronic device 100.
Thus, the first electronic device 100 may transmit the patch file to the second electronic device 200, and the second electronic device may update the data stored in the second electronic device 200 according to the patch file.
By adopting the mode, the data in the electronic equipment can be ensured to be updated in time, and the data in the electronic equipment can be reduced to be completely carried, so that the performance of the electronic equipment is improved, and the user experience is improved.
Fig. 6 is a schematic structural diagram of a first electronic device according to an embodiment of the present disclosure. In one embodiment, the first electronic device 100 includes a first memory 101 and at least one first processor 102.
Those skilled in the art should understand that the structure of the first electronic device shown in fig. 6 does not constitute a limitation of the embodiments of the present application, and the first electronic device 100 may also include more or less hardware or software than those shown in the figures, or different component arrangements.
In some embodiments, the first electronic device 100 includes a terminal capable of automatically performing numerical calculation and/or information processing according to instructions set or stored in advance, and the hardware includes but is not limited to a microprocessor, an application specific integrated circuit, a programmable gate array, a digital processor, an embedded device, and the like.
It should be noted that the first electronic device 100 is only an example, and other existing or future electronic products, such as those that can be adapted to the present application, should also be included in the scope of the present application.
In some embodiments, the first memory 101 is used to store program codes and various data. The first Memory 101 may include a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an Electrically Erasable Programmable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical disk Memory, a magnetic disk Memory, a tape Memory, or any other medium readable by a computer capable of carrying or storing data.
In some embodiments, the at least one first processor 102 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The at least one first processor 102 is a Control Unit (Control Unit) of the first electronic device, and executes various functions of the first electronic device 100 and processes data, for example, a function of executing data synchronization, by running or executing programs or modules stored in the first memory 101 and calling data stored in the first memory 101.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a terminal, or a network device) or a processor (processor) to execute parts of the methods according to the embodiments of the present application.
The first memory 101 has program code stored therein and the at least one first processor 102 can call the program code stored in the first memory 101 to perform related functions. In one embodiment of the present application, the first memory 101 stores a plurality of instructions that are executed by the at least one first processor 102 to implement a data synchronization method. Specifically, the method for implementing the instruction by the at least one first processor 102 may refer to the description of the relevant steps in the embodiment corresponding to fig. 3, which is not repeated herein.
Please refer to fig. 7, which is a schematic structural diagram of a second electronic device according to an embodiment of the present disclosure. In one embodiment, the second electronic device 200 comprises a second memory 201 and at least one second processor 202.
It will be appreciated by those skilled in the art that the configuration of the second electronic device shown in fig. 7 does not constitute a limitation of the embodiments of the present application, and that the second electronic device 200 may also comprise more or less hardware or software than those shown, or a different arrangement of components.
In some embodiments, the second electronic device 200 includes a terminal capable of automatically performing numerical calculation and/or information processing according to preset or stored instructions, and the hardware includes but is not limited to a microprocessor, an application specific integrated circuit, a programmable gate array, a digital processor, an embedded device, and the like.
It should be noted that the second electronic device 200 is only an example, and other existing or future electronic products, such as those that can be adapted to the present application, should also be included in the scope of the present application.
In some embodiments, the second memory 201 is used to store program codes and various data. The secondary Memory 201 may include a Read-Only Memory (ROM), a Random Access Memory (RAM), a Programmable Read-Only Memory (PROM), an Erasable Programmable Read-Only Memory (EPROM), a One-time Programmable Read-Only Memory (OTPROM), an electronically Erasable rewritable Read-Only Memory (EEPROM), a Compact Disc Read-Only Memory (CD-ROM) or other optical Disc Memory, a magnetic disk Memory, a tape Memory, or any other medium readable by a computer capable of carrying or storing data.
In some embodiments, the at least one second processor 202 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or may be composed of a plurality of integrated circuits packaged with the same function or different functions, including one or more Central Processing Units (CPUs), microprocessors, digital Processing chips, graphics processors, and combinations of various control chips. The at least one second processor 202 is a Control Unit (Control Unit) of the second electronic device, and executes various functions of the second electronic device 200 and processes data, for example, a function of performing data synchronization, by running or executing programs or modules stored in the second memory 201 and calling data stored in the second memory 201.
The integrated unit implemented in the form of a software functional module may be stored in a computer-readable storage medium. The software functional module is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a terminal, or a network device) or a processor (processor) to execute parts of the methods according to the embodiments of the present application.
The second memory 201 has program code stored therein and the at least one second processor 202 can call the program code stored in the second memory 201 to perform the related function. In one embodiment of the present application, the second memory 201 stores a plurality of instructions that are executed by the at least one second processor 202 to implement a data synchronization method. Specifically, the at least one second processor 202 may refer to the description of the relevant steps in the embodiment corresponding to fig. 4, which is not repeated herein.
It is obvious to a person skilled in the art that the present application is not restricted to details of the above-described exemplary embodiments, but that it can be implemented in other specific forms without deviating from the essential characteristics of the application. Accordingly, suitable modifications and variations of the above embodiments are intended to fall within the scope of the claims.

Claims (11)

1. A data synchronization method is applied to a first electronic device, and is characterized by comprising the following steps:
receiving a data synchronization request sent by second electronic equipment, wherein the second electronic equipment stores original data;
and comparing the data size of the original data modified by the first electronic equipment with a preset threshold value, and sending a synchronization strategy to the second electronic equipment according to the comparison result, wherein the second electronic equipment carries out data synchronization according to the synchronization strategy.
2. The data synchronization method of claim 1,
and if the modified data volume is smaller than a preset threshold value, setting a storage space in the locally stored file block, wherein the storage space is used for placing the modified data.
3. The data synchronization method according to claim 1 or 2,
and transmitting the content of the file block to a local storage of the second electronic equipment, and carrying out data synchronization by the second electronic equipment according to the received file block.
4. The data synchronization method according to any one of claims 1 to 3,
if the modified data volume is larger than or equal to the preset threshold value, generating a patch file, and sending the generated patch file to the second electronic equipment;
and the second electronic equipment performs data synchronization according to the received patch file.
5. The data synchronization method according to claim 4,
the patch file comprises the number, the modification time, the modification position, the modified data size and the modified file content of the current modification.
6. The data synchronization method according to any one of claims 1 to 5,
if the first electronic device modifies the file block at the bottom of the file, sending the file block at the bottom of the file to the second electronic device;
and the second electronic equipment carries out data synchronization according to the file block at the bottom end of the file.
7. A data synchronization method applied to a second electronic device is characterized by comprising the following steps:
determining whether the original data of the first electronic equipment is changed;
if the original data of the first electronic equipment changes, sending a data synchronization request to the first electronic equipment;
and receiving the synchronization strategy sent by the first electronic equipment, and synchronizing data according to the synchronization strategy.
8. The data synchronization method of claim 7,
determining whether metadata in a local storage of the second electronic device has changed;
and if the metadata in the local storage is changed, determining that the second electronic equipment needs to perform data synchronization.
9. The data synchronization method according to claim 7 or 8,
and if the metadata in the local storage is not changed, determining that the second electronic equipment does not need to perform data synchronization.
10. An electronic device, characterized in that the electronic device comprises a memory and a processor, the processor being configured to implement the data synchronization method according to any one of claims 1 to 6 or the data synchronization method according to any one of claims 7 to 9 when executing the computer program stored in the memory.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the data synchronization method according to one of claims 1 to 6 or carries out the data synchronization method according to one of claims 7 to 9.
CN202110474687.2A 2021-04-29 2021-04-29 Data synchronization method, electronic device and computer-readable storage medium Pending CN115269530A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110474687.2A CN115269530A (en) 2021-04-29 2021-04-29 Data synchronization method, electronic device and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110474687.2A CN115269530A (en) 2021-04-29 2021-04-29 Data synchronization method, electronic device and computer-readable storage medium

Publications (1)

Publication Number Publication Date
CN115269530A true CN115269530A (en) 2022-11-01

Family

ID=83745550

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110474687.2A Pending CN115269530A (en) 2021-04-29 2021-04-29 Data synchronization method, electronic device and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN115269530A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407338A (en) * 2023-12-15 2024-01-16 北京壁仞科技开发有限公司 System, method and computing device for data transmission synchronization

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117407338A (en) * 2023-12-15 2024-01-16 北京壁仞科技开发有限公司 System, method and computing device for data transmission synchronization
CN117407338B (en) * 2023-12-15 2024-03-19 北京壁仞科技开发有限公司 System, method and computing device for data transmission synchronization

Similar Documents

Publication Publication Date Title
CN104954468A (en) Resource allocation method and resource allocation device
US20160070475A1 (en) Memory Management Method, Apparatus, and System
CN111338806B (en) Service control method and device
CN111460474B (en) Method, device, memory and computer for implementing decentralization predictor
CN110572451B (en) Data processing method, device and storage medium
CN113961510B (en) File processing method, device, equipment and storage medium
CN107211003A (en) Distributed memory system and the method for managing metadata
EP4310691A1 (en) Blockchain-based data processing method, apparatus, and device, and storage medium
CN115269530A (en) Data synchronization method, electronic device and computer-readable storage medium
CN108111598B (en) Cloud disk data issuing method and device and storage medium
CN112667270A (en) Voice processing resource updating method, computer equipment and storage device
CN110347656A (en) The management method and device requested in document storage system
CN115794396A (en) Resource allocation method, system and electronic equipment
CN114493185A (en) Approval processing method, device, system, electronic equipment, storage medium and product
CN112380411A (en) Sensitive word processing method and device, electronic equipment, system and storage medium
CN114567644B (en) Data synchronization method and device and electronic equipment
CN113886078B (en) Method and device for realizing quota unified management based on dynamic threshold mechanism, electronic equipment and computer readable storage medium
CN114676093B (en) File management method and device, electronic equipment and storage medium
CN115604345B (en) Development method of application program and computer readable storage medium
CN117390078B (en) Data processing method, device, storage medium and computer equipment
EP4202675A1 (en) Information processing device, information processing method, and information processing program
KR20170097448A (en) Method and system for managing data geographically distributed
CN115686378A (en) Data storage method and device, electronic equipment and storage medium
CN115242617A (en) Big data cluster and operation authority control method and related components thereof
CN116112336A (en) Alarm data processing method and 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