Data synchronization methods, gateways, products and systems
By constructing a hierarchical data synchronization mechanism and a globally unique identifier hash value strategy, the problems of high connection overhead and network congestion in multi-level gateway systems are solved, achieving efficient and reliable configuration synchronization management and improving system stability and fault location efficiency.
Patent Information
- Application Number
- CN202611182876.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-05
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2046-08-05
AI Technical Summary
In multi-level gateway systems based on hierarchical logical address encoding, existing technologies result in high connection overhead and network congestion, especially when devices are restarted in batches or configurations are changed, leading to severe resource contention and complex troubleshooting.
A hierarchical data synchronization mechanism is constructed, which uses a three-layer synchronization architecture between the platform and the root gateway, between gateways, and between gateways and sub-devices. The synchronization time interval is calculated using the hash value of a globally unique identifier, so as to achieve a uniform distribution of data synchronization requests on the time axis. A dual-backup configuration storage and version identifier comparison mechanism are also adopted.
It reduces connection overhead, avoids network congestion and resource contention, improves system stability and fault location efficiency, and ensures timely consistency and reliability of configuration data.
Smart Images

Figure CN122698601B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, and in particular to a data synchronization method, gateway, product, and system. Background Technology
[0002] In multi-level gateway systems based on hierarchical logical address encoding, each level of gateway and terminal device needs to store various configuration data and maintain consistency. Existing technologies typically employ methods such as platform-initiated push, periodic device polling, or primary / backup gateway synchronization for configuration management. However, if the platform needs to connect directly to each level of gateway, the number of connections will increase linearly with the scale of devices, resulting in significant connection overhead. Furthermore, during batch configuration changes or batch device restarts, a large number of devices simultaneously initiating synchronization or receiving pushes may cause network congestion and concentrated resource contention. Summary of the Invention
[0003] This disclosure provides a data synchronization method, gateway, product, and system.
[0004] According to one aspect of this disclosure, a data synchronization method is provided, applied to a multi-level gateway system including a platform, gateways, and sub-devices. Data synchronization is performed based on a first data synchronization layer between the platform and gateways, a second data synchronization layer between gateways, and a third data synchronization layer between gateways and sub-devices. The method includes: for the first data synchronization layer, an Nth-level gateway initiates a first data synchronization request to the platform based on a first synchronization time interval, obtains a first synchronization result, and performs data synchronization based on the first synchronization result. The first synchronization time interval is determined based on the hash value of a globally unique identifier of the Nth-level gateway. The first data synchronization request includes a version identifier of the local configuration data of the Nth-level gateway, where N represents the total number of gateway levels, the Nth-level gateway corresponds to the root gateway, and N>1; for the second data synchronization layer, the Nth-level gateway performs data synchronization based on a second synchronization time interval... A second data synchronization request is initiated to the n+1 level gateway to obtain a second synchronization result, and data synchronization is performed based on the second synchronization result. The second synchronization time interval is determined based on the hash value of the globally unique identifier of the nth level gateway. The second data synchronization request includes the version identifier of the local configuration data of the nth level gateway, where n>1, and n represents the level of the gateway other than the leaf gateway. For the third data synchronization layer, the first level gateway initiates a data read request to the corresponding sub-device according to the third synchronization time interval to obtain the configuration data of the sub-device, and compares the configuration data of the sub-device with the local configuration data of the first level gateway. If the comparison result is inconsistent, the local configuration data of the first level gateway is returned to the sub-device for data synchronization. The third synchronization time interval is determined based on the hash value of the globally unique identifier of the sub-device, where the first level gateway corresponds to the leaf gateway.
[0005] According to the data synchronization method disclosed herein, by constructing a hierarchical data synchronization mechanism, synchronization communication is restricted to direct upper and lower level platforms, gateways, and sub-devices, reducing the number of gateways that the platform needs to directly connect to and lowering connection overhead. Utilizing a data synchronization strategy based on globally unique identifier hash values, data synchronization requests from large-scale gateways or sub-devices are evenly distributed across the timeline, effectively avoiding network congestion and concentrated resource contention during batch synchronization or restart of gateways or sub-devices, thus achieving efficient, reliable, and low-overhead multi-level gateway data synchronization.
[0006] According to at least one embodiment of the data synchronization method of this disclosure, the number of data synchronization layers corresponds to the number of layers in the topology of the multi-level gateway system, and the data synchronization link and routing path of each data synchronization layer are consistent.
[0007] According to the technical solution of this embodiment, data distribution can be ensured to follow the system's topological hierarchy, avoiding management chaos. The synchronization path is consistent with the routing path, allowing for step-by-step troubleshooting according to existing routing paths in case of data anomalies, reducing the difficulty of fault location; at the same time, existing routing channels are reused, eliminating the need to establish additional independent connections, reducing the number of connections the platform needs to maintain and the consumption of system resources.
[0008] According to at least one embodiment of the data synchronization method of this disclosure, the process of determining the first synchronization time interval, the second synchronization time interval, and the third synchronization time interval includes: when the gateway or the sub-device is first started, performing a hash operation on the globally unique identifier of the gateway or the sub-device to obtain the hash value of the globally unique identifier of the gateway or the sub-device; taking the modulo of the hash value of the globally unique identifier of the gateway or the sub-device with a preset synchronization period, and multiplying the modulo result by a time granularity to obtain the synchronization delay time of the gateway or the sub-device, wherein the synchronization delay time is used to determine the time when the gateway or the sub-device first performs data synchronization; and calculating the corresponding synchronization delay time and the preset time period for the gateway or the sub-device to determine the first synchronization time interval, the second synchronization time interval, or the third synchronization time interval.
[0009] According to the technical solution of this embodiment, by calculating the delay based on the hash of a unique identifier, the first synchronization requests of a large number of gateways or sub-devices are evenly distributed on the time axis, avoiding instantaneous resource contention during batch startup or periodic data synchronization; at the same time, it reduces the risk of network congestion of the platform and gateways, and ensures the stability and reliability of the system under long-term operation.
[0010] The data synchronization method according to at least one embodiment of the present disclosure further includes: the gateway storing two identical local configuration data locally, performing data integrity verification on the two local configuration data, and repairing the local configuration data that fails verification by using the successfully verified local configuration data, wherein the two local configuration data are stored in different regions.
[0011] According to the technical solution of this embodiment, by storing dual backups in different areas and performing verification, the gateway can automatically repair itself using normal copies when the local configuration is damaged, avoiding configuration loss caused by single point storage failure or physical damage in the same area; at the same time, it reduces the need to re-obtain from the next higher-level gateway or manual intervention due to configuration damage, thereby reducing maintenance costs and improving the stability and continuity of system operation.
[0012] According to at least one embodiment of the data synchronization method of this disclosure, the local configuration data of the first-level gateway includes the configuration data of the first-level gateway and the configuration data of the corresponding sub-device, and the local configuration data of the nth-level gateway includes the configuration data of the nth-level gateway and the configuration data of the next-level gateway.
[0013] The data synchronization method according to at least one embodiment of this disclosure further includes: the platform initiating a data update request to the Nth-level gateway, the Nth-level gateway responding to the data update request initiated by the platform and performing data synchronization using the configuration data in the data update request initiated by the platform; the nth-level gateway initiating a data update request to the (n-1)th-level gateway, the (n-1)th-level gateway responding to the data update request initiated by the nth-level gateway and performing data update using the configuration data in the data update request initiated by the nth-level gateway; and / or, the sub-device initiating a data update request to the first-level gateway, obtaining the configuration data issued by the first-level gateway, and performing data synchronization based on the configuration data issued by the first-level gateway.
[0014] According to the technical solution of this embodiment, data updates can be actively pushed by the platform or the upper-level gateway to ensure that changes take effect immediately without waiting for the next data synchronization cycle, thus reducing data update delay. At the same time, it supports sub-devices to actively request data updates, adapting to the synchronization needs in different scenarios. Combined with the periodic synchronization mechanism, it not only ensures the timeliness of emergency changes but also provides a backup guarantee for regular synchronization, thereby improving the overall system response speed.
[0015] According to at least one embodiment of the data synchronization method of this disclosure, when the gateway detects that the data integrity verification of local configuration data fails, it initiates a data acquisition request to the platform or the upper-level gateway to obtain the configuration data and perform data synchronization.
[0016] According to the technical solution of this embodiment, when local configuration data is damaged and cannot be used, the gateway can actively obtain the correct configuration data from the platform or the next-level gateway for recovery, ensuring that the gateway can quickly resume normal operation and improving the stability and continuity of the system in the face of configuration loss or damage scenarios.
[0017] According to at least one embodiment of the data synchronization method of this disclosure, the process of obtaining a first synchronization result or a second synchronization result includes: the platform responding to a first data synchronization request initiated by the Nth-level gateway, comparing the version identifier in the first data synchronization request with the version identifier stored by the platform; if the two match, returning a first synchronization result that does not need to be updated; if the two do not match, using the configuration data stored by the platform as the first synchronization result; the (n+1)th-level gateway responding to a second data synchronization request initiated by the nth-level gateway, comparing the version identifier in the second data synchronization request with the version identifier stored by the (n+1)th-level gateway; if the two match, returning a second synchronization result that does not need to be updated; if the two do not match, using the configuration data stored by the (n+1)th-level gateway as the second synchronization result.
[0018] According to the technical solution of this embodiment, by using a version identifier comparison mechanism, configuration data is only distributed when the configuration is inconsistent, avoiding the bandwidth waste caused by transmitting the full configuration for each synchronization. This reduces the processing load on the platform and gateway, ensuring efficient configuration consistency maintenance under limited network resources, and helps avoid concentrated resource contention during large-scale data synchronization.
[0019] According to another aspect of this disclosure, a gateway is provided, comprising: a memory storing execution instructions; and a processor executing the execution instructions stored in the memory, causing the processor to perform a data synchronization method according to any embodiment of this disclosure.
[0020] According to another aspect of this disclosure, a readable storage medium is provided, wherein executable instructions are stored therein, which, when executed by a processor, are used to implement a data synchronization method according to any embodiment of this disclosure.
[0021] According to another aspect of this disclosure, a computer program product is provided, including a computer program that, when executed by a processor, implements a data synchronization method according to any embodiment of this disclosure.
[0022] According to another aspect of this disclosure, a smart home system is provided, including a platform, a multi-level gateway, and sub-devices, wherein the smart home system performs a data synchronization method according to any embodiment of this disclosure.
[0023] The beneficial effects of the data synchronization method disclosed herein are at least as follows: By constructing a hierarchical data synchronization mechanism, synchronization communication is restricted to direct upper and lower level platforms, gateways, and sub-devices, reducing the number of gateways that the platform needs to directly connect to and lowering connection overhead. Utilizing a data synchronization strategy based on globally unique identifier hash values, data synchronization requests from large-scale gateways or sub-devices are evenly distributed across the timeline, effectively avoiding network congestion and concentrated resource contention during batch synchronization or restart of gateways or sub-devices, thus achieving efficient, reliable, and low-overhead multi-level gateway data synchronization. Attached Figure Description
[0024] The accompanying drawings illustrate exemplary embodiments of the present disclosure and, together with the description thereof, serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0025] Figure 1 This is a schematic structural block diagram of a data synchronization method according to one embodiment of the present disclosure.
[0026] Figure 2 This is a schematic interactive flowchart of the first data synchronization layer in a data synchronization method according to one embodiment of the present disclosure.
[0027] Figure 3 This is a schematic interactive flowchart of the second data synchronization layer in a data synchronization method according to one embodiment of the present disclosure.
[0028] Figure 4 This is a schematic interactive flowchart of the third data synchronization layer in a data synchronization method according to one embodiment of the present disclosure.
[0029] Figure 5 This is a flowchart illustrating the determination of a first synchronization time interval, a second synchronization time interval, and a third synchronization time interval in a data synchronization method according to one embodiment of the present disclosure.
[0030] Figure 6 This is an illustrative interactive flowchart of a data synchronization method according to one embodiment of the present disclosure, in which the platform initiates a data update request.
[0031] Figure 7 This is an illustrative interactive flowchart of a data synchronization method according to one embodiment of the present disclosure, in which the nth-level gateway initiates a data update request.
[0032] Figure 8 This is an illustrative interactive flowchart of a data synchronization method according to one embodiment of the present disclosure, in which a sub-device initiates a data update request to a first-level gateway.
[0033] Figure 9This is a schematic structural block diagram of a gateway according to one embodiment of the present disclosure. Detailed Implementation
[0034] The present disclosure will now be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific examples described herein are for illustrative purposes only and are not intended to limit the scope of the disclosure. Furthermore, it should be noted that, for ease of description, only the parts relevant to the present disclosure are shown in the accompanying drawings.
[0035] It should be noted that, where there is no conflict, the embodiments and features described in this disclosure can be combined with each other. The technical solutions of this disclosure will now be described in detail with reference to the accompanying drawings and embodiments.
[0036] In large-scale smart home communities or industrial IoT deployments, thousands of sub-devices connect to the platform through multi-level cascading gateways. Each level of gateway must maintain strict consistency in device parameters, scene linkage rules, and security credentials to ensure normal business operation. However, in actual operation and maintenance, when faced with batch restarts of sub-devices or gateways or large-scale platform configuration changes, if all sub-devices or external gateways simultaneously initiate data synchronization requests to the platform, it can easily trigger a synchronization storm, leading to network congestion or even platform paralysis. Furthermore, since existing configuration data synchronization channels are often independent of the business command routing channels based on hierarchical logical addresses, when a specific sub-device experiences configuration anomalies, maintenance personnel find it difficult to determine whether the failure is due to a configuration distribution link failure or a business routing link failure, increasing the complexity of troubleshooting.
[0037] To address this, this disclosure proposes a data synchronization method that improves the efficiency and reliability of configuration management by constructing a three-layer synchronization architecture. The platform only needs to establish a connection with the root gateway, avoiding excessive consumption of connection resources caused by direct communication with quantum devices. Each gateway calculates the synchronization time interval based on a globally unique identifier hash value, ensuring that data synchronization requests from gateways and sub-devices are evenly distributed across the timeline. This effectively prevents synchronization storms during batch restarts or configuration updates of gateways or sub-devices, reducing the risk of network congestion. The leaf gateway's proactive comparison and correction mechanism for sub-device configurations ensures real-time consistency of terminal device configurations, thereby achieving efficient, stable, and low-overhead configuration synchronization management in large-scale IoT systems.
[0038] To facilitate description and make the technical solutions of this disclosure easier to understand, the terminology of this disclosure will be explained before describing the technical solutions of this disclosure.
[0039] The root gateway refers to the gateway at the highest level in a multi-level gateway architecture.
[0040] A leaf gateway is a gateway that is at the lowest level in a multi-level gateway architecture and is directly connected to the sub-devices.
[0041] Figure 1 A schematic structural block diagram of a data synchronization method according to one embodiment of this disclosure is shown. Figure 1 The method shown is applied to a multi-level gateway system comprising a platform, gateways, and sub-devices, and performs data synchronization based on a first data synchronization layer between the platform and the gateway, a second data synchronization layer between gateways, and a third data synchronization layer between the gateway and the sub-devices. This method can be executed by electronic devices such as gateways.
[0042] like Figure 2 As shown, for the first data synchronization layer, the Nth-level gateway initiates a first data synchronization request to the platform based on a first synchronization time interval, obtains a first synchronization result, and performs data synchronization based on the first synchronization result. The first synchronization time interval is determined based on the hash value of the globally unique identifier of the Nth-level gateway. The first data synchronization request includes the version identifier of the local configuration data of the Nth-level gateway, where N represents the total number of gateway levels, the Nth-level gateway corresponds to the root gateway, N>1, and belongs to the top layer of the entire multi-level gateway system.
[0043] Preferably, the Nth-level gateway initiates a first data synchronization request to the platform through a timer set based on the first synchronization interval.
[0044] Preferably, the version identifier of the local configuration data of the Nth level gateway can be a version number, a timestamp, or a configuration summary of the local configuration data.
[0045] The configuration summary mentioned above is a fixed-length value (such as an MD5 or SHA value) obtained by hashing the complete configuration data of the gateway. It is a concise representation that can be used to quickly compare configuration consistency.
[0046] Preferably, the globally unique identifier of the Nth-level gateway can be the gateway ID.
[0047] Preferably, in response to the first data synchronization request initiated by the Nth-level gateway, the platform compares the version identifier in the first data synchronization request with the version identifier stored on the platform. If they match, the platform returns a first synchronization result that does not require updating. If they do not match, the platform uses the configuration data stored on the platform as the first synchronization result.
[0048] like Figure 3As shown, for the second data synchronization layer, the nth-level gateway initiates a second data synchronization request to the n+1th-level gateway according to the second synchronization time interval, obtains the second synchronization result, and performs data synchronization based on the second synchronization result. The second synchronization time interval is determined based on the hash value of the globally unique identifier of the nth-level gateway. The second data synchronization request includes the version identifier of the local configuration data of the nth-level gateway, where n>1, and n represents the level of the gateway other than the leaf gateway. It can be the root gateway or an intermediate gateway between the root gateway and the leaf gateway.
[0049] Preferably, the version identifier of the local configuration data of the nth level gateway can be a version number, a timestamp, or a configuration summary of the local configuration data.
[0050] Preferably, the globally unique identifier of the nth-level gateway can be the gateway ID.
[0051] Preferably, in response to the second data synchronization request initiated by the nth-level gateway, the n+1th-level gateway compares the version identifier in the second data synchronization request with the version identifier stored by the n+1th-level gateway. If they match, the gateway returns a second synchronization result that does not require updating; otherwise, the gateway uses the configuration data stored by the n+1th-level gateway as the second synchronization result.
[0052] like Figure 4 As shown, for the third data synchronization layer, the first-level gateway initiates a data read request to the corresponding sub-device according to the third synchronization time interval, obtains the configuration data of the sub-device, and compares the configuration data of the sub-device with the local configuration data of the first-level gateway. If the comparison result is inconsistent, the local configuration data of the first-level gateway is returned to the sub-device for data synchronization. The third synchronization time interval is determined based on the hash value of the globally unique identifier of the sub-device. The first-level gateway corresponds to the leaf gateway.
[0053] Preferably, the globally unique identifier of the sub-device can be the sub-device address.
[0054] Preferably, the local configuration data of the first-level gateway includes the configuration data of the first-level gateway and the configuration data of the corresponding sub-devices, and the local configuration data of the nth-level gateway includes the configuration data of the nth-level gateway and the configuration data of the next-level gateway (i.e., the (n-1)th-level gateway). This achieves hierarchical storage and management of configuration data, enabling the upper-level gateway to directly manage the configuration status of the lower-level nodes, thus improving the timeliness and reliability of configuration synchronization.
[0055] Preferably, when a gateway (including root gateway, intermediate gateways, and leaf gateways) detects corrupted local configuration data (e.g., data integrity verification failure), it initiates a data acquisition request to the platform or the next-level gateway to obtain the configuration data and perform data synchronization. This avoids service interruptions caused by configuration loss. Furthermore, the layered recovery mechanism limits the impact of a fault to a single gateway, preventing local faults from spreading to the entire system and effectively ensuring the stable operation of large-scale IoT systems.
[0056] Preferably, when the topology of a multi-level gateway system changes, resulting in changes to the number of gateway levels or the number of levels, a configuration data synchronization can be triggered to ensure that the gateway is correctly configured at the new level.
[0057] Preferably, the number of data synchronization layers corresponds to the number of layers in the topology of the multi-level gateway system, and the data synchronization link and routing path of each data synchronization layer are consistent.
[0058] For example, when the network topology of a multi-level gateway system includes four levels: platform, main gateway (i.e., root gateway), intermediate gateways, leaf gateways, and sub-devices, configuration synchronization is also divided into four data synchronization levels: between the platform and the main gateway, between the main gateway and the intermediate gateways, between the intermediate gateways and the leaf gateways, and between the leaf gateways and the sub-devices. The communication path of each data synchronization layer strictly follows the routing path of the business data; that is, the transmission path of configuration data from the platform to the sub-devices is exactly the same as the transmission path of business commands.
[0059] Therefore, by constructing a three-tier data synchronization architecture, efficient and reliable configuration management is achieved. The platform only needs to establish a connection with the root gateway, avoiding excessive consumption of connection resources caused by direct communication with a massive number of terminal devices. Each gateway calculates the synchronization time interval based on a globally unique identifier hash value, ensuring that data synchronization requests from a large number of sub-devices are evenly distributed across the timeline, reducing the risk of network congestion.
[0060] In one specific embodiment, the gateway stores two identical copies of local configuration data locally. By performing data integrity verification on these two copies, the successfully verified local configuration data repairs the locally configuration data that failed the verification. The two copies of local configuration data are stored in different regions. Preferably, when both copies of local configuration data are corrupted, the gateway proactively obtains new configuration data from the next higher-level node.
[0061] Therefore, it avoids configuration loss caused by single-point storage failure, enabling the gateway to quickly recover its configuration without relying on upstream nodes, thus reducing service interruption time. At the same time, the dual-backup storage strategy effectively prevents the risk of double data loss due to physical damage in the same area.
[0062] In one specific embodiment, the process of determining the first synchronization time interval, the second synchronization time interval, and the third synchronization time interval may include, in some embodiments of this disclosure, the following: Figure 5 Steps S110 to S130 are shown.
[0063] In step S110, when the gateway or sub-device is started for the first time, a hash operation is performed on the globally unique identifier of the gateway or sub-device to obtain the hash value of the globally unique identifier of the gateway or sub-device.
[0064] In step S120, the hash value of the globally unique identifier of the gateway or sub-device is moduloed by the preset synchronization period, and the modulo result is multiplied by the time granularity to obtain the synchronization delay time of the gateway or sub-device. The synchronization delay time is used to determine the time when the gateway or sub-device first performs data synchronization.
[0065] In step S130, for the gateway or sub-device, the corresponding synchronization delay time and preset time period are calculated to determine the first synchronization time interval, the second synchronization time interval, or the third synchronization time interval.
[0066] Optionally, the first synchronization time interval, the second synchronization time interval, or the third synchronization time interval can be determined by adding or subtracting the synchronization delay time of the gateway or sub-device from a preset time period.
[0067] The preset synchronization period and preset time period are set according to the specific application scenario.
[0068] Preferably, the formula for calculating the synchronization delay time is as follows: delay = (hash(device_id) % max_interval) granularity; Where delay represents the synchronization delay time, device_id represents the globally unique identifier of the gateway or device, max_interval represents the preset maximum time period, granularity represents the time granularity (e.g., 1 second), hash() represents the hash function, and % represents the modulo operation.
[0069] Therefore, gateways or sub-devices use their globally unique identifiers to calculate different initial synchronization delay times, ensuring that synchronization requests are naturally and evenly distributed across the timeline, avoiding the instantaneous resource contention caused by traditional fixed-interval synchronization. Simultaneously, after completing one synchronization, each gateway or sub-device can independently calculate the next synchronization time, ensuring that synchronization requests remain dispersed over long-term operation and preventing requests from gradually overlapping due to clock drift. Without central scheduling, each gateway or sub-device autonomously decides its synchronization timing, reducing the instantaneous load on the platform and gateways, and improving the stability and reliability of the system in large-scale deployment scenarios.
[0070] In one specific embodiment, such as Figure 6 As shown, the platform initiates a data update request to the Nth-level gateway. The Nth-level gateway responds to the data update request initiated by the platform and performs data synchronization using the configuration data in the data update request initiated by the platform.
[0071] In one specific embodiment, such as Figure 7 As shown, the nth-level gateway initiates a data update request to the (n-1)th-level gateway. The (n-1)th-level gateway responds to the data update request initiated by the nth-level gateway and updates the data using the configuration data in the data update request initiated by the nth-level gateway.
[0072] In one specific embodiment, such as Figure 8 As shown, the sub-device initiates a data update request to the first-level gateway, obtains the configuration data issued by the first-level gateway, and performs data synchronization based on the configuration data issued by the first-level gateway.
[0073] Therefore, when the platform needs to urgently update its configuration, it can immediately push the new configuration to the root gateway without waiting for the regular synchronization cycle, significantly shortening the effective delay of critical configurations (such as security credentials and emergency rules). At the same time, lower-level gateways and sub-devices can proactively request configuration updates from the upper level as needed, ensuring the immediate effect of emergency changes and serving as a supplementary backup mechanism to regular synchronization, effectively avoiding instantaneous resource contention during batch configuration changes.
[0074] In one specific embodiment, in addition to periodically reporting data according to a timer for data synchronization, a combination of immediate push notifications from the platform, gateway, or sub-device when configuration changes occur and periodic verification can be used. The change notifications ensure timeliness, while the periodic verifications serve as a fallback.
[0075] In one specific embodiment, the gateway's local configuration data is stored with three backups, and the correct configuration data is determined using a majority voting mechanism. This method is suitable for scenarios with higher reliability requirements.
[0076] For example, the gateway stores identical copies of configuration data in three different physical storage areas or file systems locally. Each time the configuration is read, all three copies are read simultaneously and a CRC check (i.e., data integrity check) is performed. If all three copies pass the check and their contents are consistent, the system can be used normally. If two copies pass the check and their contents are consistent, but the other copy is corrupted, the corrupt copy is automatically repaired using the contents of the two consistent copies. If only one copy passes the check and the other two copies are corrupted, the two corrupt copies are repaired using the normal copies. If all three copies fail the check, a recovery process is triggered to actively retrieve the configuration from the upper-level node. After retrieval, three complete and consistent configuration copies are rewritten. By using the majority rule, the correct configuration can be accurately identified and recovered even in the event of a single or multiple storage failure, significantly improving the availability of configuration data and the system's self-healing capability in scenarios with extremely high reliability requirements.
[0077] In one specific embodiment, data synchronization is performed incrementally, that is, only the configuration data that has been changed is transmitted, thereby reducing the amount of data to be synchronized.
[0078] In one specific embodiment, in an emergency, a direct communication channel can be established between the platform and gateways at all levels for configuration distribution, serving as a backup path.
[0079] This disclosure also provides a gateway. This gateway is suitable for smart access control devices, smart home devices, or any other suitable electronic device. Figure 9 A schematic diagram of the hardware implementation using the processing system is shown.
[0080] The hardware architecture of the gateway disclosed herein can be implemented using a bus architecture. The bus architecture can include any number of interconnect buses and bridges, depending on the specific application and overall design constraints of the hardware. Bus 1100 connects various circuits including one or more processors 1200, memory 1300, and / or hardware modules. Bus 1100 can also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc. Bus 1100 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, only one connection line is used in this figure, but this does not indicate that there is only one bus or one type of bus.
[0081] This disclosure also provides a readable storage medium storing a computer program that, when executed by a processor, is used to implement the methods described above. A "readable storage medium" can be any means capable of containing, storing, communicating, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples of a readable storage medium include: an electrical connection with one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable read-only memory (CDROM), etc.
[0082] This disclosure also provides a computer program product, the methods of which can be implemented wholly or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented wholly or partially as a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instructions are loaded and executed, all or part of the processes or functions of this disclosure are performed.
[0083] Computer programs or instructions can be stored in a readable storage medium or transferred from one readable storage medium to another. For example, the computer program or instructions can be transferred from one website, computer, server, or data center to another website, computer, server, or data center via wired or wireless means. The readable storage medium can be any available medium capable of access, or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium, such as a floppy disk, hard disk, or magnetic tape; an optical medium, such as a digital video optical disc; or a semiconductor medium, such as a solid-state drive. The computer-readable storage medium can be a volatile or non-volatile storage medium, or it can include both volatile and non-volatile types of storage media.
[0084] Those skilled in the art will understand that embodiments of this disclosure can be provided as methods, systems, or computer program products. Therefore, this disclosure can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this disclosure can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0085] This disclosure is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to this disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0086] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0087] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0088] According to an embodiment of this application, a smart home system is also provided, including a platform, a multi-level gateway, and sub-devices, wherein the smart home devices execute the data synchronization method of any embodiment of this disclosure.
[0089] In the description of this specification, the references to terms such as "one embodiment / mode," "some embodiments / modes," "example," "specific example," or "some examples," etc., refer to specific features, structures, or characteristics described in connection with that embodiment / mode or example, which are included in at least one embodiment / mode or example of this disclosure. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment / mode or example. Moreover, the specific features, structures, or characteristics described may be combined in any suitable manner in one or more embodiments / modes or examples. Furthermore, without contradiction, those skilled in the art can combine and integrate the different embodiments / modes or examples described in this specification, as well as the features of different embodiments / modes or examples.
[0090] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this disclosure, "a plurality of" means at least two, such as two, three, etc., unless otherwise explicitly specified.
[0091] Those skilled in the art should understand that the above embodiments are merely for illustrating the present disclosure and are not intended to limit the scope of the disclosure. Those skilled in the art can make other changes or modifications based on the above disclosure, and these changes or modifications still fall within the scope of the present disclosure.
Claims
1. A data synchronization method, characterized in that, A method applicable to a multi-level gateway system comprising a platform, gateways, and sub-devices, performs data synchronization based on a first data synchronization layer between the platform and the gateway, a second data synchronization layer between gateways, and a third data synchronization layer between the gateway and the sub-devices. The number of data synchronization layers corresponds to the number of layers in the topology of the multi-level gateway system, and the data synchronization link and routing path of each data synchronization layer are consistent. The method includes: For the first data synchronization layer, the Nth level gateway initiates a first data synchronization request to the platform based on a first synchronization time interval, obtains a first synchronization result, and performs data synchronization based on the first synchronization result. The first synchronization time interval is determined based on the hash value of the globally unique identifier of the Nth level gateway. The first data synchronization request includes the version identifier of the local configuration data of the Nth level gateway, where N represents the total number of gateway levels, the Nth level gateway corresponds to the root gateway, and N>1. For the second data synchronization layer, the nth-level gateway initiates a second data synchronization request to the (n+1)th-level gateway according to the second synchronization time interval, obtains the second synchronization result, and performs data synchronization based on the second synchronization result. The second synchronization time interval is determined based on the hash value of the globally unique identifier of the nth-level gateway. The second data synchronization request includes the version identifier of the local configuration data of the nth-level gateway, where N>n>1, n represents the level of the gateways other than the leaf gateways, the local configuration data of the nth-level gateway includes the configuration data of the nth-level gateway and the configuration data of the (n-1)th-level gateway, and the version identifier of the local configuration data of the nth-level gateway or the Nth-level gateway is one of the version number, timestamp, or configuration digest of the local configuration data; and For the third data synchronization layer, the first-level gateway initiates a data read request to the corresponding sub-device according to the third synchronization time interval to obtain the configuration data of the sub-device, and compares the configuration data of the sub-device with the local configuration data of the first-level gateway. If the comparison result is inconsistent, the local configuration data of the first-level gateway is returned to the sub-device for data synchronization. The third synchronization time interval is determined based on the hash value of the globally unique identifier of the sub-device. The first-level gateway corresponds to the leaf gateway. The local configuration data of the first-level gateway includes the configuration data of the first-level gateway and the configuration data of the corresponding sub-device. After completing one synchronization, the gateway or sub-device independently calculates the next synchronization time. The process of determining the first synchronization time interval, the second synchronization time interval, and the third synchronization time interval includes: When the gateway or the sub-device is started for the first time, a hash operation is performed on the globally unique identifier of the gateway or the sub-device to obtain the hash value of the globally unique identifier of the gateway or the sub-device; The hash value of the globally unique identifier of the gateway or the sub-device is moduloed by the preset synchronization period, and the modulo result is multiplied by the time granularity to obtain the synchronization delay time of the gateway or the sub-device. The synchronization delay time is used to determine the time when the gateway or the sub-device first performs data synchronization. For the gateway or the sub-device, the corresponding synchronization delay time and preset time period are calculated to determine the first synchronization time interval, the second synchronization time interval, or the third synchronization time interval.
2. The data synchronization method as described in claim 1, characterized in that, Also includes: The gateway stores two identical local configuration data locally. By performing data integrity verification on these two local configuration data, the local configuration data that successfully passes the verification repairs the local configuration data that fails the verification. The two local configuration data are stored in different regions.
3. The data synchronization method as described in claim 1, characterized in that, Also includes: The platform initiates a data update request to the Nth-level gateway, and the Nth-level gateway responds to the data update request initiated by the platform and performs data synchronization using the configuration data in the data update request initiated by the platform; the (n+1)th-level gateway initiates a data update request to the nth-level gateway, and the nth-level gateway responds to the data update request initiated by the (n+1)th-level gateway and performs data update using the configuration data in the data update request initiated by the (n+1)th-level gateway; and / or, the sub-device initiates a data update request to the 1st-level gateway, obtains the configuration data issued by the 1st-level gateway, and performs data synchronization based on the configuration data issued by the 1st-level gateway.
4. The data synchronization method as described in claim 1, characterized in that, When the gateway detects that the data integrity verification of the local configuration data has failed, it sends a data acquisition request to the platform or the next-level gateway to obtain the configuration data and perform data synchronization.
5. The data synchronization method as described in claim 1, characterized in that, The process of obtaining the first synchronization result or the second synchronization result includes: The platform responds to the first data synchronization request initiated by the Nth level gateway, compares the version identifier in the first data synchronization request with the version identifier stored in the platform. If they match, the platform returns the first synchronization result that does not need to be updated. If they do not match, the platform uses the configuration data stored in the platform as the first synchronization result. In response to the second data synchronization request initiated by the nth-level gateway, the n+1th-level gateway compares the version identifier in the second data synchronization request with the version identifier stored in the n+1th-level gateway. If they match, it returns the second synchronization result that does not require updating; otherwise, it uses the configuration data stored in the n+1th-level gateway as the second synchronization result.
6. A gateway, characterized in that, include: The memory stores execution instructions; as well as A processor that executes execution instructions stored in the memory, causing the processor to perform the data synchronization method according to any one of claims 1 to 5.
7. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the data synchronization method according to any one of claims 1 to 5.
8. A smart home system, comprising a platform, multi-level gateways, and sub-devices, characterized in that, The smart home system performs the data synchronization method according to any one of claims 1 to 5.
Citation Information
Patent Citations
Method for transmitting and receiving idle-mode parameter update information, and apparatus therefor
CN103299560A
Method, device and system for acquiring information of equipment under gateway
CN121842020A
