Data synchronization method, data synchronization device, electronic equipment and storage medium

By establishing a message queue between edge devices and the cloud and using the data query API, the problem of high cost of data synchronization development and lack of universality in the prior art is solved, and efficient and reliable data synchronization is achieved.

CN119854318APending Publication Date: 2025-04-18SHANGMAI IOT (HANGZHOU) CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510058137.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-01-14
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

The existing technology has high development costs and lacks universality in the data synchronization process in the end-edge cloud scenario, which limits the data synchronization capabilities of cloud manufacturers.

Method used

By establishing a message queue between edge devices and the cloud, monitoring the data change status, and using the data query API provided by the cloud to synchronize data, and configuring the API based on synchronization configuration information to realize downlink and uplink synchronization of data.

Benefits of technology

It reduces the difficulty and cost of developing edge data synchronization, improves the universality of data synchronization, ensures the ability to retry failures on weak networks, and realizes instant synchronization of centralized data changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119854318A_ABST
    Figure CN119854318A_ABST
Patent Text Reader

Abstract

The invention provides a data synchronization method, a data synchronization device, electronic equipment and a storage medium. The method is applied to an edge device and comprises the steps that a first change state of data in a cloud end and a second change state of the data in the edge device are monitored, a message queue exists between the edge device and the cloud end, and the first change state is obtained by pushing the message queue to the edge device from the cloud end; in response to the update of any one of the first change state and the second change state, triggering the edge device and the cloud to execute a data synchronization task; the execution of the data synchronization task comprises: calling a data query API provided by the cloud, the data query API being configured by the cloud according to synchronization configuration information, and the synchronization configuration information comprising an entity needing to be synchronized between the cloud and the edge device, a data range of the entity and a data conflict resolution strategy; and completing data synchronization between the cloud and the edge device through the data query API.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention mainly relates to the field of cloud technology, and in particular to a data synchronization method, a data synchronization device, an electronic device and a storage medium. Background Art

[0002] The current common solution to the data synchronization problem in the edge-cloud scenario is that the cloud (i.e., the central node of the Internet of Things) provides various business logic APIs (Application Programming Interface), and the edge node calls the various business logic APIs regularly or in real time to synchronize data to the local database or cloud database. Since the data structure and business logic of different businesses are different, the development cost is increased, and there is a lack of universality, which limits the data synchronization capabilities of cloud vendors. Summary of the invention

[0003] The present application provides a data synchronization method, a data synchronization device, an electronic device and a storage medium, which are used to solve the problem of high development cost of existing edge data synchronization.

[0004] In a first aspect, the present application provides a data synchronization method, applied to an edge device, comprising:

[0005] Monitoring a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by being pushed from the cloud to the edge device via the message queue, and the second change state is obtained by a data operation occurring on the edge device;

[0006] In response to an update of any one of the first change state and the second change state, triggering execution of a data synchronization task between the edge device and the cloud; wherein the execution of the data synchronization task includes:

[0007] Calling a data query API provided by the cloud, wherein the data query API is configured by the cloud according to synchronization configuration information, the synchronization configuration information including: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0008] Data synchronization is completed between the cloud and the edge device through the data query API.

[0009] In some embodiments, triggering the edge device and the cloud to perform a data synchronization task includes:

[0010] In response to the update of the first change state, triggering the edge device and the cloud to perform a downlink data synchronization task; wherein the performing of the downlink data synchronization task includes:

[0011] Calling the data downlink query API provided by the cloud;

[0012] The cloud data is synchronized to the edge device through the data downlink query API.

[0013] In some embodiments, synchronizing the cloud data to the edge device through the data downlink query API includes:

[0014] Obtain a synchronization context and a local version number, wherein the synchronization context is used to indicate the data range of the entity that needs to be synchronized from the cloud to the edge device for the downlink data synchronization task, and the local version number refers to the current version number of the entity in the edge device;

[0015] According to the synchronization context and the local version number, querying first data corresponding to the data range from the data in the cloud, wherein the version number of the first data is greater than the local version number;

[0016] Sending the first data from the cloud to the edge device through the data downlink query API;

[0017] The first data is saved to an edge database corresponding to the edge device.

[0018] In some embodiments, triggering the edge device and the cloud to perform a data synchronization task includes:

[0019] In response to the update of the second change state, triggering the edge device and the cloud to perform an uplink data synchronization task; wherein the performing of the uplink data synchronization task includes:

[0020] Calling the data uplink query API provided by the cloud;

[0021] The data of the edge device is synchronized to the cloud through the data uplink query API.

[0022] In some embodiments, synchronizing the data of the edge device to the cloud through the data uplink query API includes:

