CN114157677A - Data synchronization method and related product - Google Patents

Data synchronization method and related product Download PDF

Info

Publication number
CN114157677A
CN114157677A CN202111527904.6A CN202111527904A CN114157677A CN 114157677 A CN114157677 A CN 114157677A CN 202111527904 A CN202111527904 A CN 202111527904A CN 114157677 A CN114157677 A CN 114157677A
Authority
CN
China
Prior art keywords
data
timestamp
synchronized
time stamp
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.)
Granted
Application number
CN202111527904.6A
Other languages
Chinese (zh)
Other versions
CN114157677B (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.)
Nanjing Opper Software Technology Co ltd
Original Assignee
Nanjing Opper Software Technology 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 Nanjing Opper Software Technology Co ltd filed Critical Nanjing Opper Software Technology Co ltd
Priority to CN202111527904.6A priority Critical patent/CN114157677B/en
Publication of CN114157677A publication Critical patent/CN114157677A/en
Application granted granted Critical
Publication of CN114157677B publication Critical patent/CN114157677B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application discloses a data synchronization method and a related product, wherein the method comprises the following steps: when the first device generates new data, acquiring a first timestamp of the first device, wherein the first timestamp is used for indicating a timestamp of the second device after the last data synchronization is completed, and the second device is any one of a plurality of electronic devices of which the first device needs to synchronize the new data; acquiring a second timestamp of the stored last data for synchronously sending the data to the second equipment; determining to-be-synchronized data corresponding to the second equipment according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time; and sending the data to be synchronized to the second equipment. Therefore, the method and the device are beneficial to reducing the communication times among the devices and improving the efficiency of data synchronization among the devices.

Description

