Data synchronization method, device, equipment, server and storage medium
By using the method of identifying timestamps and sorting historical map data lists in the map data synchronization of the sweeping robot, the problem of repeated data synchronization is solved and the synchronization efficiency and consistency are improved.
Patent Information
- Application Number
- CN202111048209.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-08
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-09-08
AI Technical Summary
The existing technology is prone to the problem of repeated data synchronization when synchronizing map data of a sweeping robot, especially when synchronizing multiple client application software, resulting in low efficiency and waste of resources.
By obtaining the identification timestamp from the backend server, sorting the historical map data list, selecting the data with the earliest generation time for synchronization, and updating the list based on the return value of the backend server to avoid repeated synchronization.
It effectively avoids repeated synchronization of data, improves synchronization efficiency, reduces resource consumption, and ensures data consistency.
Smart Images

Figure CN113742426B
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of data synchronization, and in particular, to a data synchronization method, apparatus, device, server and storage medium. Background Art
[0002] Sweeping robots have been widely used in daily life. During operation, the robots will generate more and more work records and map data. The generated map data can only be stored on a third-party platform and can only be synchronized indirectly through client application software.
[0003] In the prior art, when synchronizing map data, there is a problem of duplicate synchronization of map data because multiple client applications need to synchronize data. Summary of the invention
[0004] The embodiments of the present invention provide a data synchronization method, device, equipment, server and storage medium, which can effectively avoid repeated synchronization of data.
[0005] In a first aspect, an embodiment of the present invention provides a data synchronization method, which is executed by a client and includes:
[0006] Obtaining an identification timestamp from the backend server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized map data;
[0007] Sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp;
[0008] Repeatedly select a historical map data with the earliest generation time from the sorted historical map data list, send the historical map data with the earliest generation time to the background server, and synchronize the map data according to the return value obtained from the background server, the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the historical map data with the earliest generation time.
[0009] In a second aspect, an embodiment of the present invention further provides a data synchronization method, which is executed by a background server and includes:
[0010] Mark the latest timestamp to obtain an identification timestamp;
[0011] Repeatedly receiving first synchronization data sent by a client device, and realizing map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data;
[0012] The generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp.
[0013] In a third aspect, an embodiment of the present invention further provides a data synchronization device, which is configured on a client device and includes:
[0014] An acquisition module is used to acquire an identification timestamp from a background server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronizes map data;
[0015] A sorting module, used for sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp;
[0016] A synchronization module is used to repeatedly select a historical map data with the earliest generation time from the sorted historical map data list, send the historical map data with the earliest generation time to the background server, and synchronize the map data according to the return value obtained from the background server. The sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the historical map data with the earliest generation time.
[0017] In a fourth aspect, an embodiment of the present invention further provides a data synchronization device, which is configured on a background server and includes:
[0018] A generating module, used for marking the latest timestamp to obtain a marking timestamp;
[0019] a synchronization module, configured to repeatedly receive first synchronization data sent by a client device, and implement map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data being a historical map data with the earliest generation time selected from a sorted historical map data list, and the return value being a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data;
[0020] The generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp.
[0021] In a fifth aspect, an embodiment of the present invention further provides a client device, including:
[0022] one or more processors;
[0023] A storage device for storing one or more programs;
[0024] The one or more programs are executed by the one or more processors, so that the one or more processors are used to implement the data synchronization method described in any embodiment of the present invention.
[0025] In a fifth aspect, an embodiment of the present invention further provides a background server, including:
[0026] one or more processors;
[0027] A storage device for storing one or more programs;
[0028] The one or more programs are executed by the one or more processors, so that the one or more processors are used to implement the data synchronization method described in any embodiment of the present invention.
[0029] In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a data synchronization method as provided in any embodiment of the present invention.
[0030] The embodiment of the present invention provides a data synchronization method, device, equipment, server and storage medium. First, an identification timestamp is obtained from a background server. The identification timestamp is obtained by identifying the latest timestamp. The latest timestamp is the time when the target robot last synchronizes map data. Then, the latest timestamp is identified to obtain an identification timestamp. Then, a historical map data list is sorted to obtain a sorted historical map data list. The generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp. Finally, a historical map data with the earliest generation time is repeatedly selected from the sorted historical map data list. The historical map data with the earliest generation time is sent to the background server, and map data synchronization is achieved according to the return value obtained from the background server. The sorted historical map list is updated according to the return value. The return value includes the generation time corresponding to the last synchronized historical map data obtained by the background server based on the historical map data with the earliest generation time. The above technical solution can effectively avoid repeated synchronization of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] Figure 1 A schematic diagram of a data synchronization method according to a first embodiment of the present invention;
[0032] Figure 2 A flowchart of a data synchronization method provided in Embodiment 2 of the present invention;
[0033] Figure 3 This is an example flow chart of a data synchronization method provided in Embodiment 3 of the present invention;
[0034] Figure 4 A schematic diagram of the structure of a data synchronization device provided by Embodiment 4 of the present invention;
[0035] Figure 5 A schematic diagram of the structure of a data synchronization device provided in Embodiment 5 of the present invention;
[0036] Figure 6 A schematic diagram of the structure of a client device provided in Embodiment 6 of the present invention;
[0037] Figure 7 This is a structural diagram of a background server provided in Embodiment 7 of the present invention. DETAILED DESCRIPTION
[0038] Embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments of the present invention are only for exemplary purposes and are not intended to limit the scope of protection of the present invention.
[0039] It should be understood that the various steps described in the method embodiments of the present invention may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this respect.
[0040] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0041] It should be noted that the concepts such as "first" and "second" mentioned in the present invention are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0042] It should be noted that the modifications of "one" and "plurality" mentioned in the present invention are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0043] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only used for illustrative purposes, and are not used to limit the scope of these messages or information.
[0044] Embodiment 1
[0045] Figure 1 This is a flow chart of a data synchronization method provided in Embodiment 1 of the present invention. The method can be applicable to situations where data synchronization is performed. The method can be executed by a data synchronization device, wherein the device can be implemented by software and / or hardware and is generally integrated on a client device. In this embodiment, the client device includes but is not limited to: a computer, a tablet computer, and a smart phone, etc. The client device in this embodiment can be a device with an IOS system and an Android system. It should be further explained that the number of client devices in this embodiment can be multiple.
[0046] like Figure 1 As shown, a data synchronization method provided in Embodiment 1 of the present invention includes the following steps:
[0047] S110. Obtain an identification timestamp from a background server, where the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronizes map data.
[0048] The target robot may be any robot capable of performing map data synchronization, and the target robot may be a robot with any function. In this embodiment, the target robot may be a sweeping robot. How the target robot performs map data synchronization is a prior art and will not be described in detail here. The map data may be understood as data on a map corresponding to the travel of the target robot, and the target robot may move according to the walking route on the map.
[0049] Optionally, there is no specific limitation on the way in which the client device obtains the identification timestamp from the background server. Exemplarily, the way in which the client device obtains the identification timestamp from the background server may be to obtain the identification timestamp from the background server through an application programming interface (API).
[0050] Furthermore, if the identification timestamp is not generated in the background server, that is, the client device cannot obtain the identification timestamp, the identification timestamp may be set to 0.
[0051] S120: Sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp.
[0052] The historical map data list is a list of historical map data obtained from a third-party platform. Specifically, the client device can obtain historical map data whose generation time is later than the identification timestamp from the third-party platform, and the obtained historical map data constitutes the historical map data list.
[0053] In this embodiment, a specific method of sorting the historical map data list may be: arranging the historical map data included in the historical map data list in positive order according to the chronological order of generation time to obtain a sorted historical map data list.
[0054] Specifically, sorting the historical map data list to obtain the sorted historical map data list includes: obtaining the historical map data list from a third-party platform, the historical map data list including historical map data whose generation time is later than the identification timestamp; sorting the historical map data in positive order according to the corresponding generation time to obtain the sorted historical map data list.
[0055] S130, repeatedly selecting a historical map data with the earliest generation time from the sorted historical map data list, sending the historical map data with the earliest generation time to the background server, and realizing map data synchronization according to the return value obtained from the background server.
[0056] The sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last synchronized historical map data obtained by the backend server based on the historical map data with the earliest generation time.
[0057] In this embodiment, first, a historical map data with the earliest generation time is selected from the sorted historical map data list, and the background server can generate a return value based on the historical map data. The client can select historical map data with a generation time later than the return value to synchronize map data according to the return value, and filter the sorted historical map data list to obtain an updated historical map data list by filtering out historical map data with a generation time later than the return value, and continue to select the historical map data with the earliest generation time from the updated historical map data list, and continue to execute subsequent operations, and repeat this cycle until the synchronization of all historical map data is completed.
[0058] Specifically, the repeatedly selecting a historical map data with the earliest generation time from the sorted historical map data list, sending the historical map data with the earliest generation time to the background server, and realizing map data synchronization according to the return value obtained from the background server, includes: selecting a historical map data with the earliest generation time from the sorted historical map data list as the first synchronization data; initiating a map data synchronization request to the background server; when the background server responds to the map data synchronization request, sending the first synchronization data to the background server; obtaining a return value from the background server; filtering out the historical map data in the sorted historical map data list whose generation time is earlier than the return value to obtain an updated historical map data list; returning to continue executing the first synchronization data selection operation until all historical map data in the updated historical map data list are fully synchronized.
[0059] It should be noted that after each selection operation, a corresponding updated historical map data can be obtained. The number of corresponding updated historical map data obtained will be different for the number of selection operations performed. As the number of filtering times increases, the historical map data included in each updated historical map data is getting less and less.
[0060] A data synchronization method provided in the first embodiment of the present invention first obtains an identification timestamp from a background server, the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized map data; then the historical map data list is sorted to obtain a sorted historical map data list, and the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp; finally, a historical map data with the earliest generation time is repeatedly selected from the sorted historical map data list, and the historical map data with the earliest generation time is sent to the background server, and map data synchronization is achieved according to the return value obtained from the background server, and the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last synchronized historical map data obtained by the background server based on the historical map data with the earliest generation time. The above method can effectively avoid repeated synchronization of data.
[0061] Embodiment 2
[0062] Figure 2 A flow chart of a data synchronization method provided in Embodiment 2 of the present invention is provided. The method can be applicable to data synchronization. The method can be executed by a data synchronization device, wherein the device can be implemented by software and / or hardware and is generally integrated in a background server.
[0063] like Figure 2 As shown, a data synchronization method provided by Embodiment 2 of the present invention includes the following steps:
[0064] S210: Mark the latest timestamp to obtain a marked timestamp.
[0065] In this embodiment, there is no restriction on the method for marking the latest timestamp. The purpose of marking is to mark the latest timestamp to mark the generation time corresponding to the last map data synchronized by the client device.
[0066] S220. Repeatedly receive first synchronization data sent by a client device, and implement map data synchronization by sending a return value to the client device, wherein the return value is determined based on the first synchronization data, the first synchronization data is a historical map data with the earliest generation time selected from a sorted historical map data list, and the return value is a generation time corresponding to the last synchronized historical map data obtained based on the first synchronization data.
[0067] The generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp.
[0068] In this embodiment, after receiving the first synchronization data sent by the client device, a return value can be determined based on the first synchronization data, and the return value can be sent to the client, so that the client can select historical map data with a generation time earlier than the return value for map data synchronization according to the return value.
[0069] Specifically, repeatedly receiving the first synchronization data sent by the client device and sending a return value to the client device to achieve map data synchronization, includes: receiving the first synchronization data sent by the client device; determining whether the first synchronization data needs to be saved; querying the last synchronized historical map data from the historical map data saved in the background server as the latest synchronized map data; returning the generation time corresponding to the latest synchronized map data to the client device as a return value, so that the client device synchronizes data according to the return value; returning to continue executing the first synchronization data receiving operation until all historical map data in the updated historical map data list are synchronized.
[0070] In this embodiment, the background server may repeatedly receive the historical map data sent by the client device, and may return a return value to the client after each reception to assist the client in synchronizing all the historical map data included in the sorted historical map data list.
[0071] The method of determining whether the first synchronization data needs to be saved may be: determining whether the first synchronization data needs to be saved according to whether the first synchronization data has completed synchronization within a historical time. The historical time may be understood as a time earlier than the current time.
[0072] Further, the determining whether the first synchronization data needs to be saved includes: querying whether the first synchronization data has completed synchronization within the historical time; if so, not saving the first synchronization data; if not, saving the first synchronization data.
[0073] In this embodiment, determining whether the first synchronization data needs to be saved can prevent the successfully saved historical map data from being repeatedly saved, thereby avoiding repeated synchronization of map data.
[0074] A data synchronization method provided in the second embodiment of the present invention first identifies the latest timestamp to obtain an identification timestamp; then repeatedly receives the first synchronization data sent by the client device, and realizes map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization time, wherein the first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is the generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data; wherein the generation time of the historical map data included in the historical map data list before sorting corresponding to the sorted historical map data list is later than the identification timestamp. This method can effectively avoid repeated synchronization of historical map data by identifying the latest timestamp in the background server.
[0075] Embodiment 3
[0076] Figure 3 This is an example flow chart of a data synchronization method provided by Embodiment 3 of the present invention, such as Figure 3 As shown, the specific implementation steps of the data synchronization method are as follows:
[0077] Step 1: The client device calls the API interface provided by the background server to check the timestamp, that is, the latest timestamp, of the historical map data last synchronized by a specific sweeping robot, that is, the target robot.
[0078] Step 2: The client device pulls a list of historical map data whose generation time is later than the latest timestamp from the third-party platform.
[0079] Step 3: The client device arranges the pulled historical map data list in ascending order of generation time to obtain sorted historical map data.
[0080] Step 4: The client device selects a historical map data with the earliest generation time, namely, the first synchronization data, from the sorted historical map data, and calls the synchronization API provided by the background server to synchronize the map data.
[0081] Step 5: After receiving the synchronization request initiated by the client device, the background server first queries whether the historical map data has been synchronized. If it has been synchronized, the historical map data is not saved; if the historical map data has not been synchronized, the historical map data is saved.
[0082] Step 6: The background server queries the last synchronized piece of historical map data, and returns the generation time of the historical map data to the client device as a return value.
[0083] Step 7: The client device receives the return value of the API for synchronizing historical map data, and filters out historical map data in the map data list in step 2 whose generation time is earlier than the return value according to the return value.
[0084] Step 8: Return to step 4 and repeat the process until all historical drip data is synchronized.
[0085] A data synchronization method provided in the third embodiment of the present invention identifies the latest timestamp in each backend server to obtain an identification timestamp, so that each time the client device synchronizes data, it only needs to pull historical map data generated later than the identification timestamp from the third-party platform for synchronization, thereby reducing the amount of data that needs to be synchronized. In addition, the backend server verifies each synchronized historical map data, and no longer saves the saved historical map data, which can effectively avoid repeated synchronization of historical map data.
[0086] Embodiment 4
[0087] Figure 4 This is a structural diagram of a data synchronization device provided in Embodiment 4 of the present invention. The device can be applicable to situations where data synchronization is performed, wherein the device can be implemented by software and / or hardware and is generally integrated on a client device.
[0088] like Figure 4 As shown, the device includes: an acquisition module 410 , a sorting module 420 and a synchronization module 430 .
[0089] The acquisition module 410 is used to acquire an identification timestamp from the background server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronizes the map data;
[0090] A sorting module 420, configured to sort the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp;
[0091] The synchronization module 430 is used to repeatedly select a historical map data with the earliest generation time from the sorted historical map data list, send the historical map data with the earliest generation time to the background server, and synchronize the map data according to the return value obtained from the background server. The sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the historical map data with the earliest generation time.
[0092] In this embodiment, the device first obtains an identification timestamp from the background server through the acquisition module 410, and the identification timestamp is obtained after identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized the map data; then the historical map data list is sorted by the sorting module 420 to obtain a sorted historical map data list, and the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp; finally, the synchronization module 430 repeatedly selects a historical map data with the earliest generation time from the sorted historical map data list, sends the historical map data with the earliest generation time to the background server, and realizes map data synchronization according to the return value obtained from the background server, and the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last synchronized historical map data obtained by the background server based on the historical map data with the earliest generation time.
[0093] This embodiment provides a data synchronization device, which can effectively avoid repeated synchronization of data.
[0094] Furthermore, the sorting module 420 is specifically used to: obtain a historical map data list from a third-party platform, the historical map data list including historical map data whose generation time is later than the identification timestamp; sort the historical map data in positive order according to the corresponding generation time to obtain a sorted historical map data list.
[0095] Furthermore, the synchronization module 430 is specifically used to: select a historical map data with the earliest generation time from the sorted historical map data list as the first synchronization data; initiate a map data synchronization request to the background server; when the background server responds to the map data synchronization request, send the first synchronization data to the background server; obtain a return value from the background server, and the return value is the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the first synchronization data; filter the historical map data in the sorted historical map data list whose generation time is earlier than the return value to obtain an updated historical map data list; return to continue executing the first synchronization data selection operation until all historical map data in the updated historical map data list are fully synchronized.
[0096] The above-mentioned data synchronization device can execute the data synchronization method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0097] Embodiment 5
[0098] Figure 5 This is a structural diagram of a data synchronization device provided in Embodiment 5 of the present invention. The device can be applicable to situations where data synchronization is performed, wherein the device can be implemented by software and / or hardware and is generally integrated on a client device.
[0099] like Figure 5 As shown, the device includes: a generating module 510 and a synchronizing module 520 .
[0100] A generating module 510, configured to identify the latest timestamp to obtain an identification timestamp;
[0101] A synchronization module 520 is used to repeatedly receive first synchronization data sent by a client device, and to achieve map data synchronization by sending a return value to the client device, wherein the return value is determined based on the first synchronization data, the first synchronization data being a historical map data with the earliest generation time selected from a sorted historical map data list, and the return value being a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data; wherein the generation time of the historical map data included in the historical map data list before sorting corresponding to the sorted historical map data list is later than the identification timestamp.
[0102] In this embodiment, the device first identifies the latest timestamp through the generation module 510 to obtain an identification timestamp, and then repeatedly receives the first synchronization data sent by the client device through the synchronization module 520, and realizes map data synchronization by sending a return value to the client device, and the return value is determined according to the first synchronization data. The first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is the generation time corresponding to the last synchronized historical map data obtained based on the first synchronization data; wherein, the generation time of the historical map data included in the historical map data list before sorting corresponding to the sorted historical map data list is later than the identification timestamp.
[0103] This embodiment provides a data synchronization device, which can effectively avoid repeated synchronization of data.
[0104] Furthermore, the synchronization module 520 is specifically used to: receive the first synchronization data sent by the client device; determine whether the first synchronization data needs to be saved; query the last synchronized historical map data from the historical map data stored in the background server as the latest synchronized map data; return the generation time corresponding to the latest synchronized map data to the client device as a return value, so that the client device synchronizes data according to the return value; return to continue executing the first synchronization data receiving operation until all historical map data in the updated historical map data list are synchronized.
[0105] Further, the determining whether the first synchronization data needs to be saved includes: querying whether the first synchronization data has completed synchronization within the historical time; if so, not saving the first synchronization data; if not, saving the first synchronization data.
[0106] The above-mentioned data synchronization device can execute the data synchronization method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0107] Embodiment 6
[0108] Figure 6 This is a schematic diagram of the structure of a client device provided by Embodiment 6 of the present invention. Figure 6 As shown, the client device provided in the sixth embodiment of the present invention includes: one or more processors 61 and a storage device 62; the processor 61 in the client device may be one or more, Figure 6A processor 61 is taken as an example; the storage device 62 is used to store one or more programs; the one or more programs are executed by the one or more processors 61, so that the one or more processors 61 implement the data synchronization method as described in any one of the embodiments of the present invention.
[0109] The client device may further include: an input device 63 and an output device 64 .
[0110] The processor 61, storage device 62, input device 63 and output device 64 in the client device may be connected via a bus or other means. Figure 6 The example of connecting through bus is taken in the following.
[0111] The storage device 62 in the client device is a computer-readable storage medium, which can be used to store one or more programs, and the program can be a software program, a computer executable program, and a module, such as the program instructions / modules corresponding to the data synchronization method provided in the first embodiment of the present invention (for example, the attached Figure 4 The modules in the data synchronization device shown include: an acquisition module 410, a sorting module 420 and a synchronization module 430). The processor 61 executes the software programs, instructions and modules stored in the storage device 62 to execute various functional applications and data processing of the client device, that is, to implement the data synchronization method in the above method embodiment.
[0112] The storage device 62 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of the client device, etc. In addition, the storage device 62 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 62 may further include a memory remotely arranged relative to the processor 61, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0113] The input device 63 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the client device. The output device 64 may include a display device such as a display screen.
[0114] Furthermore, when one or more programs included in the client device are executed by the one or more processors 61, the program performs the following operations:
[0115] Obtaining an identification timestamp from the backend server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized map data;
[0116] Sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp;
[0117] Repeatedly select a historical map data with the earliest generation time from the sorted historical map data list, send the historical map data with the earliest generation time to the background server, and synchronize the map data according to the return value obtained from the background server, the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the historical map data with the earliest generation time.
[0118] Embodiment 7
[0119] Figure 7 This is a schematic diagram of the structure of a backend server provided by Embodiment 7 of the present invention. Figure 7 As shown, the background server provided by the seventh embodiment of the present invention includes: one or more processors 71 and a storage device 72; the processor 71 in the background server can be one or more, Figure 7 A processor 71 is taken as an example; the storage device 72 is used to store one or more programs; the one or more programs are executed by the one or more processors 71, so that the one or more processors 71 implement the data synchronization method as described in any one of the embodiments of the present invention.
[0120] The background server may further include: an input device 73 and an output device 74 .
[0121] The processor 71, storage device 72, input device 73 and output device 74 in the backend server may be connected via a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0122] The storage device 72 in the background server is a computer-readable storage medium, which can be used to store one or more programs, and the program can be a software program, a computer executable program, and a module, such as the program instructions / modules corresponding to the data synchronization method provided in the second embodiment of the present invention (for example, the attached Figure 5The modules in the data synchronization device shown include: a generation module 610 and a synchronization module 620). The processor 71 executes various functional applications and data processing of the background server by running the software programs, instructions and modules stored in the storage device 72, that is, the data synchronization method in the above method embodiment is implemented.
[0123] The storage device 72 may include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required for a function; the data storage area may store data created according to the use of a background server, etc. In addition, the storage device 72 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the storage device 72 may further include a memory remotely arranged relative to the processor 71, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0124] The input device 73 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the backend server. The output device 74 may include display devices such as a display screen.
[0125] Furthermore, when one or more programs included in the background server are executed by the one or more processors 71, the program performs the following operations:
[0126] Mark the latest timestamp to obtain an identification timestamp;
[0127] Repeatedly receiving first synchronization data sent by a client device, and realizing map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data;
[0128] The generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp.
[0129] Embodiment 8
[0130] Embodiment 8 of the present invention provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, it is used to execute a data synchronization method.
[0131] As a method applied to a client device, the method comprises:
[0132] Obtaining an identification timestamp from the backend server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized map data;
[0133] Sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp;
[0134] Repeatedly select a historical map data with the earliest generation time from the sorted historical map data list, send the historical map data with the earliest generation time to the background server, and synchronize the map data according to the return value obtained from the background server, the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the background server based on the historical map data with the earliest generation time.
[0135] As a method applied to a backend server, the method comprises:
[0136] Mark the latest timestamp to obtain an identification timestamp;
[0137] Repeatedly receiving first synchronization data sent by a client device, and realizing map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data;
[0138] The generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp.
[0139] Optionally, when the program is executed by a processor, it can also be used to execute the data synchronization method provided by any embodiment of the present invention.
[0140] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination thereof. The computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.
[0141] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0142] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0143] Computer program code for performing the operation of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0144] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A data synchronization method, characterized in that: Executed by a client device, the method includes: Obtaining an identification timestamp from the backend server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronized map data; Sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp; Repeatedly selecting a historical map data with the earliest generation time from the sorted historical map data list, sending the historical map data with the earliest generation time to the backend server, and synchronizing the map data according to a return value obtained from the backend server, the sorted historical map list is updated according to the return value, and the return value includes the generation time corresponding to the last historical map data to be synchronized obtained by the backend server based on the historical map data with the earliest generation time; The repeatedly selecting a historical map data with the earliest generation time from the sorted historical map data list, sending the historical map data with the earliest generation time to the backend server, and synchronizing the map data according to the return value obtained from the backend server, comprises: Selecting a historical map data with the earliest generation time from the sorted historical map data list as the first synchronization data; Initiate a map data synchronization request to the backend server; When the backend server responds to the map data synchronization request, the first synchronization data is sent to the backend server; Obtaining a return value from the backend server; Filter the historical map data in the sorted historical map data list whose generation time is earlier than the return value to obtain an updated historical map data list; Return to continue executing the first synchronization data selection operation until all historical map data in the updated historical map data list are synchronized.
2. The method according to claim 1, characterized in that: The historical map data list is sorted to obtain a sorted historical map data list, including: Acquire a historical map data list from a third-party platform, wherein the historical map data list includes historical map data generated later than the identification timestamp; The historical map data are sorted in positive order according to the corresponding generation time to obtain a sorted historical map data list.
3. A data synchronization method, characterized in that: Executed by a backend server, the method includes: Mark the latest timestamp to obtain an identification timestamp; Repeatedly receiving first synchronization data sent by a client device, and realizing map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data is a historical map data with the earliest generation time selected from the sorted historical map data list, and the return value is a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data; Wherein, the generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp; The repeatedly receiving the first synchronization data sent by the client device and sending a return value to the client device to achieve map data synchronization includes: Receiving first synchronization data sent by the client device; Determining whether the first synchronization data needs to be saved; Querying the last synchronized historical map data from the historical map data stored in the backend server as the latest synchronized map data; Returning the generation time corresponding to the latest synchronized map data to the client device as a return value, so that the client device performs data synchronization according to the return value; Return to continue executing the first synchronous data receiving operation until all historical map data in the updated historical map data list are synchronized.
4. The method according to claim 3, characterized in that The determining whether the first synchronization data needs to be saved includes: Query whether the first synchronization data has been synchronized within the historical time; If yes, then the first synchronization data is not saved; If not, the first synchronization data is saved.
5. A data synchronization device, characterized in that: Configured on a client device, the device comprises: An acquisition module is used to acquire an identification timestamp from a background server, wherein the identification timestamp is obtained by identifying the latest timestamp, and the latest timestamp is the time when the target robot last synchronizes map data; A sorting module, used for sorting the historical map data list to obtain a sorted historical map data list, wherein the generation time of the historical map data included in the sorted historical map data list is later than the identification timestamp; a synchronization module, for repeatedly selecting a historical map data with the earliest generation time from the sorted historical map data list, sending the historical map data with the earliest generation time to the backend server, and realizing map data synchronization according to a return value obtained from the backend server, wherein the sorted historical map list is updated according to the return value, and the return value includes a generation time corresponding to the last historical map data to be synchronized obtained by the backend server based on the historical map data with the earliest generation time; Wherein, the synchronization module is specifically used for: Selecting a historical map data with the earliest generation time from the sorted historical map data list as the first synchronization data; Initiate a map data synchronization request to the backend server; When the backend server responds to the map data synchronization request, the first synchronization data is sent to the backend server; Obtaining a return value from the backend server; Filter the historical map data in the sorted historical map data list whose generation time is earlier than the return value to obtain an updated historical map data list; Return to continue executing the first synchronization data selection operation until all historical map data in the updated historical map data list are synchronized.
6. A data synchronization device, characterized in that: Configured on a backend server, the device includes: A generating module, used for marking the latest timestamp to obtain a marking timestamp; a synchronization module, configured to repeatedly receive first synchronization data sent by a client device, and implement map data synchronization by sending a return value to the client device, wherein the return value is determined according to the first synchronization data, the first synchronization data being a historical map data with the earliest generation time selected from a sorted historical map data list, and the return value being a generation time corresponding to the last historical map data to be synchronized obtained based on the first synchronization data; Wherein, the generation time of the historical map data included in the historical map data list before sorting corresponding to the historical map data list after sorting is later than the identification timestamp; Wherein, the synchronization module is specifically used for: Receiving first synchronization data sent by the client device; Determining whether the first synchronization data needs to be saved; Querying the last synchronized historical map data from the historical map data stored in the backend server as the latest synchronized map data; Returning the generation time corresponding to the latest synchronized map data to the client device as a return value, so that the client device performs data synchronization according to the return value; Return to continue executing the first synchronous data receiving operation until all historical map data in the updated historical map data list are synchronized.
7. A client device, characterized in that: include: one or more processors; A storage device for storing one or more programs; The one or more programs are executed by the one or more processors, so that the one or more processors are used to execute the data synchronization method described in any one of claims 1-2.
8. A backend server, characterized in that: include: one or more processors; A storage device for storing one or more programs; The one or more programs are executed by the one or more processors, so that the one or more processors are used to execute the data synchronization method described in any one of claims 3-4.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data synchronization method as described in any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Data synchronization method and terminal
CN107370803A
Data synchronization method, device and equipment
CN108536752A
Timestamp-based data synchronization method and device, and computer equipment
CN111245548A
Data synchronization method, system and device
CN111309747A
Always ready client / server data synchronization
US20100100590A1