[0023] Querying second data in a state to be synchronized from the data of the edge device, and changing the state of the second data to being synchronized;

[0024] Sending the second data to the cloud through the data uplink query API, so that the cloud saves the second data to a cloud database corresponding to the cloud;

[0025] In response to the second data being successfully saved in the cloud database, the status of the second data in the edge device is updated to synchronized.

[0026] In some embodiments, it also includes:

[0027] According to the timer set on the edge device, the data synchronization task between the edge device and the cloud is triggered regularly.

[0028] In a second aspect, the present application provides a data synchronization method, applied in the cloud, comprising:

[0029] Pushing a first change state to the edge device through a message queue established with the edge device, wherein the first change state refers to a change state of the data in the cloud;

[0030] Acquire synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0031] Configure a data query API according to the synchronization configuration information;

[0032] In response to a call request initiated by the edge device to the data query API, data synchronization is completed between the cloud and the edge device through the data query API.

[0033] In some embodiments, the data query API includes: a data downlink query API and a data uplink query API, wherein the data downlink query API is associated with a downlink data synchronization task triggered by the edge device, and the data uplink query API is associated with an uplink data synchronization task triggered by the edge device;

[0034] The data conflict resolution strategy includes: a downlink conflict resolution strategy and an uplink conflict resolution strategy, wherein the downlink conflict resolution strategy is used to resolve the data conflict situation between the cloud and the edge device in the downlink data synchronization task, and the uplink conflict resolution strategy is used to resolve the data conflict situation between the cloud and the edge device in the uplink data synchronization task.

[0035] In some embodiments, it also includes:

[0036] According to a current operation performed by the cloud on the entity, a version number of the entity in the cloud is updated, wherein the current operation refers to any one of an insert operation, an update operation, and a delete operation.

[0037] In a third aspect, the present application provides a data synchronization device for an edge device, comprising:

[0038] A monitoring unit, configured to monitor a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by being pushed from the cloud to the edge device via the message queue, and the second change state is obtained by a data operation occurring on the edge device;

[0039] A task triggering unit, configured to trigger execution of a data synchronization task between the edge device and the cloud in response to an update of any one of the first change state and the second change state; wherein the execution of the data synchronization task comprises:

[0040] Calling a data query API provided by the cloud, wherein the data query API is configured by the cloud according to synchronization configuration information, the synchronization configuration information including: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0041] Data synchronization is completed between the cloud and the edge device through the data query API.

[0042] In a fourth aspect, the present application provides a data synchronization device for a cloud, comprising:

[0043] A pushing unit, configured to push a first change state to the edge device through a message queue established with the edge device, wherein the first change state refers to a change state of the data in the cloud;

[0044] An acquisition unit, configured to acquire synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0045] A configuration unit, configured to configure a data query API according to the synchronization configuration information;

[0046] The synchronization unit completes data synchronization between the cloud and the edge device through the data query API in response to a call request initiated by the edge device to the data query API.

[0047] In a fifth aspect, the present application provides an electronic device, including:

[0048] one or more processors; and,

[0049] One or more memories coupled to the one or more processors and storing instructions thereon, which, when the instructions are executed individually or collectively by the one or more processors, cause the edge device to perform the method according to any one of the first aspect and the second aspect.

[0050] In a sixth aspect, a non-transitory computer-readable storage medium storing machine-executable instructions is provided. The machine-executable instructions, when executed by one or more processors of a machine, cause the machine to perform any one of the above methods.

[0051] Compared with the prior art, the present invention has the following advantages:

[0052] The present application provides a data synchronization method, a data synchronization device, an electronic device and a storage medium. By combining the advantages of API and message queues, the cloud uses synchronized configuration information to complete the configuration data query API, and the edge device triggers the data synchronization task by listening to the data changes in the cloud and local, thereby reducing the difficulty and cost of developing edge data synchronization, ensuring the ability to retry failures in weak networks, and helping to achieve instant synchronization of centralized data changes.

[0053] It should be understood that the invention summary is not intended to identify the key or essential features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] The accompanying drawings are included to provide a further understanding of the present application. They are included and constitute a part of the present application. The accompanying drawings illustrate embodiments of the present application and together with the present specification serve to explain the principles of the present application. In the accompanying drawings:

[0055] Figure 1 The system architecture 100 of the data synchronization method and device suitable for the embodiment of the present application is exemplarily shown;

[0056] Figure 2 A flowchart 200 of a data synchronization method provided by the present application is exemplarily shown;

[0057] Figure 3 A flowchart 300 of a downlink data synchronization task provided by the present application is exemplarily shown;

[0058] Figure 4 A flowchart 400 of an uplink data synchronization task provided by the present application is exemplarily shown;