Data synchronization method and related product
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data synchronization method and a related product.
Background
Under the era of mobile internet, the data updating speed is faster and faster. Generally, when a device a needs to synchronize data to be updated to a device B, the device a sends a new leaf node in a history submission record tree to the device B, the device B searches whether a new leaf node received by a pair exists in a local history submission record tree, if not, the device B continues to search whether a parent node of the new leaf node exists in the local history submission record tree, and if the parent node does not exist, the device a initiates a request to acquire the parent node until the existing parent node is found in the local history submission record tree of the device B. And when all the contents in the history submission record tree of the equipment A are synchronized to the equipment B, merging the history submission record trees of the equipment A and the equipment B to form a new submission tree, and finally, the history submission record trees of the equipment A and the equipment B are consistent, so that the equipment A and the equipment B finish data synchronization.
However, the above process has many times of communication between devices when synchronizing data, takes a long time, and has a high delay rate.
Disclosure of Invention
The embodiment of the application provides a data synchronization method and a related product, which are beneficial to reducing the communication times among devices and improving the efficiency of data synchronization among devices.
In a first aspect, an embodiment of the present application provides a data synchronization method, which is applied to a first device, and the method includes:
when the first device generates new data, acquiring a first timestamp of the first device, wherein the first timestamp is used for indicating a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices of which the first device needs to synchronize the new data;
acquiring a second timestamp of the stored last data for synchronously sending the data to the second equipment;
determining data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp and a current timestamp corresponding to the current time;
and sending the data to be synchronized to the second equipment.
In a second aspect, an embodiment of the present application provides a data synchronization method, which is applied to a second device, and the method includes:
receiving data to be synchronized sent by first equipment, wherein the data to be synchronized is determined by the first equipment according to a first time stamp, a second time stamp and a current time stamp corresponding to the current time, the first time stamp is used for indicating the time stamp after the last data synchronization of the second equipment is completed, and the second time stamp is used for indicating the time stamp corresponding to the last data synchronization stored in the first equipment to be sent to the second equipment.
In a third aspect, an embodiment of the present application provides a data synchronization apparatus, where the apparatus is applied to a first device, and the apparatus includes: an acquisition unit, a determination unit and a transmission unit, wherein,
the acquiring unit is configured to acquire a first timestamp of the first device when the first device generates new data, where the first timestamp is used to indicate a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices in which the first device needs to synchronize the new data;
the obtaining unit is further configured to obtain a second timestamp of the stored last data, and the second timestamp is used for synchronously sending data to the second device;
the determining unit is configured to determine to-be-synchronized data corresponding to the second device according to the first timestamp, the second timestamp, and a current timestamp corresponding to a current time;
the sending unit is configured to send the data to be synchronized to the second device.
In a fourth aspect, the present application provides a data synchronization apparatus, which is applied to a second device and includes a receiving unit, wherein,
the receiving unit is configured to receive data to be synchronized sent by a first device, where the data to be synchronized is determined by the first device according to a first timestamp, a second timestamp, and a current timestamp corresponding to a current time, the first timestamp is used to indicate a timestamp of the second device after data synchronization is completed last time, and the second timestamp is used to indicate a timestamp of the second device to which data is sent in the last data synchronization stored in the first device.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, a communication interface, and one or more programs, where the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps of any of the methods in the first aspect or the second aspect of the embodiment of the present application.
In a sixth aspect, the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program for electronic data exchange, where the computer program makes a computer perform part or all of the steps described in any one of the methods of the first aspect or the second aspect of the present application.
In a seventh aspect, this application provides a computer program product, where the computer program product includes a non-transitory computer-readable storage medium storing a computer program, where the computer program is operable to cause a computer to perform some or all of the steps as described in any of the methods of the first aspect or the second aspect of this application. The computer program product may be a software installation package.
It can be seen that, in this embodiment of the application, when the first device generates new data, the first device may obtain the first timestamp and the second timestamp, determine, according to the first timestamp, the second timestamp, and the current timestamp corresponding to the current time, data to be synchronized corresponding to the second device, and send the data to be synchronized to the second device. Therefore, the data to be synchronized corresponding to the second equipment can be directly determined according to the first time stamp and the second time stamp, the data to be synchronized is sent to the second equipment, the number of times of communication between the first equipment and the second equipment is reduced, and the efficiency of data synchronization between the equipment is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a schematic architecture diagram of a data synchronization system according to an embodiment of the present application;
fig. 2 is a schematic flowchart of a data synchronization method according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a data synchronization method according to an embodiment of the present application;
FIG. 4 is an interaction diagram of a data synchronization method provided in an embodiment of the present application;
fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
fig. 6A is a schematic diagram illustrating functional units of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 6B is a schematic diagram illustrating functional units of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 6C is a schematic diagram illustrating functional units of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 7A is a schematic diagram illustrating functional units of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 7B is a schematic diagram illustrating functional units of a data synchronization apparatus according to an embodiment of the present disclosure;
fig. 7C is a schematic diagram illustrating a functional unit composition of a data synchronization apparatus according to an embodiment of the present application.
Detailed Description
In order to make the technical solutions of the present application better understood, 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 only a part of the embodiments of the present application, and not all of the 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 terms "first," "second," and the like in the description and claims of the present application and in the above-described drawings are used for distinguishing between different objects and not for describing a particular order. Furthermore, the terms "include" and "have," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
The electronic device may be a portable electronic device such as a cell phone, a tablet computer, a wearable electronic device with wireless communication capabilities (e.g., a smart watch, a smart prosthesis), an in-vehicle device, etc., that also incorporates other functionality such as personal digital assistant and/or music player functionality. Exemplary embodiments of the portable electronic device include, but are not limited to, portable electronic devices that carry an IOS system, an Android system, a Microsoft system, or other operating system. The portable electronic device may also be other portable electronic devices such as a Laptop computer (Laptop) or the like. It should also be understood that in other embodiments, the electronic device may not be a portable electronic device, but may be a desktop computer. In an embodiment of the present application, the electronic device may include a first device and a second device. When the first device and/or the second device is a vehicle-mounted device, at least one of the following devices may be included: the present invention is not limited to the above embodiments, but may be implemented in various forms.
In a first section, example application scenarios disclosed in embodiments of the present application are described below.
Fig. 1 shows a schematic architecture diagram of a data synchronization system to which the present application is applicable, where the architecture diagram of the system may include a plurality of electronic devices, in the present application, an example is made only with three devices, the electronic devices may include a first device and a second device, and other numbers of electronic devices are consistent with the method described in the present application and are not described herein again.
Any one of the electronic devices can be used as a source device or a destination device; the source device may refer to a device that generates new data, and the destination device may receive data transmitted by the source device.
For example, if the first device is an intelligent bracelet, and the other two second devices are respectively a navigation device and a vehicle-mounted sound device, the intelligent bracelet, the navigation device and the vehicle-mounted sound device can be considered to be in the same data synchronization system, and data consistency of the three devices can be realized through the data synchronization system, that is, data among the three devices is kept to be the latest data.
For example, as shown in fig. 1, when the first device is a source device, an electronic device (second device) other than the first device in the figure is a destination device.
When new data is generated by first equipment, acquiring a first timestamp of the first equipment, wherein the first timestamp is used for indicating a timestamp sent to the first equipment by second equipment (the second equipment can refer to any one of fig. 1) after data synchronization is completed last time, and the second equipment is any one of a plurality of electronic equipment which needs to synchronize the new data by the first equipment; acquiring a second timestamp corresponding to second equipment when last data stored in first equipment is synchronized; determining to-be-synchronized data corresponding to the second equipment according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time; and sending the data to be synchronized to the second equipment.
Illustratively, the first device 101 stores therein a first timestamp corresponding to the second device 102 and a second timestamp corresponding to the second device 102. When the first device 101 generates new data, the first device 101 obtains a first timestamp corresponding to the second device 102 and a second timestamp corresponding to the second device 102, which are stored in the first device 101, determines data a to be synchronized corresponding to the second device 102 according to the first timestamp corresponding to the second device 102, the second timestamp corresponding to the second device 102, and the current timestamp, and sends the data a to be synchronized to the second device 102.
Similarly, the first device 101 also stores a first timestamp corresponding to the second device 103 and a second timestamp corresponding to the second device 103, and the first device 101 may determine the data B to be synchronized according to the first timestamp corresponding to the second device 103, the second timestamp corresponding to the second device 103, and the current timestamp, and send the data B to be synchronized to the second device 103.
It is understood that the first timestamp and the second timestamp corresponding to the second device 102 may be inconsistent or consistent with the first timestamp and the second timestamp corresponding to the second device 103, which is not limited herein.
It should be noted that when new data is generated in the second device, the second device may serve as a source device, and in this case, the first device may serve as a destination device.
In addition, in the present application, each electronic device may be a source device or a destination device, for example, when the electronic device is a source device (e.g., a first device in the present application), other electronic devices are destination devices (e.g., a second device in the present application) relative to the electronic device; when any other electronic device is a source device, the electronic device is a destination device with respect to any of the electronic devices.
It can be seen that in this system, when first equipment produced new data, first equipment can acquire first time stamp and second time stamp, according to first time stamp, the data of treating synchronization that second equipment corresponds is directly confirmed to second time stamp and current time stamp, and will treat synchronous data transmission to the second equipment, thus, can keep the data between first equipment and the second equipment unanimous, help reducing the number of times of communication between first equipment and the second equipment, help improving the efficiency of data synchronization between the equipment, be favorable to improving the synchronization performance of data in the system, thereby data between the equipment is unanimous in the realization system.
In the second section, the scope of protection of the claims disclosed in the embodiments of the present application is described below.
Referring to fig. 2, fig. 2 is a schematic flowchart of a data synchronization method applied to a first device according to an embodiment of the present application, where the data synchronization method includes the following operations.
S201, when the first device generates new data, obtaining a first timestamp of the first device, wherein the first timestamp is used for indicating a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices of which the first device needs to synchronize the new data.
S202, acquiring a second time stamp of the stored last data and sending the data to the second device synchronously.
S203, determining the data to be synchronized corresponding to the second device according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time.
And S204, sending the data to be synchronized to the second equipment.
The first device may refer to a device that generates the new data, such as a source device, which is not limited herein.
The second device may be a device that receives new data sent by the first device, for example, a destination device, which is not limited herein. There may be a plurality of second devices, and the plurality of second devices respectively receive the new data synchronized by the first device. The new data synchronized by the first device to the plurality of second devices may be the same or different, and is not limited herein.
The first timestamp may refer to a timestamp recorded by the second device after the last data synchronization of the first device stored in the system. The second timestamp may refer to a second timestamp for the first device to send data to the second device when the data is synchronized last time. The set reference for the time stamp is consistent between different devices in the same system.
When the first time stamp is consistent with the second time stamp, the data is consistent when the first time stamp is consistent with the second time stamp; when the first timestamp is inconsistent with the second timestamp, it indicates that the timestamps are inconsistent due to reasons such as that the second device is offline or other electronic devices perform data synchronization to the second device after the first device and the second device perform data synchronization last time.
Optionally, in this embodiment of the present application, the unsynchronized data may also be determined by a checkpoint; for example, the first device sends a checkpoint (which may refer to a timestamp corresponding to the last time data is synchronized) and data to be synchronized to the second device; if the check point of the first device is inconsistent with the check point of the second device, the first device updates the corresponding check point to be the check point of the second device, the data obtained by retrieving the local database for the check point of the second device and the current timestamp of the data to be synchronized is the data to be synchronized, and after the first device sends the data to be synchronized to the second device, the check point of the first device can be updated by using the timestamp corresponding to the data to be synchronized, namely, the timestamp corresponding to the last time data to be synchronized of the first device is updated to the timestamp corresponding to the data to be synchronized.
In addition, if when data is synchronized at a certain time, the first device sends data to be synchronized to the second device, and records that a timestamp for sending the data to be synchronized is a (which is a second timestamp in the present application), and after the second device successfully receives the data to be synchronized and successfully writes the data to be synchronized into a corresponding database, the second device also records that a timestamp for receiving the data to be synchronized is a (which is a first timestamp in the present application), at this time, the first timestamp is consistent with the second timestamp, that is, the timestamp of the data to be synchronized is always a timestamp for sending data by the first device, and the timestamp corresponds to the data to be synchronized.
The new data may refer to data monitored by the first device, or data obtained after the first device updates the local database, or data sent to the first device by another device, which is not limited herein. For example, if the first device may include an intelligent bracelet, the second device is a vehicle-mounted device, the intelligent bracelet may be configured to monitor physiological data of a user, such as heartbeat, blood pressure, and body temperature, and when the physiological data of the user changes, the intelligent bracelet may generate new data and synchronize the new data to the first device.
The data to be synchronized may be data that is determined by the first device according to the first timestamp and the second timestamp and needs to be sent to the second device. The data to be synchronized may be transmitted wirelessly or in a wired manner, which is not limited herein.
For example, the second device sends a first timestamp to the first device when the first device and the second device complete data synchronization the last time, the first timestamp being used to indicate the time when the second device completed data synchronization. And a second time stamp for the first device to send data to be synchronized to the second device is also stored in the first device. Under the condition that the first device generates new data, the first device can acquire the first time stamp, the second time stamp and the current time stamp, determine the data to be synchronized which needs to be sent to the second device at this time according to the first time stamp, the second time stamp and the current time stamp, and send the data to be synchronized to the second device.
It can be seen that, in this embodiment of the application, when the first device generates new data, the first device may obtain the first timestamp and the second timestamp, directly determine, according to the first timestamp, the second timestamp, and the timestamp corresponding to the current time, data to be synchronized corresponding to the second device, and send the data to be synchronized to the second device, which is beneficial to reducing the number of times of communication between the first device and the second device, and is beneficial to improving the efficiency of data synchronization between devices.
In one possible example, the method may further include the steps of: acquiring a third timestamp, wherein the third timestamp is used for indicating a timestamp of last data synchronization of the plurality of electronic devices by the first device; and retrieving a preset database to obtain the new data according to the current timestamp and the third timestamp corresponding to the current time.
The new data may refer to data generated after the first device completes data synchronization of the plurality of electronic devices at the last time, and is not limited herein.
The preset database may be a database pre-stored in the first device, or may be a database stored in a server communicatively connected to the first device, which is not limited herein.
For example, the first device generates the third timestamp after the last time the data synchronization of the plurality of electronic devices is completed. The third timestamp may be understood as a timestamp for starting data synchronization of the plurality of electronic devices, and the data generated in the preset database is determined as new data according to the current timestamp and the third timestamp corresponding to the current time, that is, after the data synchronization of the plurality of electronic devices is completed and before the current time.
It can be seen that, in the embodiment of the present application, if the new data is data obtained by updating the local database, a third timestamp may be obtained, where the third timestamp is used to indicate a timestamp for the first device to perform data synchronization on the multiple electronic devices last time; the method comprises the steps of retrieving a preset database to obtain new data according to a current timestamp and a third timestamp corresponding to current time, determining the new data generated in the preset database of the first device according to the current timestamp and the third timestamp, triggering data synchronization operation after the first device generates the new data, and executing subsequent data synchronization operation to keep the data among devices in a data synchronization system consistent.
In a possible example, the determining, according to the first timestamp, the second timestamp, and a current timestamp corresponding to a current time, data to be synchronized corresponding to the second device may include: if the second timestamp is not consistent with the first timestamp, determining a time range between the second timestamp and the current timestamp, and selecting data corresponding to the time range from the preset database as the data to be synchronized corresponding to the second device; and if the second time stamp is consistent with the first time stamp, determining the new data as the data to be synchronized.
In the specific implementation, the data synchronization is set to be the nth (N is a positive integer greater than 1) data synchronization, if the second device does not record or record the timestamp after the nth-1 data synchronization is failed after the nth-1 data synchronization is completed, the timestamp stored in the second device is the timestamp when the nth-2 data synchronization is completed, namely the second timestamp; then, when the first device receives new data, the timestamp stored in the first device is a timestamp when the data synchronization is completed for the (N-1) th time, that is, the first timestamp, it can be seen that the first timestamp and the second timestamp are inconsistent, because it is uncertain whether the data synchronization is successful when the data synchronization is last performed by the second device, in order to ensure the consistency of the data between the two devices, in this data synchronization, the second timestamp stored by the second device is taken as the reference, the data corresponding to the time range between the second timestamp and the current timestamp is obtained as the data to be synchronized corresponding to the second device, and the second timestamp stored in the first device is updated as the current timestamp.
Further, if the first timestamp is consistent with the second timestamp, it indicates that the data consistency has been achieved between the second device and the first device after the last data synchronization, and the new data may be directly used as the data to be synchronized.
It can be seen that, in the embodiment of the present application, whether data between the first device and the second device are consistent can be determined by whether the first timestamp is consistent with the second timestamp, and data to be synchronized in the data synchronization is further selected according to whether the data are consistent; therefore, the validity of data synchronization is ensured, and the data consistency between the devices is indirectly ensured through whether the timestamps are consistent; meanwhile, the incremental data are determined to be the data to be synchronized which need to be synchronized through the time range corresponding to the time stamp, all the data do not need to be synchronized, and power consumption is saved.
In a possible example, the data to be synchronized includes the new data if the second timestamp is not identical to the first timestamp.
In a specific implementation, when the second timestamp is not consistent with the time indicated by the first timestamp, that is, when the first device synchronizes data to the second device last time, the second device does not successfully receive the data, at this time, the data to be synchronized includes not only new data generated in the first device but also data that is unsuccessfully synchronized with the data synchronized with the last time, that is, data between the first timestamp and the second timestamp.
In one possible example, the method may further include the steps of: and after the data to be synchronized is sent to the second equipment, acquiring a fourth time stamp for sending the data to be synchronized to the second equipment, and updating the second time stamp into the fourth time stamp.
In specific implementation, after the data to be synchronized is sent, the first device may obtain a fourth timestamp for sending the data to be synchronized to the second device, and update the second timestamp to the fourth timestamp, so that when the first device generates new data again, the data to be synchronized, which is determined by the first device according to the first timestamp and the second timestamp, is the new data. The data to be synchronized is sent to the second equipment by the first equipment, and after the second equipment successfully receives the data, the data between the first equipment and the second equipment are consistent, so that the accuracy of next positioning of the data to be synchronized is improved, and the data consistency among multiple equipment is ensured.
Optionally, when there are multiple second devices, the first device may store a first timestamp corresponding to each second device, may obtain a second timestamp corresponding to each second device stored in the database in the system, and determine data to be synchronized corresponding to each second device according to the first timestamp and the second timestamp corresponding to each second device.
In a possible example, if there are a plurality of the second devices and a second timestamp corresponding to each of the second devices is consistent with the first timestamp, the sending the data to be synchronized to the second devices may include the following steps: determining the communication priority of each second device to obtain a plurality of communication priorities; determining an order in which the first device sends the data to be synchronized to the plurality of second devices according to the plurality of communication priorities; and sending the data to be synchronized to each second device according to the sequence.
The communication priority may refer to a sequence of data synchronization between the plurality of second devices and the first device, and the communication priority may be pre-stored in the first device, or may be dynamically adjusted according to factors such as the number of communications, the communication frequency, and the communication data amount corresponding to each second device and the first device, which is not limited herein.
The communication frequency may refer to the number of times that the second device communicates with the first device within a preset time period, which is not limited herein. The preset time length may be a default time length of the first device or the second device, or a time length determined according to user settings, which is not limited herein.
For example, the second timestamps corresponding to each second device are consistent, and the first timestamps corresponding to each second device are consistent, that is, the data sent by the first device to each second device is the same. At this time, the communication priority may be determined according to the communication frequency corresponding to each second device. For example, the higher the frequency of communication with the first device, the higher the corresponding communication priority may be. As another example, the lower the frequency of communication with the first device, the higher the corresponding communication priority may be. And are not limited herein.
In a specific implementation, according to a communication priority corresponding to each second device, determining an order in which the first device sends data to be synchronized to the plurality of second devices, and sending the data to be synchronized to each second device according to the order. The first device may send the data to be synchronized to the plurality of second devices, or may send the data to be synchronized to the plurality of second devices at the same time, which is not limited herein. The higher the communication priority corresponding to the second device is, the higher the priority of the first device sending the data to be synchronized to the second device may be, and this is not limited herein.
It can be seen that, in the embodiment of the present application, the order in which the first device sends the data to be synchronized to the multiple second devices is determined according to the communication priority corresponding to each second device, which is helpful for ensuring the ordering of data synchronization among the multiple devices, and further is helpful for ensuring the data synchronization efficiency.
Referring to fig. 3, fig. 3 is a schematic flowchart of a data synchronization method provided in an embodiment of the present application, applied to a second device, where as shown in the figure, the data synchronization method includes the following operations:
s301, receiving data to be synchronized sent by first equipment, wherein the data to be synchronized is determined by the first equipment according to a first time stamp, a second time stamp and a current time stamp corresponding to the current time, the first time stamp is used for indicating the time stamp after the data synchronization of the second equipment is completed last time, and the second time stamp is used for indicating the time stamp corresponding to the data sent to the second equipment by the last data synchronization stored in the first equipment.
In a specific implementation, the present embodiment corresponds to the foregoing embodiment of the data synchronization method applied to the first device, and the detailed description may refer to the foregoing steps S201 to S204, which are not repeated herein.
In one possible example, the method may further include the steps of: and after data synchronization is finished according to the data to be synchronized, determining a fifth time stamp of the data to be synchronized, and updating the first time stamp into the fifth time stamp.
In a specific implementation, after the second device completes data synchronization of the data to be synchronized, a fifth timestamp of the data synchronization of this time may be determined, and in essence, if the data to be synchronized of this time is successful, the fifth timestamp is the same as a fourth timestamp of the data to be synchronized sent by the first device. Therefore, the synchronization of the data to be synchronized can be completed, and the data consistency of the two devices relative to the data to be synchronized can be ensured.
The fifth timestamp and the fourth timestamp may be used as a criterion for determining whether data between the first device and the second device are consistent when data of the first device and the second device are synchronized next time, and are not described herein again.
Optionally, if there is historical data in the second device that is the same as the key value of the data to be synchronized, the method further includes the following steps: determining the maximum timestamp in the timestamps corresponding to the historical data and the fifth timestamps corresponding to the data to be synchronized; and reserving the data corresponding to the maximum timestamp.
In a specific implementation, the first device and the second device may store data in a Key Value database (Key-Value) form, and if the second device has historical data that is the same as a Key Value (Key) of data to be synchronized, it indicates that the data to be synchronized may also be stored in the second device, but the data (Value) corresponding to the Key Value may be different; moreover, the data synchronization is for the data to be synchronized in the first device, and it may be that when the data synchronization is completed by the second device, another first device sends the data to be synchronized to the second device, or data delay may occur when the data to be synchronized of the first device is stored, so that it is necessary to determine whether the data to be synchronized is the latest data, and then it is possible to determine the maximum timestamp of the timestamp corresponding to the historical data and the fifth timestamp corresponding to the data to be synchronized, and retain the data corresponding to the maximum timestamp, which is helpful to ensure that the data stored in the second device is the latest data.
It should be noted that, if the timestamp corresponding to the historical data is the maximum timestamp, the timestamp corresponding to the historical data is retained as the maximum timestamp, and the fifth timestamp is different from the fourth timestamp.
For example, if the device a synchronizes the data a to be synchronized with the device B, the timestamp corresponding to the data to be synchronized is the timestamp a, at this time, the device C also synchronizes the data C to be synchronized with the device B, and the timestamp corresponding to the data to be synchronized is the timestamp C; wherein timestamp a may be greater than or less than timestamp C; then, when the device B stores the data a to be synchronized, if it is found that the key value of the data a to be synchronized is the same as that of the data C to be synchronized, and the timestamp C is greater than the timestamp a, it indicates that the time when the device C generates new data C to be synchronized is later than that of the data a to be synchronized of the device a, it indicates that the data a to be synchronized is the latest data, and the data C to be synchronized can be retained; meanwhile, the device a also synchronizes the data C to be synchronized generated by the device C, so that the synchronized data is the latest data, that is, the data C to be synchronized.
Referring to fig. 4, fig. 4 is an interaction diagram of a data synchronization method according to an embodiment of the present application, where the data synchronization method includes the following operations.
S401, when new data are generated by first equipment, obtaining a first time stamp of the first equipment, wherein the first time stamp is used for indicating a time stamp after data synchronization is completed last time by second equipment, and the second equipment is any one of a plurality of electronic equipment which needs to synchronize the new data by the first equipment.
S402, the first device acquires the stored last data and synchronously sends a second time stamp of the data to the second device.
S403, the first device determines the data to be synchronized corresponding to the second device according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time.
S404, the first equipment sends the data to be synchronized to the second equipment.
S405, the second device receives data to be synchronized sent by the first device, wherein the data to be synchronized is determined by the first device according to a first time stamp, a second time stamp and a current time stamp corresponding to the current time, the first time stamp is used for indicating the time stamp after the second device completes data synchronization last time, and the second time stamp is used for indicating the time stamp corresponding to the last data synchronization stored in the first device to send the data to the second device.
The above steps S401 to S404 may refer to steps S201 to S204 in the data synchronization method described in fig. 2. The step S405 may refer to the step S301 in the data synchronization method described in fig. 3. And will not be described in detail herein.
As can be seen, in the data synchronization method described in the embodiment of the present application, the first device may determine, according to the first timestamp, the second timestamp, and the current timestamp, to-be-synchronized data corresponding to the second device, and send the to-be-synchronized data to the second device. Therefore, the number of times of communication between the first device and the second device is reduced, and the efficiency of data synchronization between the devices is improved. Furthermore, the second device can receive the data to be synchronized sent by the first device, which is finally helpful to ensure the data consistency among multiple devices.
Referring to fig. 5, fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure, where the electronic device may be a first device. As shown, the electronic device includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor as instructions for:
when the first device generates new data, acquiring a first timestamp of the first device, wherein the first timestamp is used for indicating a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices of which the first device needs to synchronize the new data;
acquiring a second timestamp of the stored last data for synchronously sending the data to the second equipment;
determining data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp and a current timestamp corresponding to the current time;
and sending the data to be synchronized to the second equipment.
It can be seen that, the electronic device described in this embodiment of the application may obtain the first timestamp and the second timestamp when the first device generates new data, determine data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp, and the current timestamp corresponding to the current time, and send the data to be synchronized to the second device. Therefore, when the first device generates new data, the first device can acquire the first time stamp and the second time stamp, directly determines the data to be synchronized corresponding to the second device according to the first time stamp and the second time stamp, and sends the data to be synchronized to the second device, so that the number of times of communication between the first device and the second device is reduced, and the efficiency of data synchronization between the devices is improved.
In one possible example, the program further includes instructions for performing the steps of:
acquiring a third timestamp, wherein the third timestamp is used for indicating a timestamp of last data synchronization of the plurality of electronic devices by the first device;
and retrieving a preset database to obtain the new data according to the current timestamp and the third timestamp corresponding to the current time.
In one possible example, in the aspect of determining the data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp, and the current timestamp corresponding to the current time, the program includes instructions for performing the following steps:
if the second timestamp is not consistent with the first timestamp, determining a time range between the second timestamp and the current timestamp, and selecting data corresponding to the time range from the preset database as the data to be synchronized corresponding to the second device;
and if the second time stamp is consistent with the first time stamp, determining the new data as the data to be synchronized.
In a possible example, the data to be synchronized includes the new data if the second timestamp is not identical to the first timestamp.
In one possible example, the program further includes instructions for performing the steps of:
and after the data to be synchronized is sent to the second equipment, acquiring a fourth timestamp for sending the data to be synchronized to the second equipment, and updating the second timestamp into the fourth timestamp.
The electronic device shown in fig. 5 may also be a second device. As shown, the electronic device includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor as instructions for:
receiving data to be synchronized sent by first equipment, wherein the data to be synchronized is determined by the first equipment according to a first time stamp, a second time stamp and a current time stamp corresponding to the current time, the first time stamp is used for indicating the time stamp after the last data synchronization of the second equipment is completed, and the second time stamp is used for indicating the time stamp corresponding to the last data synchronization stored in the first equipment to be sent to the second equipment.
In one possible example, the program further includes instructions for performing the steps of:
and after data synchronization is finished according to the data to be synchronized, determining a fifth time stamp of the data to be synchronized, and updating the first time stamp into the fifth time stamp.
In one possible example, the program further includes instructions for performing the steps of:
determining the maximum timestamp in the timestamps corresponding to the historical data and the fifth timestamps corresponding to the data to be synchronized;
and reserving the data corresponding to the maximum timestamp.
The above description has introduced the solution of the embodiment of the present application mainly from the perspective of the method-side implementation process. It is understood that the electronic device comprises corresponding hardware structures and/or software modules for performing the respective functions in order to realize the above-mentioned functions. Those of skill in the art will readily appreciate that the present application is capable of hardware or a combination of hardware and computer software implementing the various illustrative elements and algorithm steps described in connection with the embodiments provided herein. Whether a function is performed as hardware or computer software drives hardware depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiment of the present application, the electronic device may be divided into the functional units according to the method example, for example, each functional unit may be divided corresponding to each function, or two or more functions may be integrated into one processing unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit. It should be noted that the division of the unit in the embodiment of the present application is schematic, and is only a logic function division, and there may be another division manner in actual implementation.
In the case of dividing each functional module by corresponding functions, fig. 6A shows a functional unit composition diagram of a data synchronization apparatus, as shown in fig. 6A, the apparatus is applied to a first device, and the data synchronization apparatus 600 may include: an acquisition unit 601, a determination unit 602, and a transmission unit 603, wherein,
the acquisition unit 601 may be used to support the terminal device to perform the above-described steps S201-S202, and/or other processes for the techniques described herein.
The determining unit 602 may be used to support the terminal device to perform step S203 described above, and/or other processes for the techniques described herein.
The sending unit 603 may be used to support the terminal device to perform step S204 described above, and/or other processes for the techniques described herein.
It can be seen that, in the data synchronization apparatus provided in this embodiment of the present application, when a first device generates new data, the first device may obtain a first timestamp of the first device, where the first timestamp is used to indicate a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices that the first device needs to synchronize the new data; acquiring a second timestamp of the stored last data for synchronously sending the data to the second equipment; determining to-be-synchronized data corresponding to the second equipment according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time; and sending the data to be synchronized to the second equipment. Therefore, when the first device generates new data, the first device can acquire the first time stamp and the second time stamp, directly determines the data to be synchronized corresponding to the second device according to the first time stamp and the second time stamp, and sends the data to be synchronized to the second device, so that the number of times of communication between the first device and the second device is reduced, and the efficiency of data synchronization between the devices is improved.
In one possible example, as shown in fig. 6B, a schematic diagram is formed for the functional units of the data synchronization apparatus, and the apparatus 600 may further include: a retrieval unit 604 for retrieving, among other things,
the obtaining unit 601 is configured to obtain a third timestamp, where the third timestamp is used to indicate a timestamp for the first device to perform data synchronization on the plurality of electronic devices last time;
the retrieving unit 604 is configured to retrieve a preset database according to the current timestamp and the third timestamp corresponding to the current time to obtain the new data.
It can be seen that, in the data synchronization apparatus provided in the embodiment of the present application, when the first device generates new data, a third timestamp is obtained, where the third timestamp is used to indicate a timestamp of last data synchronization performed on multiple electronic devices by the first device; retrieving a preset database to obtain new data according to a current timestamp and a third timestamp corresponding to the current time; acquiring a first time stamp and a second time stamp of a first device; determining to-be-synchronized data corresponding to the second equipment according to the first time stamp, the second time stamp and the current time stamp corresponding to the current time; and sending the data to be synchronized to the second equipment. Therefore, the new data generated in the preset database of the first device can be determined according to the current timestamp and the third timestamp, the data synchronization operation can be triggered after the new data is generated by the first device, and the subsequent data synchronization operation can be executed, so that the data consistency among the devices in the data synchronization system can be maintained.
In a possible example, in terms of determining to-be-synchronized data corresponding to the second device according to the first timestamp, the second timestamp, and a current timestamp corresponding to a current time, the determining unit 602 is specifically configured to:
if the second timestamp is not consistent with the first timestamp, determining a time range between the second timestamp and the current timestamp, and selecting data corresponding to the time range from the preset database as the data to be synchronized corresponding to the second device;
and if the second time stamp is consistent with the first time stamp, determining the new data as the data to be synchronized.
In one possible example, as shown in fig. 6C, a schematic diagram is formed for the functional units of the data synchronization apparatus, and the apparatus 600 may further include: an update unit 605, in which,
the updating unit 605 is configured to obtain a fourth timestamp for sending the data to be synchronized to the second device after sending the data to be synchronized to the second device, and update the second timestamp to the fourth timestamp.
It can be seen that, in the data synchronization apparatus provided in this embodiment of the application, when the first device generates new data, the first device may obtain the first timestamp and the second timestamp, directly determine, according to the first timestamp, the second timestamp, and the current timestamp corresponding to the current time, the data to be synchronized corresponding to the second device, send the data to be synchronized to the second device, obtain a fourth timestamp that sends the data to be synchronized to the second device, and update the second timestamp to the fourth timestamp. In this way, when the first device generates new data again, the data to be synchronized, which is determined by the first device according to the first time stamp and the second time stamp, is the new data. The data to be synchronized is sent to the second equipment by the first equipment, and after the second equipment successfully receives the data, the data between the first equipment and the second equipment are consistent, so that the accuracy of next positioning of the data to be synchronized is improved, and the data consistency among multiple equipment is ensured.
In the case of dividing each functional module by corresponding functions, fig. 7A shows a schematic diagram of another data synchronization apparatus, which is applied to a second device as shown in fig. 7A, the data synchronization apparatus 700 may include: a receiving unit 701 for receiving, among others,
the receiving unit 701 may be configured to receive data to be synchronized sent by a first device, where the data to be synchronized is determined by the first device according to a first timestamp, a second timestamp, and a current timestamp corresponding to a current time, the first timestamp is used to indicate a timestamp of the second device after data synchronization is completed last time, and the second timestamp is used to indicate a timestamp corresponding to last data synchronization stored in the first device and sent to the second device.
It can be seen that, in the data synchronization apparatus provided in this embodiment of the application, the second device may receive data to be synchronized sent by the first device, and the data to be synchronized is determined by the first device according to the first timestamp, the second timestamp, and the current timestamp corresponding to the current time. Therefore, the data consistency between the first equipment and the second equipment can be kept, the number of times of communication between the first equipment and the second equipment is reduced, the efficiency of data synchronization between the equipment is improved, the data synchronization performance in the system is improved, and the data consistency between the equipment in the system is realized.
In one possible example, as shown in fig. 7B, a schematic diagram is formed for the functional units of the data synchronization apparatus, and the apparatus 700 may further include: an updating unit 702, wherein the updating unit 702 may be configured to determine a fifth timestamp of the data to be synchronized after completing data synchronization according to the data to be synchronized, and update the first timestamp to the fifth timestamp.
It can be seen that, in the data synchronization apparatus provided in this embodiment of the application, the second device may receive the data to be synchronized sent by the first device, determine a fifth timestamp of the data to be synchronized after completing data synchronization according to the data to be synchronized, and update the first timestamp to the fifth timestamp. Therefore, the synchronization of the data to be synchronized can be completed, and the data consistency of the two devices relative to the data to be synchronized can be ensured.
In one possible example, as shown in fig. 7C, a schematic diagram is formed for the functional units of the data synchronization apparatus, and the apparatus 700 may further include: a determining unit 703 and a reserving unit 704, if there is history data identical to the key value of the data to be synchronized in the second device,
the determining unit 703 may be configured to determine a maximum timestamp in the timestamps corresponding to the historical data and the fifth timestamps corresponding to the data to be synchronized;
the retaining unit 704 may be configured to retain data corresponding to the maximum timestamp.
It can be seen that, in the data synchronization apparatus provided in the embodiment of the present application, when there is historical data that is the same as the key value of the data to be synchronized in the second device, the maximum timestamp in the timestamps corresponding to the historical data and the fifth timestamp corresponding to the data to be synchronized is determined, and the data corresponding to the maximum timestamp is retained. In this way, it is helpful to ensure that the data stored in the second device is up-to-date.
It should be noted that all relevant contents of each step related to the above method embodiment may be referred to the functional description of the corresponding functional module, and are not described herein again.
The electronic device provided by the embodiment is used for executing the data synchronization method, so that the same effect as the implementation method can be achieved.
In case an integrated unit is employed, the electronic device may comprise a processing module, a storage module and a communication module. The processing module may be configured to control and manage the actions of the electronic device, and for example, may be configured to support the electronic device to execute the steps executed by the acquiring unit 601, the determining unit 602, the sending unit 603, the retrieving unit 604, and the updating unit 605, or may be configured to support the electronic device to execute the steps executed by the receiving unit 701, the updating unit 702, the determining unit 703, and the retaining unit 704. The memory module may be used to support the electronic device in executing stored program codes and data, etc. The communication module can be used for supporting the communication between the electronic equipment and other equipment.
The processing module may be a processor or a controller. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. A processor may also be a combination of computing functions, e.g., a combination of one or more microprocessors, a Digital Signal Processing (DSP) and a microprocessor, or the like. The storage module may be a memory. The communication module may specifically be a radio frequency circuit, a bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
Embodiments of the present application also provide a computer storage medium, where the computer storage medium stores a computer program for electronic data exchange, the computer program enabling a computer to execute part or all of the steps of any one of the methods described in the above method embodiments, and the computer includes an electronic device.
Embodiments of the present application also provide a computer program product comprising a non-transitory computer readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the methods as described in the above method embodiments. The computer program product may be a software installation package, the computer comprising an electronic device.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present application is not limited by the order of acts described, as some steps may occur in other orders or concurrently depending on the application. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required in this application.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus may be implemented in other manners. For example, the above-described embodiments of the apparatus are merely illustrative, and for example, the above-described division of the units is only one type of division of logical functions, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit may be stored in a computer readable memory if it is implemented in the form of a software functional unit and sold or used as a stand-alone product. Based on such understanding, the technical solution of the present application may be substantially implemented or a part of or all or part of the technical solution contributing to the prior art may be embodied in the form of a software product stored in a memory, and including several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the above-mentioned method of the embodiments of the present application. And the aforementioned memory comprises: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable memory, which may include: flash Memory disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The foregoing detailed description of the embodiments of the present application has been presented to illustrate the principles and implementations of the present application, and the above description of the embodiments is only provided to help understand the method and the core concept of the present application; meanwhile, for a person skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (12)

