Data updating method and device, electronic equipment, storage medium and program product
By sending device information and timestamps from the device to the server, incremental update data is determined and local data is replaced, thus solving the problems of network resource waste and low efficiency caused by full synchronization of OTA devices and achieving efficient data updates.
Patent Information
- Application Number
- CN202310457608.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-23
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2043-04-23
AI Technical Summary
In existing technologies, data updates or recycling of OTA devices require full synchronization between the device and the cloud, resulting in high network resource consumption and low efficiency, especially when the data volume is large.
By sending device information and the first timestamp to the server from the device, the server determines the incremental update data based on this information, replaces the corresponding local data with the incremental update data, and replaces the first timestamp with the second timestamp, thus avoiding a full update.
It reduces the waste of network resources, improves update efficiency, and avoids the problem of data that does not need to be updated being updated repeatedly.
Smart Images

Figure CN116610836B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data updating method, apparatus, electronic device, storage medium, and program product. Background Technology
[0002] In related technologies, data updates or recycling of OTA (Over-the-Air Technology) devices usually require a full synchronization between the device and the cloud, which means deleting all local data on the OTA device and then updating the data sent to the cloud.
[0003] However, when the amount of data being updated or recycled is large, there are problems such as high network resource consumption and low efficiency. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a data updating method, apparatus, electronic device, storage medium and program product.
[0005] In view of the above objectives, in a first aspect, this application provides a data update method applied to a device, the method comprising:
[0006] The device information and the first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0007] In response to receiving incremental update data and a second timestamp from the server, an incremental update data identifier corresponding to the incremental update data is determined; wherein, the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0008] A first local data identifier corresponding to the incremental update data identifier is determined, the first local data corresponding to the first local data identifier is replaced with the incremental update data, and the first timestamp is replaced with the second timestamp.
[0009] In one possible implementation, sending the device information and the first timestamp to the server, so that the server determines the incremental update data based on the device information and the first timestamp, includes:
[0010] In response to receiving an update instruction from the server instructing the device to perform a data update operation, the device information and a first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0011] In one possible implementation, sending the device information and the first timestamp to the server, so that the server determines the incremental update data based on the device information and the first timestamp, includes:
[0012] In response to the triggering of a target event, the device information and the first timestamp are sent to the server so that the server can determine incremental update data based on the device information and the first timestamp.
[0013] In one possible implementation, sending the device information and the first timestamp to the server so that the server determines the incremental update data based on the device information and the first timestamp includes:
[0014] Obtain the device information used to indicate the device type, and determine whether the first timestamp exists;
[0015] In response to the existence of the first timestamp, the device information and the first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0016] In one possible implementation, after determining whether the first timestamp exists, the method further includes:
[0017] In response to the absence of the first timestamp, the first timestamp is generated according to a preset initial time point, and the device information and the first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0018] In one possible implementation, the method further includes:
[0019] In response to receiving a data recycling instruction from the server, the recycling data identifier corresponding to the recycled data is determined according to the data recycling instruction;
[0020] Determine the second local data identifier corresponding to the recycled data identifier, and delete the second local data corresponding to the second local data identifier.
[0021] In one possible implementation, after replacing the first local data corresponding to the first local data identifier with the incrementally updated data and replacing the first timestamp with the second timestamp, the method further includes:
[0022] In response to receiving a data query request from the server, determine the first data quantity corresponding to all local data stored on the device.
[0023] The first data quantity and the device information are sent to the server so that the server can determine whether to send a full update command to the device based on the first data quantity and the device information.
[0024] In response to receiving a full update instruction from the server, the system obtains full update data according to the full update instruction and replaces all local data with the full update data.
[0025] In a second aspect, this application provides a data updating method applied to a server, the method comprising:
[0026] Receive device information and a first timestamp from the device; wherein, the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0027] Incremental update data is determined based on the device information and the first timestamp, and the incremental update data and the second timestamp are sent to the device; wherein, the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0028] In one possible implementation, before receiving the device information and the first timestamp from the device, the method further includes:
[0029] Send an update command to the device to instruct the device to perform a data update operation.
[0030] In one possible implementation, sending an update instruction to the device to instruct the device to perform a data update operation includes:
[0031] Examine the data record table used to store data distribution records and the distributed data to determine if there is a data distribution record corresponding to the incremental update data;
[0032] In response to determining that a data delivery record corresponding to the incremental update data exists in the data record table, an update command is sent to the device to instruct the device to perform a data update operation.
[0033] In one possible implementation, determining the incremental update data based on the device information and the first timestamp includes:
[0034] The data to be distributed within the update time period between the first timestamp and the second timestamp is determined based on the data record table;
[0035] The device type of the device terminal is determined based on the device information;
[0036] Determine the incremental update data in the distributed data that corresponds to the device type.
[0037] In one possible implementation, determining the data to be distributed within the update time period between the first timestamp and the second timestamp based on the data record table includes:
[0038] Determine whether the first timestamp exists in the pre-stored timestamp record table corresponding to the device.
[0039] If the first timestamp exists in the timestamp record table, the data to be sent within the update time period between the first timestamp and the second timestamp is determined according to the data record table.
[0040] In one possible implementation, after determining whether the first timestamp exists in the pre-stored timestamp record table corresponding to the device, the method further includes:
[0041] If the first timestamp does not exist in the timestamp record table, then it is determined whether the first timestamp is a preset initial time point;
[0042] In response to the first timestamp being a preset initial time point, the data to be sent within the update time period between the preset initial time point and the second timestamp is determined according to the data record table.
[0043] In one possible implementation, after determining whether the first timestamp is a preset initial time point, the method further includes:
[0044] If the first timestamp is not a preset initial time point, a termination command is sent to the device to instruct the device to terminate the data update operation.
[0045] In one possible implementation, the method further includes:
[0046] Send a data recycling instruction to the device so that the device deletes the second local data indicated by the recycling instruction stored in the device.
[0047] In one possible implementation, after determining the incremental update data based on the device information and the first timestamp, and sending the incremental update data and the second timestamp to the device, the method further includes:
[0048] Send a data query request to the device to determine the first data quantity corresponding to all local data stored on the device;
[0049] Determine whether the first data quantity is the same as the second data quantity corresponding to all local data stored on the server and on the device;
[0050] In response to the difference between the first data quantity and the second data quantity, a full update instruction is sent to the device to enable the device to obtain full update data according to the full update instruction and replace all local data with the full update data.
[0051] In one possible implementation, after receiving the device information and the first timestamp from the device, the method further includes:
[0052] Determine whether the device exists in the preset full update device set based on the device information;
[0053] In response to determining that the device exists in a preset set of devices for full updates, a full update instruction is sent to the device so that the device can obtain full update data according to the full update instruction and replace all local data with the full update data.
[0054] In a third aspect, this application provides a data updating apparatus applied to a device, the apparatus comprising:
[0055] The sending module is configured to send device information and a first timestamp to the server so that the server can determine incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0056] The determination module is configured to determine the incremental update data identifier corresponding to the incremental update data in response to receiving incremental update data and a second timestamp from the server; wherein the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0057] The update module is configured to determine a first local data identifier corresponding to the incremental update data identifier, replace the first local data corresponding to the first local data identifier with the incremental update data, and replace the first timestamp with the second timestamp.
[0058] In a fourth aspect, this application provides a data updating apparatus applied to a server, the apparatus comprising:
[0059] The receiving module is configured to receive device information and a first timestamp from the device; wherein the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0060] The determination module is configured to determine incremental update data based on the device information and the first timestamp, and send the incremental update data and the second timestamp to the device; wherein the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0061] In a fifth aspect, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data update method as described in the first or second aspect.
[0062] In a sixth aspect, this application provides a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform a data update method as described in the first or second aspect.
[0063] In a seventh aspect, this application provides a computer program product including computer program instructions that, when executed on a computer, cause the computer to perform the data update method as described in the first or second aspect.
[0064] As can be seen from the above description, the data update method, apparatus, electronic device, storage medium, and program product provided in this application can be applied to the device side to send device information and a first timestamp to the server side, so that the server side can determine incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device side last performed a data update operation; in response to receiving incremental update data and a second timestamp from the server side, an incremental update data identifier corresponding to the incremental update data is determined; wherein, the second timestamp is used to indicate the time point when the server side sent the incremental update data to the device side; a first local data identifier corresponding to the incremental update data identifier is determined, the first local data corresponding to the first local data identifier is replaced with the incremental update data, and the first timestamp is replaced with the second timestamp. The first timestamp enables the server to determine the incremental update data, allowing the device to perform data update operations based on the incremental update data, replacing the local data corresponding to the incremental update data. This avoids the need to delete all local data on the device and fully update the incremental update data sent by the server every time a data update operation is performed. In other words, it avoids the problem of wasting network resources and low update efficiency caused by updating data that does not need to be updated. Attached Figure Description
[0065] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0066] Figure 1 An exemplary flowchart of a data update method applied to a device provided in an embodiment of this application is shown.
[0067] Figure 2 An exemplary flowchart of a data update method applied to a server, provided in an embodiment of this application, is shown.
[0068] Figure 3 This illustration shows an exemplary structural diagram of a device for data updating on a device side, as provided in an embodiment of this application.
[0069] Figure 4 This illustration shows an exemplary structural diagram of an apparatus for updating data on a server, as provided in an embodiment of this application.
[0070] Figure 5 This illustration shows an exemplary structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0071] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0072] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0073] As described in the background section, data updates or recycling of OTA (Over-the-Air Technology) devices typically require a full synchronization between the device and the cloud, which means deleting all local data on the OTA device and then fully updating the data sent from the cloud.
[0074] However, the applicant's research revealed that in the relevant technologies, whether updating or reclaiming data on the device side, data synchronization between the device and the cloud is required. Specifically, for example, when updating data on the device side, if the local data on the device side is ABC, and the incremental update data sent from the cloud instructs the device side to update B to B', then all ABC in the local data on the device side needs to be cleared, and data AB'C needs to be downloaded from the cloud for a full update in order to realize the data update operation on the device side. Therefore, when the amount of data to be updated or reclaimed is large, there will be problems of high network resource consumption and low efficiency.
[0075] Therefore, the data update method, apparatus, electronic device, storage medium, and program product provided in this application can be applied to the device side to send device information and a first timestamp to the server side, so that the server side can determine incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device side last performed a data update operation; in response to receiving incremental update data and a second timestamp from the server side, an incremental update data identifier corresponding to the incremental update data is determined; wherein, the second timestamp is used to indicate the time point when the server side sent the incremental update data to the device side; a first local data identifier corresponding to the incremental update data identifier is determined, the first local data corresponding to the first local data identifier is replaced with the incremental update data, and the first timestamp is replaced with the second timestamp. The first timestamp enables the server to determine the incremental update data, allowing the device to perform data update operations based on the incremental update data, replacing the local data corresponding to the incremental update data. This avoids the need to delete all local data on the device and fully update the incremental update data sent by the server every time a data update operation is performed. In other words, it avoids the problem of wasting network resources and low update efficiency caused by updating data that does not need to be updated.
[0076] The following specific embodiments will be used to illustrate a data update method provided in this application.
[0077] Figure 1 An exemplary flowchart of a data update method applied to a device provided in an embodiment of this application is shown.
[0078] refer to Figure 1The data update method provided in this application embodiment is applied to the device side, and the method specifically includes the following steps:
[0079] S102: Send the device information and the first timestamp to the server so that the server can determine the incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device last performed the data update operation.
[0080] S104: In response to receiving incremental update data and a second timestamp from the server, determine the incremental update data identifier corresponding to the incremental update data; wherein, the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0081] S106: Determine the first local data identifier corresponding to the incremental update data identifier, replace the first local data corresponding to the first local data identifier with the incremental update data, and replace the first timestamp with the second timestamp.
[0082] In some embodiments, the device can proactively send an update request to the server, or passively wait for an update instruction from the server instructing the device to perform a data update operation. Specifically, when the device proactively sends an update request to the server, it can proactively send device information and a first timestamp to the server when a target event is triggered, so that the server can determine whether to send incremental update data to the device based on the device information and the first timestamp. The target event can be a startup event, such as when the device starts up, i.e., when it powers on, and proactively sends an update request to the server.
[0083] Furthermore, when a device passively receives an update command from the server, it can send its device information and a first timestamp to the server. This allows the server to determine the incremental update data based on the device information and the first timestamp. The device information can indicate the device type, such as the device's product serial number, and the first timestamp can indicate the time when the device last performed a data update operation. For example, if the device last performed a data update operation at 10:00 AM on January 1st, then the first timestamp can represent the information at that time.
[0084] It should be noted that when the device has never performed a data update operation, there may be a situation where the first timestamp does not exist. Therefore, it is necessary to determine whether the first timestamp exists. If the first timestamp exists, it means that the device has at least performed a data update operation, and the device information and the first timestamp can be sent to the server. However, if it is determined that the first timestamp does not exist, it proves that the device has never performed a data update operation. In this case, a first timestamp can be generated based on a preset initial time point, for example, by setting the first timestamp to 0, and then the device information and the first timestamp can be sent to the server.
[0085] In some embodiments, when the device receives incremental update data and a second timestamp from the server, it can update its local data based on the incremental update data. The incremental update data is the data to be updated, which can be a portion of the data. For example, the device's local data might be ABC, and the incremental update data sent from the cloud instructs the device to update B to B', where B' can represent the incremental update data. Therefore, it is necessary to determine the incrementally updated data corresponding to the incremental update data, that is, to determine the incrementally updated data B in the device's local data that corresponds to the incremental update data B'.
[0086] Specifically, each data item has a unique identifier that can be used to indicate different data. This allows us to determine the incremental update data identifier corresponding to the incremental update data, and then determine the first local data identifier corresponding to the incremental update data identifier on the device side. Furthermore, the incremental update data can replace the first local data corresponding to the first local data identifier, completing the data update. For example, if the incremental update data identifier corresponding to incremental update data B' is X, then the first local data identifier with identifier X is determined in the local data on the device side. This then determines the first local data B corresponding to the first local data identifier X, and the incremental update data B' replaces the first local data B corresponding to the first local data identifier, completing the data update. Therefore, only the incremental update data that needs to be updated needs to be updated on the device side; there is no need to delete and re-download other local data that does not need to be updated.
[0087] Furthermore, to ensure that the first timestamp sent to the server when the device performs a data update is the time of the last data update operation, a second timestamp sent by the server can be used to overwrite and replace the first timestamp, thus obtaining the latest second timestamp. The second timestamp can be used to indicate the time when the server sends incremental update data to the device, which is also the time when the device performs the current data update operation.
[0088] Because related technologies require a full update to reclaim data on the device side, for example, if the device has local data ABC, and the server issues a reclamation command instructing the device to reclaim local data A so that the reclaimed local data on the device is BC, then the related technologies would need to clear all local data ABC on the device and download data BC from the server. Such an operation would waste network resources.
[0089] Therefore, in some embodiments, when the device receives a data reclamation command from the server, it can determine the reclamation data identifier corresponding to the reclamation data based on the data reclamation command, and then determine a second local data identifier corresponding to the reclamation data identifier on the device, and delete the second local data corresponding to the second local data identifier, thereby realizing the data reclamation operation. For example, the reclamation data identifier Y corresponding to the reclamation data A can be determined based on the data reclamation command, then a second local data identifier identified as Y can be determined in the local data on the device, and then the second local data A corresponding to the first local data identifier Y can be determined, and the second local data A can be deleted, thereby realizing the data reclamation operation.
[0090] In some embodiments, due to the complex network environment of the device, update operations may fail. For example, three data entries may need to be updated, but the device may only update two or even zero. To ensure that the data on the device and the server are consistent, data inspection can be performed after replacing the first local data with incrementally updated data and replacing the first timestamp with a second timestamp.
[0091] Specifically, upon receiving a data query request from the server, the first data count corresponding to all local data stored on the device can be determined. For example, if there are 10 records of local data, the first data count is 10. Further, the first data count and device information can be sent to the server so that the server can determine whether to send a full update command to the device based on these information. If a full update command is received from the server, the device can obtain the full update data according to the command and replace all local data with the full update data. For example, if a full update command is received from the server, it indicates that the device has not completed the update of all data; that is, the updated local data on the device should be more than 10 records, such as 15 records. Therefore, it is necessary to obtain the full update data, i.e., obtain all 15 records, clear the original 10 local records on the device, and insert the 15 full update records to complete a forced full update on the device, ensuring that the data on the device is synchronized with the data on the server.
[0092] It should be noted that if no full update command is received from the server, it means that the updated local data on the device has been synchronized with the data on the server, and a full update operation is not required.
[0093] The following specific embodiments will be used to illustrate another data update method provided in this application.
[0094] Figure 2 An exemplary flowchart of a data update method applied to a server, provided in an embodiment of this application, is shown.
[0095] refer to Figure 2 The data update method provided in this application embodiment is applied to the server, and the method specifically includes the following steps:
[0096] S202: Receive device information and a first timestamp from the device; wherein the first timestamp is used to indicate the time point when the device last performed a data update operation.
[0097] S204: Determine incremental update data based on the device information and the first timestamp, and send the incremental update data and the second timestamp to the device; wherein, the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0098] In some embodiments, as described in the foregoing embodiments, the device can proactively send an update request to the server. Therefore, when the server receives an update request from the device, it can check the data record table used to store data delivery records and the delivered data to determine whether there is a data delivery record corresponding to the incremental update data. If there is a data delivery record corresponding to the incremental update data, an update instruction can be sent to the device to instruct it to perform a data update operation. The data record table can be used to record data delivery records because the operation of the developer writing data to the server for the device to perform an update is asynchronous with the operation of the server sending that data to the device. Therefore, the data record table can include write records corresponding to data written by the developer to the server that can be updated by the device, and update records of the server sending that data to the device.
[0099] Specifically, update requests from the device can include at least the device type and a first timestamp, allowing the server to query the incremental update data corresponding to that device type. For example, if the device type is M, the server will only send an update command to the device if it has a data delivery record for incremental update data corresponding to device type M; otherwise, it will not send an update command. Alternatively, the server can send a reply command to the device indicating that no update is needed, or it can choose not to reply to update requests from the device.
[0100] In some embodiments, as described in the foregoing embodiments, the device can also passively receive update instructions from the server. The server can actively check the data record table to determine whether there is a data delivery record corresponding to the incremental update data. When it is determined that there is a data delivery record corresponding to the incremental update data in the data record table, it can send an update instruction to the device.
[0101] In some embodiments, upon receiving device information and a first timestamp from the device, the data to be distributed within the update time period between the first and second timestamps can be determined based on the data record table. For example, if the first timestamp is 10:00 AM on January 1st, and the second timestamp is the time the data was sent to the device (i.e., the current actual time), such as 3:00 PM on January 1st, then the data to be distributed by the developers and written to the server within the five hours from 10:00 AM to 3:00 PM on January 1st can be determined. Furthermore, the device type on the device is determined based on the device information, thereby identifying the incremental update data corresponding to that device type in the distributed data. For example, if the device type is M, incremental update data will only be determined if incremental update data corresponding to device type M exists in the distributed data on the server; otherwise, it is determined that no incremental update data exists within that update time period.
[0102] Specifically, it can be determined whether a first timestamp exists in a pre-stored timestamp record table corresponding to the device. For example, each time the device receives incremental update data from the server to update its local data, it needs to send a first timestamp to the server. The server can generate a timestamp record table to record the first timestamp each time the device updates. Therefore, if the first timestamp exists in the timestamp record table, it proves that the device's first timestamp has not been modified. The data to be sent can be determined based on the data record table, thus ensuring data accuracy.
[0103] If the first timestamp is not present in the timestamp record table, there are two possibilities. One possibility is that the first timestamp is the preset initial time point. If the first timestamp is the preset initial time point, that is, if the first timestamp is 0, it means that the device has never performed a data update operation before, which is consistent with the actual situation. Therefore, the data to be sent can be determined based on the data record table.
[0104] Another scenario is when the first timestamp is not present in the timestamp record table and is not the preset initial time point. This indicates that the device has modified the first timestamp. To avoid data inaccuracy, a termination command can be sent to the device. This termination command can be used to instruct the device to terminate the data update operation.
[0105] In some embodiments, the server may send a recycling instruction to the device so that the device can delete the second local data stored on the device, which is indicated by the recycling instruction.
[0106] In some embodiments, due to the complex network environment of the device, update operations may fail. For example, three data entries may need to be updated, but the device may only update two or even zero. To ensure that the data on the device and the server are consistent, data inspection can be performed after replacing the first local data with incrementally updated data and replacing the first timestamp with a second timestamp.
[0107] Specifically, the server can send a data query request to the device to determine the first data quantity corresponding to all local data stored on the device, and the second data quantity corresponding to all local data stored on the server. Furthermore, it can determine whether the first and second data quantities are the same. For example, if the device originally has 3 local data entries (A, B, C) and 1 incremental update data entry (D), then after performing the data update operation, the device should have 4 local data entries (A, B, C, D). The server will record 4 as the second data quantity. However, if the device performs an incorrect data update operation, such as failing to update the incremental update data D, then the device will still have 3 local data entries (A, B, C), and the first data quantity will be 3.
[0108] If the quantity of the first data differs from the quantity of the second data, a full update command can be sent to the device. This allows the device to obtain the full update data and replace all local data with the updated data. For example, if the full update data should be ABCD, then all local data ABC on the device is deleted, and the data is updated to ABCD, completing the full update operation.
[0109] It should be noted that if the first data quantity is the same as the second data quantity, it proves that the data on the device side is synchronized with the data on the server side, and there is no need to perform a full data update operation on the device side.
[0110] In some embodiments, for certain devices, there may be frequent data update failures. Therefore, a pre-defined set of devices for full data updates can be established, containing devices for which a full data update operation needs to be enforced. Thus, after receiving device information and a first timestamp from a device, it can be determined whether the device is in the full data update set based on the device information. If the device is determined to be in the full data update set, a full data update command is sent to that device to force it to perform a full data update operation, replacing all local data with the updated data obtained according to the full data update command.
[0111] It should be noted that, in order to facilitate the expansion of interface functions in subsequent work, the interface functions are usually simplified. Therefore, after the incremental data update operation is completed on the device side, it can be determined whether a full data update operation needs to be forced based on the device information sent by the device side.
[0112] As can be seen from the above description, the data update method, apparatus, electronic device, storage medium, and program product provided in this application can be applied to the device side to send device information and a first timestamp to the server side, so that the server side can determine incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device side last performed a data update operation; in response to receiving incremental update data and a second timestamp from the server side, an incremental update data identifier corresponding to the incremental update data is determined; wherein, the second timestamp is used to indicate the time point when the server side sent the incremental update data to the device side; a first local data identifier corresponding to the incremental update data identifier is determined, the first local data corresponding to the first local data identifier is replaced with the incremental update data, and the first timestamp is replaced with the second timestamp. The first timestamp enables the server to determine the incremental update data, allowing the device to perform data update operations based on the incremental update data, replacing the local data corresponding to the incremental update data. This avoids the need to delete all local data on the device and fully update the incremental update data sent by the server every time a data update operation is performed. In other words, it avoids the problem of wasting network resources and low update efficiency caused by updating data that does not need to be updated.
[0113] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.
[0114] It should be noted that the above description describes some embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0115] Figure 3 This illustration shows an exemplary structural diagram of a device for data updating on a device side, as provided in an embodiment of this application.
[0116] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a data updating device applied to a device.
[0117] refer to Figure 3 The data updating device includes: a sending module, a determining module, and an updating module; wherein,
[0118] The sending module is configured to send device information and a first timestamp to the server so that the server can determine incremental update data based on the device information and the first timestamp; wherein, the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0119] The determination module is configured to determine the incremental update data identifier corresponding to the incremental update data in response to receiving incremental update data and a second timestamp from the server; wherein the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0120] The update module is configured to determine a first local data identifier corresponding to the incremental update data identifier, replace the first local data corresponding to the first local data identifier with the incremental update data, and replace the first timestamp with the second timestamp.
[0121] In one possible implementation, the sending module is further configured as follows:
[0122] In response to receiving an update instruction from the server instructing the device to perform a data update operation, the device information and a first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0123] In one possible implementation, the sending module is further configured as follows:
[0124] In response to the triggering of a target event, the device information and the first timestamp are sent to the server so that the server can determine incremental update data based on the device information and the first timestamp.
[0125] In one possible implementation, the sending module is further configured as follows:
[0126] Obtain the device information used to indicate the device type, and determine whether the first timestamp exists;
[0127] In response to the existence of the first timestamp, the device information and the first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0128] In one possible implementation, the sending module is further configured as follows:
[0129] In response to the absence of the first timestamp, the first timestamp is generated according to a preset initial time point, and the device information and the first timestamp are sent to the server so that the server can determine the incremental update data based on the device information and the first timestamp.
[0130] In one possible implementation, the device further includes: a recycling module;
[0131] The recycling module is configured as follows:
[0132] In response to receiving a data recycling instruction from the server, the recycling data identifier corresponding to the recycled data is determined according to the data recycling instruction;
[0133] Determine the second local data identifier corresponding to the recycled data identifier, and delete the second local data corresponding to the second local data identifier.
[0134] In one possible implementation, the update module is further configured as follows:
[0135] In response to receiving a data query request from the server, determine the first data quantity corresponding to all local data stored on the device.
[0136] The first data quantity and the device information are sent to the server so that the server can determine whether to send a full update command to the device based on the first data quantity and the device information.
[0137] In response to receiving a full update instruction from the server, the system obtains full update data according to the full update instruction and replaces all local data with the full update data.
[0138] For ease of description, the above system is described by dividing it into various modules based on their functions. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0139] The system described above is used to implement the corresponding data update method applied to the device in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0140] Figure 4 This illustration shows an exemplary structural diagram of an apparatus for updating data on a server, as provided in an embodiment of this application.
[0141] Based on the same inventive concept, corresponding to any of the above embodiments, this application also provides a data updating device applied to a server.
[0142] refer to Figure 4 The data update apparatus includes: a receiving module and a determining module; wherein,
[0143] The receiving module is configured to receive device information and a first timestamp from the device; wherein the first timestamp is used to indicate the time point when the device last performed a data update operation;
[0144] The determination module is configured to determine incremental update data based on the device information and the first timestamp, and send the incremental update data and the second timestamp to the device; wherein the second timestamp is used to indicate the time point at which the server sends the incremental update data to the device.
[0145] In one possible implementation, the device further includes: a transmitting module;
[0146] The sending module is configured as follows:
[0147] Send an update command to the device to instruct the device to perform a data update operation.
[0148] In one possible implementation, the sending module is further configured as follows:
[0149] Examine the data record table used to store data distribution records and the distributed data to determine if there is a data distribution record corresponding to the incremental update data;
[0150] In response to determining that a data delivery record corresponding to the incremental update data exists in the data record table, an update command is sent to the device to instruct the device to perform a data update operation.
[0151] In one possible implementation, the determining module is further configured as follows:
[0152] The data to be distributed within the update time period between the first timestamp and the second timestamp is determined based on the data record table;
[0153] The device type of the device terminal is determined based on the device information;
[0154] Determine the incremental update data in the distributed data that corresponds to the device type.
[0155] In one possible implementation, the determining module is further configured as follows:
[0156] Determine whether the first timestamp exists in the pre-stored timestamp record table corresponding to the device.
[0157] If the first timestamp exists in the timestamp record table, the data to be sent within the update time period between the first timestamp and the second timestamp is determined according to the data record table.
[0158] In one possible implementation, the determining module is further configured as follows:
[0159] If the first timestamp does not exist in the timestamp record table, then it is determined whether the first timestamp is a preset initial time point;
[0160] In response to the first timestamp being a preset initial time point, the data to be sent within the update time period between the preset initial time point and the second timestamp is determined according to the data record table.
[0161] In one possible implementation, the device further includes: a termination module;
[0162] The termination module is configured as follows:
[0163] If the first timestamp is not a preset initial time point, a termination command is sent to the device to instruct the device to terminate the data update operation.
[0164] In one possible implementation, the device further includes: a recycling module;
[0165] The recycling module is configured as follows:
[0166] Send a data recycling instruction to the device so that the device deletes the second local data indicated by the recycling instruction stored in the device.
[0167] In one possible implementation, the device further includes: a full update module;
[0168] The full update module is configured as follows:
[0169] Send a data query request to the device to determine the first data quantity corresponding to all local data stored on the device;
[0170] Determine whether the first data quantity is the same as the second data quantity corresponding to all local data stored on the server and on the device;
[0171] In response to the difference between the first data quantity and the second data quantity, a full update instruction is sent to the device to enable the device to obtain full update data according to the full update instruction and replace all local data with the full update data.
[0172] In one possible implementation, the full update module is further configured as follows:
[0173] Determine whether the device exists in the preset full update device set based on the device information;
[0174] In response to determining that the device exists in a preset set of devices for full updates, a full update instruction is sent to the device so that the device can obtain full update data according to the full update instruction and replace all local data with the full update data.
[0175] For ease of description, the above system is described by dividing it into various modules based on their functions. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0176] The system described above is used to implement the corresponding data update method applied to the server in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0177] Figure 5 This illustration shows an exemplary structural diagram of an electronic device provided in an embodiment of this application.
[0178] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the data update method described in any of the above embodiments. Figure 5 This embodiment illustrates a more specific hardware structure of an electronic device, which may include a processor 510, a memory 520, an input / output interface 530, a communication interface 540, and a bus 550. The processor 510, memory 520, input / output interface 530, and communication interface 540 are interconnected internally via the bus 550.
[0179] The processor 510 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0180] The memory 520 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 520 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 520 and is called and executed by the processor 510.
[0181] Input / output interface 530 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touch screens, microphones, various sensors, etc., and output devices may include displays, speakers, vibrators, indicator lights, etc.
[0182] The communication interface 540 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (e.g., USB, Ethernet cable) or wireless means (e.g., mobile network, Wi-Fi, Bluetooth).
[0183] Bus 550 includes a pathway for transmitting information between various components of the device, such as processor 510, memory 520, input / output interface 530, and communication interface 540.
[0184] It should be noted that although the above-described device only shows the processor 510, memory 520, input / output interface 530, communication interface 540, and bus 550, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0185] The electronic devices described above are used to implement the corresponding data update methods applied to the device or the server in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0186] Based on the same inventive concept, corresponding to any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions, which are used to cause the computer to execute the data update method applied to the device or the data update method applied to the server as described in any of the above embodiments.
[0187] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0188] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the data update method applied to the device or the data update method applied to the server as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0189] Based on the same inventive concept, corresponding to the data update methods applied to the device or server described in any of the above embodiments, this disclosure also provides a computer program product, which includes computer program instructions. In some embodiments, the computer program instructions can be executed by one or more processors of a computer to cause the computer and / or the processor to perform the data update methods applied to the device or server. Corresponding to the execution entity for each step in each embodiment of the data update methods applied to the device or server, the processor executing the corresponding step can belong to the corresponding execution entity.
[0190] The computer program product of the above embodiments is used to cause the computer and / or the processor to execute the data update method applied to the device or the data update method applied to the server as described in any of the above embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0191] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.
[0192] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0193] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0194] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.
Claims
1. A data updating method characterized by comprising: Applied to a device end, the method comprises: sending device information and a first timestamp to a server end, so that the server end determines incremental update data according to the device information and the first timestamp; wherein the first timestamp is used to indicate a time point at which the device end last executes a data update operation; in response to receiving incremental update data and a second timestamp from the server end, determining an incremental update data identifier corresponding to the incremental update data; wherein the second timestamp is used to indicate a time point at which the server end sends the incremental update data to the device end; determining a first local data identifier corresponding to the incremental update data identifier, replacing first local data corresponding to the first local data identifier with the incremental update data, and replacing the first timestamp with the second timestamp.
2. The method of claim 1, wherein, The sending device information and a first timestamp to a server end, so that the server end determines incremental update data according to the device information and the first timestamp, comprises: in response to receiving an update instruction from the server end for indicating the device end to execute a data update operation, sending device information and a first timestamp to the server end, so that the server end determines incremental update data according to the device information and the first timestamp.
3. The method of claim 1, wherein, The sending device information and a first timestamp to a server end, so that the server end determines incremental update data according to the device information and the first timestamp, comprises: in response to triggering a target event, sending the device information and the first timestamp to the server end, so that the server end determines incremental update data according to the device information and the first timestamp.
4. The method of claim 1, wherein, The sending device information and a first timestamp to a server end, so that the server end determines incremental update data according to the device information and the first timestamp, comprises: obtaining the device information for indicating a device type, and determining whether the first timestamp exists; in response to the first timestamp existing, sending device information and a first timestamp to the server end, so that the server end determines incremental update data according to the device information and the first timestamp.
5. The method of claim 4, wherein, After the determining whether the first timestamp exists, further comprising: in response to the first timestamp not existing, generating the first timestamp according to a preset initial time point, and sending device information and the first timestamp to the server end, so that the server end determines incremental update data according to the device information and the first timestamp.
6. The method of claim 1, wherein, The method further comprises: in response to receiving a data recycling instruction from the server end, determining a recycling data identifier corresponding to recycling data according to the data recycling instruction; determining a second local data identifier corresponding to the recycling data identifier, and deleting second local data corresponding to the second local data identifier.
7. The method of claim 1, wherein, After the replacing first local data corresponding to the first local data identifier with the incremental update data, and replacing the first timestamp with the second timestamp, further comprising: in response to receiving a data query request from the server end, determining a first data quantity corresponding to all local data stored in the device end; sending the first data quantity and the device information to the server end, so that the server end determines whether to send a full-quantity update instruction to the device end according to the first data quantity and the device information; in response to receiving the full-quantity update instruction from the server end, obtaining full-quantity update data according to the full-quantity update instruction, and replacing all local data with the full-quantity update data.
8. A data updating method characterized by comprising: The method applied to the server end comprises: receiving device information and a first timestamp from the device end; wherein the first timestamp is used to indicate a time point at which the device end last executed a data update operation; determining incremental update data according to the device information and the first timestamp, and sending the incremental update data and a second timestamp to the device end; wherein the second timestamp is used to indicate a time point at which the server end sends the incremental update data to the device end; after receiving the device information and the first timestamp from the device end, the method further comprises: determining whether the device end exists in a preset full-quantity update device set according to the device information; in response to determining that the device end exists in the preset full-quantity update device set, sending a full-quantity update instruction to the device end so that the device end obtains full-quantity update data according to the full-quantity update instruction, and replaces all local data with the full-quantity update data.
9. The method of claim 8, wherein, before receiving the device information and the first timestamp from the device end, the method further comprises: sending an update instruction to the device end, which is used to instruct the device end to execute a data update operation.
10. The method of claim 9, wherein, the method of sending the update instruction to the device end, which is used to instruct the device end to execute a data update operation, comprises: checking a data record table used to store data delivery records and delivered data to determine whether there is a data delivery record corresponding to the incremental update data; in response to determining that there is a data delivery record corresponding to the incremental update data in the data record table, sending an update instruction to the device end, which is used to instruct the device end to execute a data update operation.
11. The method of claim 10, wherein, the method of determining incremental update data according to the device information and the first timestamp comprises: determining delivered data in an update time period between the first timestamp and the second timestamp according to the data record table; determining a device type of the device end according to the device information; determining incremental update data corresponding to the device type in the delivered data.
12. The method of claim 11, wherein, the method of determining delivered data in an update time period between the first timestamp and the second timestamp according to the data record table comprises: determining whether the first timestamp exists in a timestamp record table corresponding to the device end and pre-stored; in response to the first timestamp existing in the timestamp record table, determining delivered data in an update time period between the first timestamp and the second timestamp according to the data record table.
13. The method of claim 12, wherein, after determining whether the first timestamp exists in the timestamp record table corresponding to the device end and pre-stored, the method further comprises: in response to the first timestamp not existing in the timestamp record table, determining whether the first timestamp is a preset initial time point; in response to the first timestamp being a preset initial time point, determining, according to the data record table, the issued data in an update time period between the preset initial time point and the second timestamp.
14. The method of claim 13, wherein, The method further comprises, after determining whether the first timestamp is a preset initial time point: in response to the first timestamp not being a preset initial time point, sending a termination instruction to the device end to instruct the device end to terminate the data update operation.
15. The method of claim 8, wherein, The method further comprises: sending a data recovery instruction to the device end to instruct the device end to delete, according to the recovery instruction, the second local data indicated by the recovery instruction and stored in the device end.
16. The method of claim 8, wherein, The method further comprises, after determining the incremental update data according to the device information and the first timestamp and sending the incremental update data and the second timestamp to the device end: sending a data query request to the device end to determine a first data quantity corresponding to all local data stored in the device end; determining whether the first data quantity is the same as a second data quantity corresponding to all local data stored in the service end and corresponding to the device end; in response to the first data quantity being different from the second data quantity, sending a full update instruction to the device end to instruct the device end to acquire full update data according to the full update instruction and replace all local data with the full update data.
17. A data updating apparatus characterized by comprising: The device applied to the device end comprises: a sending module configured to send device information and a first timestamp to a service end to instruct the service end to determine incremental update data according to the device information and the first timestamp; the first timestamp is used to indicate a time point at which the device end last executed a data update operation; a determining module configured to determine an incremental update data identifier corresponding to the incremental update data in response to receiving the incremental update data and a second timestamp from the service end; the second timestamp is used to indicate a time point at which the service end sends the incremental update data to the device end; an updating module configured to determine a first local data identifier corresponding to the incremental update data identifier, replace first local data corresponding to the first local data identifier with the incremental update data, and replace the first timestamp with the second timestamp.
18. A data updating apparatus characterized by comprising: The device applied to the service end comprises: a receiving module configured to receive device information and a first timestamp from a device end; the first timestamp is used to indicate a time point at which the device end last executed a data update operation; a determining module configured to determine incremental update data according to the device information and the first timestamp and send the incremental update data and a second timestamp to the device end; the second timestamp is used to indicate a time point at which the service end sends the incremental update data to the device end; The full quantity updating module is configured to determine whether the device end exists in a preset full quantity updating device set according to the device information; and in response to determining that the device end exists in the preset full quantity updating device set, send a full quantity updating instruction to the device end to enable the device end to acquire full quantity updating data according to the full quantity updating instruction, and replace all local data with the full quantity updating data.
19. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor implements the method of any one of claims 1-7 or 8-16 when executing the program.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to enable the computer to implement the method of any one of claims 1-7 or 8-16.
21. A computer program product comprising computer program instructions which, when said computer program instructions are run on a computer, cause the computer to perform the method of any one of claims 1-7 or 8-16.
Citation Information
Patent Citations
Timestamp-based data synchronization method and device, and computer equipment
CN111245548A