[0059] Figure 5A logic diagram 500 for synchronous status update of edge devices provided by the present application is exemplarily shown;

[0060] Figure 6 A flowchart 600 of a data synchronization method provided by the present application is exemplarily shown;

[0061] Figure 7 A logic diagram 700 for updating a version number in the cloud provided by the present application is exemplarily shown;

[0062] Figure 8 A schematic diagram 800 of a data synchronization device for edge devices provided by an exemplary embodiment of the present application is exemplarily shown;

[0063] Fig. 9 A schematic diagram 900 of a data synchronization device for a cloud provided by an exemplary embodiment of the present application is exemplarily shown;

[0064] Fig.10 A schematic diagram 1000 of an electronic device provided by an exemplary embodiment of the present application is exemplarily shown. DETAILED DESCRIPTION

[0065] The principle of the present disclosure will now be described with reference to some embodiments. It should be understood that the description of these embodiments is only for illustrative purposes, and helps those skilled in the art to understand and implement the present disclosure, without any limitation to the scope of the present disclosure. The disclosure described herein can be implemented in a manner different from that described below.

[0066] In the following description and claims, unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this disclosure belongs.

[0067] References in this disclosure to "one embodiment," "an embodiment," "an exemplary embodiment," etc. indicate that the described embodiment may include a particular feature, structure, or characteristic, but not every embodiment necessarily includes the particular feature, structure, or characteristic. Moreover, such phrases do not necessarily refer to the same embodiment. In addition, when a particular feature, structure, or characteristic is described in conjunction with an exemplary embodiment, whether or not explicitly described, those skilled in the art will recognize that such feature, structure, or characteristic affects incorporation into other embodiments.

[0068] It should be understood that although the terms "first" and "second" etc. may be used to describe various elements herein, these elements should not be limited by these terms. These terms are only used to distinguish one element from another element. For example, without departing from the scope of the exemplary embodiments, a first element may be referred to as a second element, and similarly, a second element may be referred to as a first element. The term "and / or" as used herein includes any and all combinations of one or more of the listed terms.

[0069] The terms used herein are only for describing specific embodiments, rather than for limiting exemplary embodiments. The singular forms "one", "an", and "the" used herein also include plural forms, unless the context clearly indicates otherwise. "A group of elements" or "element set" used herein is intended to include one or more elements. It should also be understood that the terms "include", "comprise", "have", "have", "include" and / or "include", when used herein, specify the presence of the features, elements and / or parts, etc., but do not exclude the presence or addition of one or more other features, elements, parts and / or combinations thereof.

[0070] As used in this application, the term "circuitry" may refer to one or more or all of the following:

[0071] (a) Hardware circuit implementation only (e.g., implementation only in analog and / or digital circuits)

[0072] (b) a combination of hardware circuitry and software, such as (where applicable):

[0073] (i) a combination of analog and / or digital hardware circuits and software / firmware; and

[0074] (ii) any portion of a hardware processor (including a digital signal processor) with software, software and memory that work together to enable a device such as a mobile phone or server to perform various functions, and

[0075] (c) A hardware circuit and / or processor, such as a microprocessor or portion of a microprocessor, that requires software (e.g., firmware) to operate, but where software is not required for operation, the software may not be present.

[0076] This definition of circuitry applies to all uses of this term in this application, including in any claims. As another example, as used in this application, the term circuitry also includes merely a hardware circuit or processor (or multiple processors) or a portion of a hardware circuit or processor and its (or their) accompanying software and / or firmware implementation. The term circuitry also includes, for example, if applicable to the particular claim element, a baseband integrated circuit or processor integrated circuit for a mobile device, or a similar integrated circuit in a server, cellular network device, or other computing network device.

[0077] The term "edge device" refers to any device capable of wireless communication with the cloud and the user end. As an example and not a limitation, the edge device may refer to a switch, a router, a routing switch, a local area network (LAN) device, a wide area network (WAN) device, and the like. These edge devices may follow any appropriate communication standard network, such as long-term evolution (LTE), LTE-Advanced (LTE-A), wideband code division multiple access (WCDMA), high-speed packet access (HSPA), narrowband Internet of Things (NB-IOT), new radio (NR), non-terrestrial network (NTN), etc. In addition, the communication between different edge devices and the cloud or the user end may be performed according to any appropriate generation of communication protocols, including but not limited to the first generation (1G), second generation (2G), 2.5G, 2.75G, third generation (3G), fourth generation (4G), 4.5G, fifth generation (5G), future sixth generation (6G) communication protocols, and / or any other protocols currently known or to be developed in the future. The embodiments of the present disclosure may be applied to solve the problem of difficulty in data synchronization between these edge devices and the cloud. In the following description, the term “edge device” may be understood as any of the above devices.