1. A data synchronization method is applied to a first device, and is characterized by comprising the following steps:
when the first device generates new data, acquiring a first timestamp of the first device, wherein the first timestamp is used for indicating a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices of which the first device needs to synchronize the new data;
acquiring a second timestamp of the stored last data for synchronously sending the data to the second equipment;
determining data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp and a current timestamp corresponding to the current time;
and sending the data to be synchronized to the second equipment.
2. The method of claim 1, further comprising:
acquiring a third timestamp, wherein the third timestamp is used for indicating a timestamp of last data synchronization of the plurality of electronic devices by the first device;
and retrieving a preset database to obtain the new data according to the current timestamp and the third timestamp corresponding to the current time.
3. The method according to claim 2, wherein the determining the data to be synchronized corresponding to the second device according to the first timestamp, the second timestamp, and a current timestamp corresponding to a current time comprises:
if the second timestamp is not consistent with the first timestamp, determining a time range between the second timestamp and the current timestamp, and selecting data corresponding to the time range from the preset database as the data to be synchronized corresponding to the second device;
and if the second time stamp is consistent with the first time stamp, determining the new data as the data to be synchronized.
4. The method of claim 3, wherein the data to be synchronized comprises the new data if the second timestamp is not consistent with the first timestamp.
5. The method according to any one of claims 1-4, further comprising:
and after the data to be synchronized is sent to the second equipment, acquiring a fourth timestamp for sending the data to be synchronized to the second equipment, and updating the second timestamp into the fourth timestamp.
6. A data synchronization method applied to a second device is characterized by comprising the following steps:
receiving data to be synchronized sent by first equipment, wherein the data to be synchronized is determined by the first equipment according to a first time stamp, a second time stamp and a current time stamp corresponding to the current time, the first time stamp is used for indicating the time stamp after the last data synchronization of the second equipment is completed, and the second time stamp is used for indicating the time stamp corresponding to the last data synchronization stored in the first equipment to be sent to the second equipment.
7. The method of claim 6, further comprising:
and after data synchronization is finished according to the data to be synchronized, determining a fifth time stamp of the data to be synchronized, and updating the first time stamp into the fifth time stamp.
8. The method of claim 7, wherein if there is historical data in the second device that is the same as the key value of the data to be synchronized, the method further comprises:
determining the maximum timestamp in the timestamps corresponding to the historical data and the fifth timestamps corresponding to the data to be synchronized;
and reserving the data corresponding to the maximum timestamp.
9. A data synchronization apparatus, wherein the apparatus is applied to a first device, the apparatus comprising: an acquisition unit, a determination unit and a transmission unit, wherein,
the acquiring unit is configured to acquire a first timestamp of the first device when the first device generates new data, where the first timestamp is used to indicate a timestamp of a second device after data synchronization is completed last time, and the second device is any one of a plurality of electronic devices in which the first device needs to synchronize the new data;
the obtaining unit is further configured to obtain a second timestamp of the stored last data, and the second timestamp is used for synchronously sending data to the second device;
the determining unit is configured to determine to-be-synchronized data corresponding to the second device according to the first timestamp, the second timestamp, and a current timestamp corresponding to a current time;
the sending unit is configured to send the data to be synchronized to the second device.
10. A data synchronization apparatus, applied to a second device, the apparatus comprising a receiving unit, wherein,
the receiving unit is configured to receive data to be synchronized sent by a first device, where the data to be synchronized is determined by the first device according to a first timestamp, a second timestamp, and a current timestamp corresponding to a current time, the first timestamp is used to indicate a timestamp of the second device after data synchronization is completed last time, and the second timestamp is used to indicate a timestamp of the second device to which data is sent in the last data synchronization stored in the first device.
11. An electronic device comprising a processor, a memory, a communication interface, and one or more programs stored in the memory and configured to be executed by the processor, the programs comprising instructions for performing the steps in the method of any of claims 1-5 or any of claims 6-8.
12. A computer-readable storage medium, characterized in that a computer program for electronic data exchange is stored, wherein the computer program causes a computer to perform the method according to any one of claims 1-5 or any one of claims 6-8.
CN202111527904.6A 2021-12-14 2021-12-14 Data synchronization method and related product Active CN114157677B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111527904.6A CN114157677B (en) 2021-12-14 2021-12-14 Data synchronization method and related product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111527904.6A CN114157677B (en) 2021-12-14 2021-12-14 Data synchronization method and related product