[0078] The existing solutions to edge data synchronization usually involve edge nodes calling various business logic APIs periodically or in real time to synchronize data to local databases or cloud databases. Since different businesses have different data structures and business logics, the development cost is increased and there is a lack of versatility, which limits the data synchronization capabilities of cloud vendors.

[0079] The embodiments of the present disclosure provide a data synchronization solution to reduce the difficulty and cost of developing edge data synchronization. In this solution, by combining the advantages of API and message queue, the cloud uses synchronization configuration information to complete the configuration data query API, and the edge device triggers the data synchronization task by listening to the cloud and local data changes, so that data synchronization development does not need to focus on specific business logic, improves versatility, ensures the ability to retry failures in weak networks, and helps to achieve instant synchronization of centralized data changes.

[0080] Figure 1 The system architecture 100 of the data synchronization method and apparatus suitable for the embodiments of the present application is exemplarily shown.

[0081] like Figure 1 As shown, the system structure 100 may include a cloud 10 and an edge device 20. There is a message queue 30 between the cloud 10 and the edge device 20, which is used to push the first change state of the data in the cloud (such as the addition / deletion / modification of the data in the cloud). The cloud 10 provides a data query API 40 that can be called by the edge device 20, which is used to obtain or upload data when the edge device 20 triggers a data synchronization task.

[0082] Optionally, the system structure 100 may further include a user terminal 50 and a development terminal 60 connected to the cloud 10. The user terminal 50 may be used to initiate a business operation to change the data on the cloud 10. The development terminal 60 may be used to provide synchronization configuration information to the cloud 10 so that the cloud uses the synchronization configuration information to complete the configuration data query API.

[0083] It should be understood that Figure 1 The number of cloud, edge devices, user terminals, development terminals, etc. in the embodiment is only illustrative. Any number of cloud, edge devices, user terminals, development terminals, etc. may be provided according to implementation requirements.

[0084] Figure 2 The flowchart 200 of a data synchronization method provided by the present application is exemplarily shown. Figure 2 As shown, the method 200 may include operations S201 to S204 for an edge device, including:

[0085] S201, monitoring a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by pushing the message queue from the cloud to the edge device, and the second change state is obtained by a data operation occurring on the edge device;

[0086] In some embodiments, when a user terminal initiates a business operation, the business service on the user terminal can send a change message to the data service on the cloud. The cloud can determine the first change state based on the change message, and can push the currently changed first change state to the message queue through the data service. The edge device receives the first change state from the message queue so that it can quickly respond to data changes in the cloud, which helps to achieve instant processing of business operations and improve the timeliness of data synchronization.

[0087] In some embodiments, the edge device can sense local data changes by intercepting local operations (such as adding / deleting / modifying local data, etc.), and can determine the second change state based on the local data changes.

[0088] S202, in response to an update of any one of the first change state and the second change state, triggering execution of a data synchronization task between the edge device and the cloud; wherein the execution of the data synchronization task includes:

[0089] S203, calling a data query API provided by the cloud, wherein the data query API is configured by the cloud according to synchronization configuration information, and the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data range of the entity, and data conflict resolution strategy;

[0090] S204, complete data synchronization between the cloud and edge devices through the data query API.

[0091] In some embodiments, the synchronization configuration information can be sent from the development end to the cloud. In the synchronization configuration information, the entities that need to be synchronized between the cloud and the edge device can be entities of the table structure. The data range of the entity can be a filtering condition for the table, for example, the full range, or the data range corresponding to a specified variable in the table, etc. The data conflict resolution strategy can be the processing logic that the API can specify for data conflicts, such as "cloud covers edge", "edge covers cloud", etc., and can also be customized according to specific business scenarios, without limitation.

[0092] For example, in the embodiment described, the synchronization configuration information of the cloud may be as shown in Table 1 below:

[0093] Table 1

[0094]

[0095] Among them, ${xxx} refers to the context variable that needs to be synchronized in the entity.

[0096] In some embodiments, triggering the execution of a data synchronization task between the edge device and the cloud includes:

[0097] In response to the first change state being updated, triggering the edge device and the cloud to perform a downlink data synchronization task; wherein the performing of the downlink data synchronization task includes:

[0098] Call the data downlink query API provided by the cloud;

[0099] Synchronize cloud data to edge devices through data downlink query API.

[0100] Figure 3 The flowchart 300 of a downlink data synchronization task provided by the present application is exemplarily shown. Figure 3As shown, the method 300 may include operations S301, S302, and S304 for edge devices, and operation S303 for the cloud, including:

[0101] S301, the edge device obtains a synchronization context and a local version number, wherein the synchronization context is used to indicate the data range of the entity that needs to be synchronized from the cloud to the edge device for the downlink data synchronization task, and the local version number refers to the current version number of the entity in the edge device;

[0102] S302, the edge device queries the first data corresponding to the data range from the data in the cloud according to the synchronization context and the local version number, wherein the version number of the first data is greater than the local version number;

[0103] S303, the cloud sends the first data from the cloud to the edge device through the data downlink query API;

[0104] S304: The edge device saves the first data to an edge database corresponding to the edge device.

[0105] In operation S303, if a data conflict occurs, the cloud can handle it according to the data conflict handling strategy configured above.

[0106] It should be understood that when the cloud can query multiple first data with version numbers greater than the local version number, the cloud can return these first data in order according to the version number, such as returning "v5.0", "v4.0" and so on in sequence.

[0107] In some embodiments, triggering the execution of a data synchronization task between the edge device and the cloud includes:

[0108] In response to the update of the second change state, triggering the execution of an uplink data synchronization task between the edge device and the cloud; wherein the execution of the uplink data synchronization task includes:

[0109] Call the data uplink query API provided by the cloud;

[0110] Synchronize the data of edge devices to the cloud through the data uplink query API.

[0111] Figure 4 The flowchart 400 of an uplink data synchronization task provided by the present application is exemplarily shown. Figure 4 As shown, the method 400 may include operations S401, S402, and S404 for edge devices, and operation S403 for the cloud.

[0112] S401, the edge device queries the second data in a state to be synchronized from the data of the edge device, and changes the state of the second data to being synchronized;

[0113] S402, the edge device sends the second data to the cloud through the data uplink query API;

[0114] S403, the cloud saves the second data to a cloud database corresponding to the cloud;

[0115] S404: In response to the second data being successfully saved in the cloud database, the edge device updates the status of the second data in the edge device to synchronized.

[0116] In operation S403, if a data conflict occurs, the cloud can handle it according to the data conflict handling strategy configured above to ensure the normal operation of data synchronization.

[0117] It should be understood that in the case where the cloud only successfully saves part of the second data to the cloud database, the cloud can return the identifier of the successfully saved part of the data to the edge device, so that the edge device updates the status of this part of the data to synchronized according to the identifier, while the remaining part of the second data may not be updated, or may be updated again to not synchronized.

[0118] Figure 5 The following is an exemplary diagram of a logic diagram 500 for synchronous state update of edge devices provided by the present application. Figure 5 , for the data on the edge device, there can be three states: "to be synchronized", "synchronizing" and "synchronized". Among them, when the edge device triggers a data synchronization task (including downlink data synchronization tasks and uplink data synchronization tasks), the state of the corresponding data is updated from "to be synchronized" to "synchronizing"; when the downlink data synchronization task or uplink data synchronization task has been completed, the state of the corresponding data is updated from "synchronizing" to "synchronized"; when the data is generated locally, the synchronized data is changed, the synchronization fails, etc., the state of the corresponding data is updated to "to be synchronized".

[0119] In some embodiments, a timer may be set on the edge device to periodically execute data synchronization tasks between the cloud and the edge device.

[0120] In this way, the data synchronization task triggered by the edge device can be executed immediately based on the changes in cloud and local data, or it can be polled and executed at a fixed time, ensuring the ability to retry failures in weak network conditions while also ensuring timeliness.

[0121] Figure 6 A flowchart 600 of a data synchronization method provided by the present application is exemplarily shown. Figure 6 As shown, the method 600 may include operations S601 to S604 for the cloud, including:

[0122] S601, pushing a first change state to the edge device through a message queue established with the edge device, where the first change state refers to a change state of data in the cloud;

[0123] S602, obtaining synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0124] S603, configuring a data query API according to the synchronization configuration information;

[0125] S604, in response to the call request initiated by the edge device to the data query API, complete data synchronization between the cloud and the edge device through the data query API.

[0126] In some embodiments, the data query API includes: a data downlink query API and a data uplink query API, wherein the data downlink query API is associated with a downlink data synchronization task triggered by an edge device, and the data uplink query API is associated with an uplink data synchronization task triggered by an edge device;

[0127] The data conflict resolution strategy includes: downlink conflict resolution strategy and uplink conflict resolution strategy. The downlink conflict resolution strategy is used to resolve data conflicts between the cloud and edge devices in downlink data synchronization tasks, and the uplink conflict resolution strategy is used to resolve data conflicts between the cloud and edge devices in uplink data synchronization tasks.

[0128] In some embodiments, it also includes:

[0129] According to the current operation performed on the entity by the cloud, the version number of the entity in the cloud is updated, wherein the current operation refers to any one of an insert operation, an update operation, and a delete operation.

[0130] It should be understood that the version number after the entity is updated needs to be different from the previous version number, so as to ensure that each version of the entity is unique.

[0131] Figure 7 The following is an exemplary diagram of a logic diagram 700 for updating a version number in the cloud provided by the present application. Figure 7 As shown, for a certain entity (table), when a record a is inserted, the cloud updates its version number to "1"; for the same entity, when a record b is inserted, the cloud updates its version number to "2"; for the entity with version number "1", when the a record is updated, the cloud updates its version number to "3"; for the entity with version number "2", when the b record is updated, the cloud updates its version number to "4"; for the entity with version number "3", when the a record is deleted, the cloud updates its version number to "5".

[0132] Optionally, if the cloud migrates the entity, the entity and all its corresponding version numbers are deleted on the cloud.

[0133] Figure 8 A schematic diagram 800 of a data synchronization device for edge devices provided by an exemplary embodiment of the present application is exemplarily shown. Figure 8 , a data synchronization device 800 for edge devices includes a monitoring unit 801 and a task triggering unit 802. Wherein:

[0134] A monitoring unit 801 is used to monitor a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by pushing the message queue from the cloud to the edge device, and the second change state is obtained by a data operation occurring on the edge device;

[0135] The task triggering unit 802 is used to trigger the execution of a data synchronization task between the edge device and the cloud in response to an update of any one of the first change state and the second change state; wherein the execution of the data synchronization task includes:

[0136] Calling the data query API provided by the cloud, where the data query API is configured by the cloud according to the synchronization configuration information, which includes: entities to be synchronized between the cloud and the edge device, the data range of the entity, and the data conflict resolution strategy;

[0137] Data synchronization is completed between the cloud and edge devices through data query API.

[0138] Fig. 9 A schematic diagram 900 of a data synchronization device for a cloud provided by an exemplary embodiment of the present application is exemplarily shown. Fig. 9 , a data synchronization device 900 for cloud computing includes a push unit 901, an acquisition unit 902, a configuration unit 903 and a synchronization unit 904. Among them:

[0139] A push unit 901 is used to push a first change state to the edge device through a message queue established with the edge device, wherein the first change state refers to a change state of data in the cloud;

[0140] An acquisition unit 902 is used to acquire synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies;

[0141] Configuration unit 903, configured to configure a data query API according to synchronization configuration information;

[0142] The synchronization unit 904 completes data synchronization between the cloud and the edge device through the data query API in response to a call request initiated by the edge device to the data query API.

[0143] The data synchronization device 800 for edge devices and the data synchronization device 900 for the cloud provided in the embodiments of the present application can execute the above method embodiments, and their implementation principles and technical effects are similar, which will not be repeated here.

[0144] It should be noted that the data synchronization device 800 for edge devices and the data synchronization device 900 for the cloud are embodied in the form of functional units. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this.