Publications (2)

Publication Number Publication Date
CN114157677A true CN114157677A (en) 2022-03-08
CN114157677B CN114157677B (en) 2023-11-28

Family

ID=80451179

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111527904.6A Active CN114157677B (en) 2021-12-14 2021-12-14 Data synchronization method and related product

Country Status (1)

Country Link
CN (1) CN114157677B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116506507A (en) * 2023-06-29 2023-07-28 天津市城市规划设计研究总院有限公司 Data processing method based on client characteristics
CN116701526A (en) * 2022-12-05 2023-09-05 荣耀终端有限公司 Data synchronization method and electronic equipment

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297529A (en) * 2013-06-06 2013-09-11 浙江大学 Timestamp-based tree structure data synchronization method
CN104580454A (en) * 2014-12-31 2015-04-29 乐视网信息技术(北京)股份有限公司 Data synchronizing method, device and system
CN106254094A (en) * 2016-07-19 2016-12-21 中国银联股份有限公司 A kind of method of data synchronization and system
CN108200220A (en) * 2018-04-08 2018-06-22 武汉斗鱼网络科技有限公司 A kind of method of data synchronization, server and storage medium
CN108536752A (en) * 2018-03-13 2018-09-14 北京信安世纪科技有限公司 A kind of method of data synchronization, device and equipment
CN109462661A (en) * 2018-12-19 2019-03-12 深圳市随手科技有限公司 Method of data synchronization, device, computer equipment and storage medium
CN111104445A (en) * 2019-12-06 2020-05-05 杭州数梦工场科技有限公司 Data synchronization method, device and equipment
CN111245548A (en) * 2020-01-14 2020-06-05 平安国际智慧城市科技股份有限公司 Data synchronization method and device based on timestamp and computer equipment
CN112783848A (en) * 2021-01-20 2021-05-11 杭州数梦工场科技有限公司 Data synchronization method and device and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103297529A (en) * 2013-06-06 2013-09-11 浙江大学 Timestamp-based tree structure data synchronization method
CN104580454A (en) * 2014-12-31 2015-04-29 乐视网信息技术(北京)股份有限公司 Data synchronizing method, device and system
CN106254094A (en) * 2016-07-19 2016-12-21 中国银联股份有限公司 A kind of method of data synchronization and system
CN108536752A (en) * 2018-03-13 2018-09-14 北京信安世纪科技有限公司 A kind of method of data synchronization, device and equipment
CN108200220A (en) * 2018-04-08 2018-06-22 武汉斗鱼网络科技有限公司 A kind of method of data synchronization, server and storage medium
CN109462661A (en) * 2018-12-19 2019-03-12 深圳市随手科技有限公司 Method of data synchronization, device, computer equipment and storage medium
CN111104445A (en) * 2019-12-06 2020-05-05 杭州数梦工场科技有限公司 Data synchronization method, device and equipment
CN111245548A (en) * 2020-01-14 2020-06-05 平安国际智慧城市科技股份有限公司 Data synchronization method and device based on timestamp and computer equipment
CN112783848A (en) * 2021-01-20 2021-05-11 杭州数梦工场科技有限公司 Data synchronization method and device and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116701526A (en) * 2022-12-05 2023-09-05 荣耀终端有限公司 Data synchronization method and electronic equipment
CN116506507A (en) * 2023-06-29 2023-07-28 天津市城市规划设计研究总院有限公司 Data processing method based on client characteristics

Also Published As

Publication number Publication date
CN114157677B (en) 2023-11-28

Similar Documents

Publication Publication Date Title
CN114157677B (en) Data synchronization method and related product
EP4033374A1 (en) Method and device for synchronizing node data
CN103530362B (en) A kind of computer data reading/writing method for many copies distributed system
US20130297563A1 (en) Timestamp management method for data synchronization and terminal therefor
CN103634375A (en) Method, device and equipment for cluster node expansion
CN111901341B (en) State synchronization method and device
EP4213037A1 (en) Data storage and reconciliation method and system
CN111147392B (en) Data synchronization method, device and equipment based on block chain and readable storage medium
CN111158637A (en) Block chain-based random number generation method, equipment and storage medium
CN108345462B (en) Method and device for upgrading components
CN109165194B (en) Data unloading method and device, electronic equipment and storage medium
CN112000850B (en) Method, device, system and equipment for processing data
CN110830138A (en) Information processing method, electronic equipment and server
CN112667270B (en) Updating method of voice processing resource, computer equipment and storage device
CN111161072A (en) Block chain-based random number generation method, equipment and storage medium
CN111309693A (en) Data synchronization method, device and system, electronic equipment and storage medium
CN105610596B (en) Resource directory management method and network terminal
CN114827698B (en) Method, device, terminal equipment and storage medium for synchronizing play information
CN111198853A (en) Data processing method and device, electronic equipment and computer readable storage medium
CN117251456B (en) Main key value generation method and device, electronic equipment and storage medium
CN113297263A (en) Data processing method, device, system, electronic equipment and storage medium
CN106331897B (en) A kind of list processing method and processing device
JP6705041B2 (en) Communication terminal, setting method and program
CN112311521B (en) Equipment group audio synchronization method and device, electronic equipment and storage medium
CN117579639A (en) Method and system for synchronizing data of client and server in weak network environment

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
GR01 Patent grant
GR01 Patent grant