[0145] For example, a "unit" may be a software program, a hardware circuit, or a combination of the two that implements the above functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (e.g., a shared processor, a dedicated processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a combined logic circuit, and / or other suitable components that support the described functions.

[0146] Therefore, the units of each example described in the embodiments of the present application can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present application.

[0147] further, Fig.10 The schematic diagram 1000 of an electronic device provided by an exemplary embodiment of the present application is exemplarily shown. The electronic device 1000 includes a processor 1001 and a memory 1002, in which a computer program is stored. When the computer program is called by the processor 1001, the processor 1001 executes the steps described in the above method embodiment.

[0148] It should be understood that the processor mentioned in the embodiments of the present application may be a CPU, or other general-purpose processors, DSPs, ASICs, FPGAs or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.

[0149] It should also be understood that the memory mentioned in the embodiments of the present application may be a volatile memory or a non-volatile memory, or may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory, an erasable programmable read-only memory, an electrically erasable programmable read-only memory, or a flash memory. The volatile memory may be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory, dynamic random access memory, synchronous dynamic random access memory, double data rate synchronous dynamic random access memory, enhanced synchronous dynamic random access memory, synchronously connected dynamic random access memory, and direct memory bus random access memory.

[0150] The present application also provides a non-transitory computer-readable storage medium storing machine-executable instructions. When the machine-executable instructions are executed by one or more processors of a machine, the machine executes any one of the above methods.

[0151] The storage medium may include a propagated data signal containing computer program code, such as in baseband or as part of a carrier wave. The propagated signal may be in a variety of forms, including electromagnetic, optical, etc., or a suitable combination. The storage medium may be any computer-readable medium other than a computer-readable storage medium, which can be connected to an instruction execution system, device or equipment to communicate, propagate or transmit the program for use. The program code located on the computer-readable medium can be transmitted via any suitable medium, including radio, cable, fiber optic cable, radio frequency signal, or similar medium, or any combination of the above mediums.

[0152] The basic concepts have been described above. Obviously, for those skilled in the art, the above invention disclosure is only used as an example and does not constitute a limitation of the present application. Although not explicitly stated herein, those skilled in the art may make various modifications, improvements and amendments to the present application. Such modifications, improvements and amendments are suggested in the present application, so such modifications, improvements and amendments still belong to the spirit and scope of the exemplary embodiments of the present application.

[0153] At the same time, the present application uses specific words to describe the embodiments of the present application. For example, "one embodiment", "an embodiment", and / or "some embodiments" refer to a certain feature, structure or characteristic related to at least one embodiment of the present application. Therefore, it should be emphasized and noted that "one embodiment" or "an embodiment" or "an alternative embodiment" mentioned twice or more in different positions in this specification does not necessarily refer to the same embodiment. In addition, some features, structures or characteristics in one or more embodiments of the present application can be appropriately combined.

[0154] Some aspects of the present application may be performed entirely by hardware, entirely by software (including firmware, resident software, microcode, etc.), or by a combination of hardware and software. The above hardware or software may be referred to as "data blocks", "modules", "engines", "units", "components" or "systems". The processor may be one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DAPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), processors, controllers, microcontrollers, microprocessors, or combinations thereof. In addition, various aspects of the present application may be expressed as computer products located in one or more computer-readable media, which include computer-readable program codes. For example, computer-readable media may include, but are not limited to, magnetic storage devices (e.g., hard disks, floppy disks, tapes ...), optical disks (e.g., compact disks CDs, digital versatile disks DVDs ...), smart cards, and flash memory devices (e.g., cards, sticks, key drives ...).

[0155] A computer-readable medium may include a propagated data signal containing computer program code, such as in baseband or as part of a carrier wave. The propagated signal may have a variety of manifestations, including electromagnetic, optical, etc., or a suitable combination. A computer-readable medium may be any computer-readable medium other than a computer-readable storage medium, which may be connected to an instruction execution system, device or apparatus to communicate, propagate or transmit a program for use. The program code on the computer-readable medium may be propagated via any suitable medium, including radio, cable, fiber optic cable, radio frequency signal, or similar medium, or any combination of the above mediums.

[0156] Similarly, it should be noted that in order to simplify the description of the disclosure of this application and thus help understand one or more embodiments of the invention, in the above description of the embodiments of this application, multiple features are sometimes combined into one embodiment, figure or description thereof. However, this disclosure method does not mean that the features required by the object of this application are more than the features mentioned in the claims. In fact, the features of the embodiments are less than all the features of the single embodiment disclosed above.

[0157] In some embodiments, numbers describing the number of components and attributes are used. It should be understood that such numbers used in the description of the embodiments are modified by the modifiers "about", "approximately" or "substantially" in some examples. Unless otherwise specified, "about", "approximately" or "substantially" indicate that the numbers are allowed to vary by ±20%. Accordingly, in some embodiments, the numerical parameters used in the specification and claims are approximate values, which may change according to the required features of individual embodiments. In some embodiments, the numerical parameters should take into account the specified significant digits and adopt the general method of retaining digits. Although the numerical domains and parameters used to confirm the breadth of their range in some embodiments of the present application are approximate values, in specific embodiments, the setting of such numerical values ​​is as accurate as possible within the feasible range.

[0158] Although the present application has been described with reference to the current specific embodiments, ordinary technicians in this technical field should recognize that the above embodiments are only used to illustrate the present application, and various equivalent changes or substitutions may be made without departing from the spirit of the present application. Therefore, as long as the changes and modifications to the above embodiments are within the essential spirit of the present application, they will fall within the scope of the claims of the present application.

Claims

1. A data synchronization method, characterized in that: Applied to edge devices, including: Monitoring a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by being pushed from the cloud to the edge device via the message queue, and the second change state is obtained by a data operation occurring on the edge device; In response to an update of any one of the first change state and the second change state, triggering execution of a data synchronization task between the edge device and the cloud; wherein the execution of the data synchronization task includes: Calling a data query API provided by the cloud, wherein the data query API is configured by the cloud according to synchronization configuration information, the synchronization configuration information including: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies; Data synchronization is completed between the cloud and the edge device through the data query API.

2. The method according to claim 1, characterized in that The triggering of the data synchronization task between the edge device and the cloud comprises: In response to the update of the first change state, triggering the edge device and the cloud to perform a downlink data synchronization task; wherein the performing of the downlink data synchronization task includes: Calling the data downlink query API provided by the cloud; The cloud data is synchronized to the edge device through the data downlink query API.

3. The method according to claim 2, characterized in that The step of synchronizing the cloud data to the edge device through the data downlink query API includes: Obtain a synchronization context and a local version number, wherein the synchronization context is used to indicate the data range of the entity that needs to be synchronized from the cloud to the edge device for the downlink data synchronization task, and the local version number refers to the current version number of the entity in the edge device; According to the synchronization context and the local version number, querying first data corresponding to the data range from the data in the cloud, wherein the version number of the first data is greater than the local version number; Sending the first data from the cloud to the edge device through the data downlink query API; The first data is saved to an edge database corresponding to the edge device.

4. The method according to claim 1, characterized in that The triggering of the data synchronization task between the edge device and the cloud comprises: In response to the update of the second change state, triggering the execution of an uplink data synchronization task between the edge device and the cloud; wherein the execution of the uplink data synchronization task includes: Calling the data uplink query API provided by the cloud; The data of the edge device is synchronized to the cloud through the data uplink query API.

5. The method according to claim 4, characterized in that The step of synchronizing the data of the edge device to the cloud through the data uplink query API includes: Querying second data in a state to be synchronized from the data of the edge device, and changing the state of the second data to being synchronized; Sending the second data to the cloud through the data uplink query API, so that the cloud saves the second data to a cloud database corresponding to the cloud; In response to the second data being successfully saved in the cloud database, the status of the second data in the edge device is updated to synchronized.

6. The method according to claim 1, characterized in that Also includes: According to the timer set on the edge device, the data synchronization task between the edge device and the cloud is triggered regularly.

7. A data synchronization method, characterized in that: Applied in the cloud, including: Pushing a first change state to the edge device through a message queue established with the edge device, wherein the first change state refers to a change state of the data in the cloud; Acquire synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies; Configure a data query API according to the synchronization configuration information; In response to a call request initiated by the edge device to the data query API, data synchronization is completed between the cloud and the edge device through the data query API.

8. The method according to claim 7, characterized in that The data query API includes: a data downlink query API and a data uplink query API, wherein the data downlink query API is associated with a downlink data synchronization task triggered by the edge device, and the data uplink query API is associated with an uplink data synchronization task triggered by the edge device; The data conflict resolution strategy includes: a downlink conflict resolution strategy and an uplink conflict resolution strategy, wherein the downlink conflict resolution strategy is used to resolve the data conflict situation between the cloud and the edge device in the downlink data synchronization task, and the uplink conflict resolution strategy is used to resolve the data conflict situation between the cloud and the edge device in the uplink data synchronization task.

9. The method according to claim 8, characterized in that Also includes: According to a current operation performed by the cloud on the entity, a version number of the entity in the cloud is updated, wherein the current operation refers to any one of an insert operation, an update operation, and a delete operation.

10. A data synchronization device for edge devices, characterized in that: include: A monitoring unit, configured to monitor a first change state of data in the cloud and a second change state of data in the edge device, wherein a message queue is provided between the edge device and the cloud, the first change state is obtained by being pushed from the cloud to the edge device via the message queue, and the second change state is obtained by a data operation occurring on the edge device; A task triggering unit, configured to trigger execution of a data synchronization task between the edge device and the cloud in response to an update of any one of the first change state and the second change state; wherein the execution of the data synchronization task comprises: Calling a data query API provided by the cloud, wherein the data query API is configured by the cloud according to synchronization configuration information, the synchronization configuration information including: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies; Data synchronization is completed between the cloud and the edge device through the data query API.

11. A data synchronization device for cloud, characterized in that: include: A pushing unit, configured to push a first change state to the edge device through a message queue established with the edge device, wherein the first change state refers to a change state of the data in the cloud; An acquisition unit, configured to acquire synchronization configuration information, wherein the synchronization configuration information includes: entities to be synchronized between the cloud and the edge device, data ranges of the entities, and data conflict resolution strategies; A configuration unit, configured to configure a data query API according to the synchronization configuration information; The synchronization unit completes data synchronization between the cloud and the edge device through the data query API in response to a call request initiated by the edge device to the data query API.

12. An electronic device, characterized in that: include: one or more processors; as well as, One or more memories coupled to the one or more processors and storing instructions thereon, which, when the instructions are executed individually or collectively by the one or more processors, cause the edge device to perform a method according to any one of claims 1-9.

13. A non-transitory computer-readable storage medium storing machine-executable instructions, which, when executed by one or more processors of a machine, cause the machine to perform the method of any one of claims 1-9.