View equipment information synchronization method and device based on version number tree, equipment, medium and program product

By adopting a version number tree-based synchronization method, a two-level version number tree structure is used for fast comparison and fine-grained device-level comparison, which solves the problem of low synchronization efficiency of view devices. This enables fast, accurate and efficient synchronization of massive device information in a distributed system, reduces network bandwidth consumption and computational overhead, and improves synchronization reliability.

CN121597250APending Publication Date: 2026-03-03CHINA TELECOM CLOUD TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511779888.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-28
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing view device synchronization methods have low synchronization efficiency, making it difficult to achieve fast, accurate, and efficient synchronization in scenarios with a large number of devices.

Method used

A synchronization method based on version number tree is adopted. By constructing a two-level version number tree structure, a fast comparison is performed at the first-level version number tree level to identify differences in the root node. Then, a refined device-level comparison is performed at the second-level version number tree level, synchronizing only the differentiated device identifier, changed sub-information, and sub-information version number.

Benefits of technology

It minimizes data transmission volume, reduces network bandwidth consumption and computational overhead, improves the reliability and efficiency of synchronization operations, avoids the risk of omissions caused by clock asynchrony or hash collisions in traditional methods, and ensures the fast, accurate and efficient synchronization of massive device information in the distributed system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597250A_ABST
    Figure CN121597250A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software development, in particular to a view equipment information synchronization method and device based on a version number tree, equipment, a medium and a program product. The method comprises the following steps: in response to a newly added to-be-synchronized service, the to-be-synchronized service sends a first-level version number tree of locally maintained equipment information to a source service; the first-level version number trees are compared, and if the root nodes are different, identification information of the second-level version number trees with differences is returned to the to-be-synchronized service; obtaining a second-level version number tree corresponding to the identification information and returned by the to-be-synchronized service; and comparing the local second-level version number tree of the source service with the second-level version number tree returned by the to-be-synchronized service, identifying the changed target equipment, and synchronizing the identifier of the target equipment, the changed sub-information and the sub-information version number to the to-be-synchronized service. By adopting the method, the equipment information can be quickly, accurately and efficiently synchronized among different services in a massive equipment access scene.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of software development technology, and in particular to a method, apparatus, device, medium, and program product for synchronizing view device information based on a version number tree. Background Technology

[0002] A video library platform is an integrated video data management and application system. Its core function is to provide unified access, storage, analysis, and service output for multi-source heterogeneous video devices. With the rapid development of security monitoring, intelligent transportation, and smart cities, the deployment scale of video surveillance equipment is constantly expanding, and the types of equipment are becoming increasingly complex, including network cameras, intelligent capture cameras, edge computing nodes, and vehicle-mounted mobile devices. These devices are often widely distributed, use diverse protocols, and have inconsistent data formats, making it difficult for traditional decentralized video management systems to achieve efficient device collaboration and data integration. The video library platform was developed to address this need. By building a standardized access framework and data processing pipeline, it integrates various video resources into a unified service capability, providing users with comprehensive services such as video streaming forwarding, intelligent analysis, metadata retrieval, and device status management. The video library platform solves the challenge of heterogeneous access from multiple devices by reducing system integration and maintenance costs through protocol conversion and data standardization. Secondly, the platform supports efficient storage and intelligent analysis of massive amounts of video data, enabling structured extraction of video content and event detection, providing data support for upper-layer business systems. Furthermore, the video library platform features elastic resource scheduling and high availability, dynamically allocating computing and storage resources based on business load to ensure stable system operation. In scenarios such as public safety, traffic management, park security, and industrial inspection, the video library platform has become a critical information infrastructure, significantly improving the utilization value and response efficiency of video data.

[0003] In related technologies, device synchronization is fundamental to enabling multi-device collaborative work during the construction of a view library platform. Device synchronization primarily refers to ensuring consistency in status information, configuration parameters, time bases, and data streams among various video devices within a distributed environment. This prevents video loss, analysis errors, or control failures caused by information asynchrony between devices. Current device synchronization typically employs full synchronization or incremental synchronization based on data change times.

[0004] However, current view device synchronization methods have the following technical problems:

[0005] Existing view device synchronization methods have low synchronization efficiency and need to be optimized. Summary of the Invention

[0006] Therefore, it is necessary to provide a method, apparatus, computer device, computer-readable storage medium, and computer program product for synchronizing device information based on a version number tree view, which can achieve fast, accurate, and efficient synchronization of device information between different services in scenarios with massive device access.

[0007] Firstly, this application provides a method for synchronizing view device information based on a version number tree. The method includes:

[0008] In response to a new service to be synchronized, the service to be synchronized sends the first-level version number tree of the device information maintained locally to the source service. The leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device.

[0009] Compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, return the identification information of the second-level version number tree that is different to the service to be synchronized.

[0010] Obtain the secondary version number tree returned by the service to be synchronized, which corresponds to the identification information;

[0011] By comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, the target device that has changed is identified, and the identifier of the target device, the changed sub-information, and the sub-information version number are synchronized to the service to be synchronized.

[0012] In one embodiment, comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized includes:

[0013] Compare the device total information version numbers of the leaf nodes in the two second-level version number trees;

[0014] For devices with different overall device information version numbers, the sub-information version numbers are compared to determine the target sub-information category that has changed.

[0015] In one embodiment, after comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized, the method further includes:

[0016] The synchronization service updates the associated device sub-information and sub-information version number based on the identification information;

[0017] The total information version number of the target device is recalculated based on the difference in the sub-information version number;

[0018] The version numbers of the local second-level version number tree and the associated nodes in the first-level version number tree are updated level by level from the bottom to the top.

[0019] In one embodiment, the method further includes:

[0020] In response to the presence of a new device, the source service identifies the target leaf node of the first-level version number tree that is unique to the source service during the comparison of the first-level version number tree;

[0021] The newly added second-level version number tree corresponding to the target leaf node and the associated device information are sent to the synchronization service, so that the synchronization service can create the newly added second-level version number tree locally and update the first-level version number tree.

[0022] In one embodiment, the method further includes:

[0023] In response to the existence of a deleted device, the leaf node of the deleted device is marked as soft deletion, and the total information version number of the deleted device is incremented;

[0024] During device synchronization, the status changes of the deleted devices are identified step by step, and the deleted devices that were soft-deleted are cleaned up after a preset retention window.

[0025] In one embodiment, the method further includes:

[0026] In response to the addition of a new device node to the existing secondary version number tree, identify any discrepancies in the secondary version number tree;

[0027] By comparing and identifying newly added device nodes that do not exist in the service to be synchronized, the device information and version number of the newly added device nodes are sent to the service to be synchronized, and the device nodes and tree structure in the secondary version number tree are updated.

[0028] Secondly, this application also provides a view device information synchronization device based on a version number tree. The device includes:

[0029] The local query module is used to respond to newly added services to be synchronized. The services to be synchronized send the first-level version number tree of the device information maintained locally to the source service. The leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device.

[0030] The first comparison module is used to compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, the module returns the identification information of the second-level version number tree that is different to the service to be synchronized.

[0031] The secondary version number tree module is used to obtain the secondary version number tree corresponding to the identification information returned by the service to be synchronized;

[0032] The second comparison module is used to compare the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identify the target device that has changed, and synchronize the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized.

[0033] In one embodiment, the second comparison module includes:

[0034] The leaf node comparison module is used to compare the device total information version number of the leaf nodes in the two secondary version number trees;

[0035] The version number comparison module is used to compare the sub-information version numbers of devices whose total device information version numbers differ, and to determine the target sub-information category that has changed.

[0036] In one embodiment, after the second comparison module, the following is further included:

[0037] The first update module is used for the service to be synchronized to update the associated device sub-information and sub-information version number based on the identification information;

[0038] The overall information version module is used to recalculate the overall information version number of the target device based on the difference in the sub-information version number;

[0039] The second update module is used to update the version numbers of the local second-level version number tree and the associated nodes in the first-level version number tree level by level from the bottom to the top.

[0040] In one embodiment, the device further includes:

[0041] The new device module is used to respond to the existence of a new device, wherein the source service identifies the target leaf node of the first-level version number tree that is unique to the source service in the comparison of the first-level version number tree;

[0042] The version number tree creation module is used to send the newly added second-level version number tree corresponding to the target leaf node and the associated device information to the service to be synchronized, so that the service to be synchronized can create the newly added second-level version number tree locally and update the first-level version number tree.

[0043] In one embodiment, the device further includes:

[0044] The soft deletion module is used to mark the leaf node of the deleted device as soft deletion in response to the existence of a deleted device, and increment the total information version number of the deleted device;

[0045] The physical cleanup module is used to identify the status changes of the deleted devices step by step during the device synchronization process, and clean up the deleted devices that were soft-deleted after a preset retention window.

[0046] In one embodiment, the device further includes:

[0047] A new device node module is added to identify the differences in the second-level version number tree in response to the addition of a new device node to the existing second-level version number tree.

[0048] The tree structure update module is used to identify the newly added device node that does not exist in the service to be synchronized by comparison, send the device information and version number of the newly added device node to the service to be synchronized, and update the device node and tree structure in the secondary version number tree.

[0049] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of a view device information synchronization method based on a version number tree as described in any embodiment of the first aspect.

[0050] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of a view device information synchronization method based on a version number tree as described in any embodiment of the first aspect.

[0051] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of a view device information synchronization method based on a version number tree as described in any embodiment of the first aspect.

[0052] The above-described method, apparatus, computer device, storage medium, and computer program product for synchronizing view device information based on a version number tree, derived through the technical features in the embodiments, can achieve the following beneficial effects to address the technical problems in the background art:

[0053] This application provides a view device information synchronization method based on a version number tree, comprising: responding to a new service to be synchronized, the service to be synchronized sends a first-level version number tree of device information maintained locally to a source service, wherein the leaf nodes of the first-level version number tree are the root nodes of a second-level version number tree, and the leaf nodes of the second-level version number tree are view device information of the view device; comparing the first-level version number tree locally maintained by the source service with the first-level version number tree of the service to be synchronized, and if the root nodes are different, returning the identification information of the differing second-level version number tree to the service to be synchronized; obtaining the second-level version number tree returned by the service to be synchronized corresponding to the identification information; comparing the second-level version number tree locally maintained by the source service with the second-level version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the version number of the sub-information to the service to be synchronized. In implementation, by constructing a two-level version number tree structure, a fast comparison is first performed at the first-level version number tree level, and the differing second-level version number tree is only located when the root nodes are different, effectively avoiding the resource waste caused by full comparison. Subsequently, a refined device-level comparison is performed at the second-level version number tree level to accurately identify the target device that has changed and its specific changed sub-information. Finally, only the differentiated device identifier, the changed sub-information, and the corresponding sub-information version number are synchronized to the service to be synchronized. This minimizes the amount of data transmitted during the synchronization process, significantly reducing network bandwidth consumption and computational overhead. Simultaneously, the version number-based comparison mechanism completely avoids the omission risks caused by clock asynchrony or rollback in traditional timestamp-based synchronization methods, and helps avoid potential hash collisions in hash tree methods. This improves the reliability of the synchronization operation and provides a reliable technical guarantee for achieving fast, accurate, and efficient synchronization of massive view device information in distributed systems. Attached Figure Description

[0054] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0055] Figure 1 This is an application environment diagram of a view device information synchronization method based on a version number tree in one embodiment;

[0056] Figure 2 This is a schematic diagram of the first process of a view device information synchronization method based on a version number tree in one embodiment;

[0057] Figure 3 This is a schematic diagram illustrating the process of synchronizing device information between different services in one embodiment;

[0058] Figure 4 This is a schematic diagram of the structure of the first-level version number tree in one embodiment;

[0059] Figure 5 This is a schematic diagram of the structure of a two-level version number tree in one embodiment;

[0060] Figure 6 This is a schematic diagram of the second process of a view device information synchronization method based on a version number tree in another embodiment;

[0061] Figure 7 This is a schematic diagram of the third process of a view device information synchronization method based on a version number tree in another embodiment;

[0062] Figure 8 This is a schematic diagram of the fourth process of a view device information synchronization method based on a version number tree in another embodiment;

[0063] Figure 9 This is a fifth flowchart illustrating a view device information synchronization method based on a version number tree in another embodiment;

[0064] Figure 10 This is a sixth flowchart of a view device information synchronization method based on a version number tree in another embodiment;

[0065] Figure 11 This is a structural block diagram of a view device information synchronization device based on a version number tree in one embodiment;

[0066] Figure 12 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation

[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0068] This application provides a view device information synchronization method based on a version number tree, which can be applied to, for example... Figure 1 The application environment shown.

[0069] In one embodiment, such as Figure 2 and Figure 3 As shown, a view device information synchronization method based on a version number tree is provided, which can be applied to... Figure 1 Taking the system in the example, the following steps are included:

[0070] Step 202: In response to the addition of a new service to be synchronized, the service to be synchronized sends the first-level version number tree of the device information maintained locally to the source service.

[0071] Among them, it can be like Figure 3 and Figure 4 As shown, the leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device.

[0072] Step 204: Compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, return the identification information of the second-level version number tree that is different to the service to be synchronized.

[0073] Step 206: Obtain the secondary version number tree corresponding to the identification information returned by the service to be synchronized.

[0074] Step 208: Compare the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identify the target device that has changed, and synchronize the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized.

[0075] In the above-described method for synchronizing view device information based on a version number tree, by reasonably deducing the technical features in the embodiments, a beneficial effect is achieved that can solve the technical problems raised in the background art:

[0076] This application provides a view device information synchronization method based on a version number tree, comprising: responding to a new service to be synchronized, the service to be synchronized sends a first-level version number tree of device information maintained locally to a source service, wherein the leaf nodes of the first-level version number tree are the root nodes of a second-level version number tree, and the leaf nodes of the second-level version number tree are view device information of the view device; comparing the first-level version number tree locally maintained by the source service with the first-level version number tree of the service to be synchronized, and if the root nodes are different, returning the identification information of the differing second-level version number tree to the service to be synchronized; obtaining the second-level version number tree returned by the service to be synchronized corresponding to the identification information; comparing the second-level version number tree locally maintained by the source service with the second-level version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the version number of the sub-information to the service to be synchronized. In implementation, by constructing a two-level version number tree structure, a fast comparison is first performed at the first-level version number tree level, and the differing second-level version number tree is only located when the root nodes are different, effectively avoiding the resource waste caused by full comparison. Subsequently, a refined device-level comparison is performed at the second-level version number tree level to accurately identify the target device that has changed and its specific changed sub-information. Finally, only the differentiated device identifier, the changed sub-information, and the corresponding sub-information version number are synchronized to the service to be synchronized. This minimizes the amount of data transmitted during the synchronization process, significantly reducing network bandwidth consumption and computational overhead. Simultaneously, the version number-based comparison mechanism completely avoids the omission risks caused by clock asynchrony or rollback in traditional timestamp-based synchronization methods, and helps avoid potential hash collisions in hash tree methods. This improves the reliability of the synchronization operation and provides a reliable technical guarantee for achieving fast, accurate, and efficient synchronization of massive view device information in distributed systems.

[0077] On the other hand, the view device information synchronization method based on version number tree provided in this application has the advantages of low computational load and high speed when initially constructing, updating, adding, and deleting view devices. Specifically, the initial construction, updating, adding, and deleting of view devices involve the construction, updating, insertion, and deletion of the version number tree. When adjusting the version number tree nodes, the solution in this application only requires simple integer addition operations. The amount of data to be read and the amount of computation required are far less than the existing methods that use hash algorithms such as SHA-2 and MD5 to perform hash calculations on the data content to construct a hash tree, thereby improving computational efficiency and reducing computational load.

[0078] For example, the version number tree-based view device information synchronization method proposed in this application allows the version number of each node in the version number tree to be stored using only an 8-byte integer variable. The version number tree occupies very little space, and the amount of data transmitted between services is also very small, resulting in low network bandwidth consumption and high speed. In contrast, hash trees constructed using hash algorithms such as SHA-2 and MD5 have hash values ​​of tens of bytes per node. When a large number of devices are connected, the constructed hash tree becomes very large, and the amount of data transmitted between different services is also very large, representing a significant waste of network bandwidth and CPU processing power.

[0079] Furthermore, compared to the synchronization method based on hash trees, which is prone to hash collisions regardless of the hash algorithm used to calculate the hash value, the solution in this application can improve the reliability of data synchronization.

[0080] Thirdly, compared with data synchronization based on hash trees, the proposed solution offers advantages in terms of speed and CPU resource saving when searching for inconsistent device information. Specifically, the proposed solution only requires a simple integer comparison when searching and comparing version number trees, while hash tree-based searches and comparisons require comparing tens of bytes of hash value data.

[0081] In one embodiment, it can be as follows Figure 6 As shown, step 208 includes:

[0082] Step 602: Compare the device total information version numbers of the leaf nodes in the two secondary version number trees.

[0083] Step 604: For devices with different overall device information version numbers, compare the sub-information version numbers to determine the target sub-information category that has changed.

[0084] In this embodiment, potential devices that have changed are quickly screened by first comparing the version number of the overall device information, and then the specific information categories that have changed are accurately identified by comparing the version numbers of the sub-information. This ensures that only the sub-information content that has actually changed is synchronized, which greatly reduces unnecessary data transmission and improves the efficiency and accuracy of the synchronization process.

[0085] In one embodiment, it can be as follows Figure 7 As shown, after step 208, the method further includes:

[0086] Step 702: The service to be synchronized updates the associated device sub-information and sub-information version number based on the identification information.

[0087] Step 704: Recalculate the total information version number of the target device based on the difference in the sub-information version number.

[0088] Step 706: Update the version numbers of the local second-level version number tree and the associated nodes in the first-level version number tree level by level from the bottom to the top.

[0089] In this embodiment, by accurately updating the changed sub-information and version number, recalculating the total information version number based on the difference, and then updating the version number tree nodes from bottom to top, the real-time synchronization of the tree structure data with the actual status of the device is ensured, laying an accurate data foundation for subsequent efficient incremental comparison and maintaining the continuous reliability of the entire synchronization mechanism.

[0090] In one embodiment, it can be as follows Figure 8 As shown, the method further includes:

[0091] Step 802: In response to the presence of a new device, the source service identifies the target leaf node of the first-level version number tree that is unique to the source service during the comparison of the first-level version number tree.

[0092] Step 804: Send the newly added second-level version number tree corresponding to the target leaf node and the associated device information to the service to be synchronized, so that the service to be synchronized can create the newly added second-level version number tree locally and update the first-level version number tree.

[0093] In this embodiment, by accurately identifying newly added leaf nodes at the first-level tree level and synchronizing the corresponding complete second-level version number tree and related device information to the service to be synchronized at once, the accurate introduction of new device information and the complete update of the local version number tree structure are ensured. This effectively avoids the inefficiency of synchronizing device information one by one and ensures the integrity and consistency of the system data structure.

[0094] In one embodiment, it can be as follows Figure 9 As shown, the method further includes:

[0095] Step 902: In response to the existence of a deleted device, mark the leaf node of the deleted device as soft deletion and increment the total information version number of the deleted device.

[0096] Step 904: During the device synchronization process, the status changes of the deleted devices are identified step by step, and the deleted devices that were soft-deleted are cleaned up after the preset retention window.

[0097] In this embodiment, marking soft deletions and incrementing the version number ensures that deletion operations can be accurately identified and propagated by the synchronization process, preventing data loss. The retention window setting avoids frequent physical adjustments to the tree structure, reducing instantaneous performance overhead, while delayed physical cleanup ensures reliable synchronization of deletion states in a distributed environment, guaranteeing eventual consistency.

[0098] In one embodiment, it can be as follows Figure 10 As shown, the method further includes:

[0099] Step 1002: In response to the addition of a new device node to the existing secondary version number tree, identify any discrepancies in the secondary version number tree.

[0100] Step 1004: By comparing and identifying the newly added device node that does not exist in the service to be synchronized, send the device information and version number of the newly added device node to the service to be synchronized, and update the device node and tree structure in the secondary version number tree.

[0101] In this embodiment, newly added device nodes are quickly located through difference comparison, and complete device information and version numbers are synchronized to the service to be synchronized, ensuring the accurate import of device data. At the same time, the local secondary version number tree structure is updated to maintain the consistency between the version number tree and the actual state of the device, providing a reliable foundation for subsequent accurate synchronization and effectively improving the synchronization efficiency in device expansion scenarios.

[0102] In one specific embodiment, the devices in the version number tree include a device ID, a total information version number, and sub-information version numbers for information subcategories. Each sub-information version number corresponds to a sub-category of information for the device, and the sub-information version number is updated when the sub-category information is updated. When any sub-category information is updated, the total information version number is updated accordingly. According to this rule, if the total information version number changes, it can be deduced that at least one device sub-category information has definitely changed; if the total information version number does not change, it can be deduced that all sub-category information for the device has not changed.

[0103] Preferably, the data type of the overall device information version number and the sub-information version number can be integer, and the initial value can be set to 0. Each time there is a change in the device sub-information, the corresponding sub-information version number is increased by 1. When any sub-information changes, the overall device information version number is increased by 1 each time.

[0104] Specifically, such as Figure 5As shown, the construction method of the two-level version number tree, also known as the tenant version number tree, is as follows: access devices are grouped according to the tenant dimension, and a version number tree is constructed for all devices under each tenant. When constructing the tenant version number tree, the total version number of the device information is used as the leaf node, and each leaf node corresponds to one device. The parent node (intermediate node) is constructed by the sum of the version numbers of two adjacent device leaf nodes. This process is repeated recursively until the entire tenant version number tree is constructed. Finally, the value of the root node of the tenant version number tree is the sum of the version numbers of its left and right child nodes.

[0105] Specifically, such as Figure 4 As shown, the first-level version number tree is constructed as follows: the root node of each second-level version number tree (tenant version number tree) is used as the leaf node of the first-level version number tree. The intermediate node is constructed by the sum of the version numbers of two adjacent leaf nodes. This process is repeated recursively until the entire first-level version number tree is constructed.

[0106] Specifically, such as Figure 3 As shown, the method for synchronizing view device information is as follows:

[0107] The first step involves the service to be synchronized sending its device information first-level version number tree to the source service. The source service compares the device information first-level version number tree sent by the service to be synchronized with its local first-level version number tree. If the version number values ​​of the root nodes of the two first-level version number trees are the same, it can be deduced that the device information in the view above the service to be synchronized and the source service are completely identical, so no synchronization is needed in this round, and the synchronization ends. If the first-level version number trees are different, then starting from the root nodes of the two first-level version number trees, the source service searches for child nodes whose left and right subtrees have different version numbers, until it finds the leaf node representing the tenant's version number tree (second-level version number tree). The source service then replies to the service to be synchronized regarding which second-level version number trees have differences.

[0108] The second step involves the service to be synchronized sending the differing device information secondary version number tree to the source service. The source service compares the device information secondary version number tree sent by the service to be synchronized with its local secondary version number tree, identifies the devices whose device information has changed, and replies with the changed device information, its corresponding device ID, and information version number (only the sub-information version number is needed) to the service to be synchronized. Preferably, after identifying the devices whose device information has changed, the sub-information version numbers of the tree nodes of the secondary version number tree are compared to determine which specific category of device sub-information has changed. View device sub-information can include basic attribute information of the view device, storage information of the view device, and information on enabling or disabling the view device. By simply replying with the device ID, the changed category sub-information, and the sub-information version number to the service to be synchronized, the goal of accurate, differentiated, and minimal data synchronization is achieved.

[0109] After the changed device information and its corresponding device ID and sub-information version number are synchronized, the method for the service to be synchronized to update the local device information is as follows: The service to be synchronized first queries the local information storage location of the corresponding device based on the device ID, updates the local device sub-information and device sub-information version number, and then calculates the new total information version number based on the difference D of the change in the device sub-information version number.

[0110] V (Total Information Version Number) = V (Old Total Information Version Number) + D1 (Difference in Sub-Information 1 Version Number) + D2 (Difference in Sub-Information 2 Version Number) + ... + DN (Difference in Sub-Information N Version Number);

[0111] DN (Difference between N version numbers of sub-information) = N version number of sub-information synchronized from the source service - N version number of sub-information on the local server to be synchronized.

[0112] After the changed device information and its corresponding device ID and sub-information version number are synchronized, the method for updating the local device information version number tree by the synchronization service is as follows: For the second-level version number tree, the updated overall device information version number is used, starting from the leaf node and gradually moving upwards. For the intermediate nodes involved, the information version number is recalculated until the root node is updated. The update method for the first-level version number tree is similar, the only difference being that the leaf nodes of the first-level version number tree correspond to the root nodes of the second-level version number tree.

[0113] During the use of the view library platform, adding new devices and deleting old devices involves the insertion and deletion of version number tree nodes. Preferably, the newly inserted node can be inserted at the far right of the version number tree to minimize the number of nodes that need to be updated and adjusted. Preferably, when deleting an old device, the device information of the old device can be immediately deleted from the storage space, but only a special soft deletion mark is made on the leaf nodes of the version number tree, and then its total information version number is incremented by 1, and the version number tree is updated according to the version number tree update process. In subsequent use, the version number tree can be physically deleted and cleaned up only after the number of leaf nodes marked with soft deletion in the entire version number tree reaches a certain threshold.

[0114] When a newly added device causes a new node to be inserted into the version number tree of the source service, the method for synchronizing device information between the service to be synchronized and the source service is as follows:

[0115] New devices can be added in two ways: (1) a new tenant is added, which means a new second-level version number tree is added; (2) a device node is added to the second-level version number tree.

[0116] Corresponding to scenario (1), the source service compares the first-level version number tree sent by the service to be synchronized with the local first-level version number tree. If the information version number values ​​of the root nodes of the two first-level version number trees are different, starting from the root nodes of the two first-level version number trees, the source service searches for the leaf nodes of the left and right subtrees that exist only on the source service side, which is the second-level version number tree added on the source service side. The source service replies to the service to be synchronized with the newly added second-level version number tree and the corresponding newly added device information. The service to be synchronized saves the newly added second-level version number tree and the corresponding newly added device information locally. The service to be synchronized inserts a new node representing the newly added tenant into the local first-level version number tree.

[0117] Corresponding to scenario (2), the source service compares the first-level version number tree sent by the service to be synchronized with the local first-level version number tree. If the information version number values ​​of the root nodes of the two first-level version number trees are different, starting from the root nodes of the two first-level version number trees, it searches for child nodes with different information version numbers in the left and right subtrees until it finds the leaf node representing the tenant version number tree (second-level version number tree). The source service then replies to the service to be synchronized regarding which second-level version number trees have differences. The service to be synchronized sends the second-level version number trees of the devices with differences to the source service. The source service compares the second-level version number trees of the devices sent by the service to be synchronized with the local second-level version number tree to find devices that exist on the source service side but not on the service to be synchronized side. The source service replies to the service to be synchronized with the device identifier of the newly added device (containing the device ID, the total information version number, and the sub-information version number of the information sub-category) and the corresponding device information. The service to be synchronized saves the newly added device information locally. The service to be synchronized inserts a new node representing the newly added device into the local second-level version number tree. The service to be synchronized updates the local first-level version number tree with the updated second-level version number tree.

[0118] When deleting an old device causes a node to be deleted from the version number tree of the source service, the method for synchronizing device information between the service to be synchronized and the source service is as follows:

[0119] Deleting old devices includes two scenarios: (1) deleting a tenant, which means deleting a second-level version number tree; (2) deleting a device node from the second-level version number tree.

[0120] Corresponding to scenario (1), the source service compares the first-level version number tree sent by the service to be synchronized with the local first-level version number tree. If the information version number values ​​of the root nodes of the two first-level version number trees are different, starting from the root nodes of the two first-level version number trees, the source service searches for the leaf nodes of the left and right subtrees that only exist on the side of the service to be synchronized, which are the second-level version number trees that need to be deleted on the side of the service to be synchronized. The source service replies with the identifier of the second-level version number trees to be deleted to the service to be synchronized. The service to be synchronized deletes these second-level version number trees and the corresponding device information locally. The service to be synchronized deletes the nodes representing these tenants in the local first-level version number tree.

[0121] Corresponding to scenario (2), the source service compares the first-level version number tree sent by the service to be synchronized with the local first-level version number tree. If the information version number values ​​of the root nodes of the two first-level version number trees are different, starting from the root nodes of the two first-level version number trees, it searches for child nodes with different information version numbers in the left and right subtrees until it finds the leaf node representing the tenant version number tree (second-level version number tree). The source service then replies to the service to be synchronized regarding which second-level version number trees have differences. The service to be synchronized sends the second-level version number trees of the devices with differences to the source service. The source service compares the second-level version number trees of the devices sent by the service to be synchronized with the local second-level version number tree to find devices that do not exist on the source service side but exist on the service to be synchronized side. The source service replies to the service to be synchronized with the device IDs of the devices to be deleted. The service to be synchronized deletes the device information corresponding to the device IDs locally. The service to be synchronized deletes the node representing the device in the local second-level version number tree. The service to be synchronized updates the local first-level version number tree with the updated second-level version number tree.

[0122] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.

[0123] Based on the same inventive concept, this application also provides a version number tree-based view device information synchronization device for implementing the above-described version number tree-based view device information synchronization method. The solution provided by this device is similar to the implementation described in the above-described method. Therefore, the specific limitations of one or more version number tree-based view device information synchronization device embodiments provided below can be found in the above-described limitations of the version number tree-based view device information synchronization method, and will not be repeated here.

[0124] In one embodiment, such as Figure 11 As shown, a view device information synchronization device based on a version number tree is provided, including: a local query module, a first comparison module, a second-level version number tree module, and a second comparison module, wherein:

[0125] The local query module is used to respond to newly added services to be synchronized. The services to be synchronized send the first-level version number tree of the device information maintained locally to the source service. The leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device.

[0126] The first comparison module is used to compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, the module returns the identification information of the second-level version number tree that is different to the service to be synchronized.

[0127] The secondary version number tree module is used to obtain the secondary version number tree corresponding to the identification information returned by the service to be synchronized;

[0128] The second comparison module is used to compare the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identify the target device that has changed, and synchronize the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized.

[0129] In one embodiment, the second comparison module includes:

[0130] The leaf node comparison module is used to compare the device total information version number of the leaf nodes in the two secondary version number trees;

[0131] The version number comparison module is used to compare the sub-information version numbers of devices whose total device information version numbers differ, and to determine the target sub-information category that has changed.

[0132] In one embodiment, after the second comparison module, the following is further included:

[0133] The first update module is used for the service to be synchronized to update the associated device sub-information and sub-information version number based on the identification information;

[0134] The overall information version module is used to recalculate the overall information version number of the target device based on the difference in the sub-information version number;

[0135] The second update module is used to update the version numbers of the local second-level version number tree and the associated nodes in the first-level version number tree level by level from the bottom to the top.

[0136] In one embodiment, the device further includes:

[0137] The new device module is used to respond to the existence of a new device, wherein the source service identifies the target leaf node of the first-level version number tree that is unique to the source service in the comparison of the first-level version number tree;

[0138] The version number tree creation module is used to send the newly added second-level version number tree corresponding to the target leaf node and the associated device information to the service to be synchronized, so that the service to be synchronized can create the newly added second-level version number tree locally and update the first-level version number tree.

[0139] In one embodiment, the device further includes:

[0140] The soft deletion module is used to mark the leaf node of the deleted device as soft deletion in response to the existence of a deleted device, and increment the total information version number of the deleted device;

[0141] The physical cleanup module is used to identify the status changes of the deleted devices step by step during the device synchronization process, and clean up the deleted devices that were soft-deleted after a preset retention window.

[0142] In one embodiment, the device further includes:

[0143] A new device node module is added to identify the differences in the second-level version number tree in response to the addition of a new device node to the existing second-level version number tree.

[0144] The tree structure update module is used to identify the newly added device node that does not exist in the service to be synchronized by comparison, send the device information and version number of the newly added device node to the service to be synchronized, and update the device node and tree structure in the secondary version number tree.

[0145] The modules in the aforementioned version number tree-based view device information synchronization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.

[0146] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 12As shown, this computer device includes a processor, memory, input / output (I / O) interfaces, and a communication interface. The processor, memory, and I / O interfaces are connected via a system bus, and the communication interface is also connected to the system bus via the I / O interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides the environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data. The I / O interfaces are used for exchanging information between the processor and external devices. The communication interface is used for communicating with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for synchronizing view device information based on a version number tree.

[0147] Those skilled in the art will understand that Figure 12 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0148] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.

[0149] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.

[0150] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.

[0151] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions.

[0152] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments described above. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.

[0153] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0154] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.

Claims

1. A method for synchronizing view device information based on a version number tree, characterized in that, The method includes: In response to a new service to be synchronized, the service to be synchronized sends the first-level version number tree of the device information maintained locally to the source service. The leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device. Compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, return the identification information of the second-level version number tree that is different to the service to be synchronized. Obtain the secondary version number tree returned by the service to be synchronized, which corresponds to the identification information; By comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, the target device that has changed is identified, and the identifier of the target device, the changed sub-information, and the sub-information version number are synchronized to the service to be synchronized.

2. The method according to claim 1, characterized in that, The step of comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized includes: Compare the device total information version numbers of the leaf nodes in the two second-level version number trees; For devices with different overall device information version numbers, the sub-information version numbers are compared to determine the target sub-information category that has changed.

3. The method according to claim 1, characterized in that, The step of comparing the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identifying the target device that has changed, and synchronizing the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized, further includes: The synchronization service updates the associated device sub-information and sub-information version number based on the identification information; The total information version number of the target device is recalculated based on the difference in the sub-information version number; The version numbers of the local second-level version number tree and the associated nodes in the first-level version number tree are updated level by level from the bottom to the top.

4. The method according to claim 1, characterized in that, The method further includes: In response to the presence of a new device, the source service identifies the target leaf node of the first-level version number tree that is unique to the source service during the comparison of the first-level version number tree; The newly added second-level version number tree corresponding to the target leaf node and the associated device information are sent to the synchronization service, so that the synchronization service can create the newly added second-level version number tree locally and update the first-level version number tree.

5. The method according to any one of claims 1 to 4, characterized in that, The method further includes: In response to the existence of a deleted device, the leaf node of the deleted device is marked as soft deletion, and the total information version number of the deleted device is incremented; During device synchronization, the status changes of the deleted devices are identified step by step, and the deleted devices that were soft-deleted are cleaned up after a preset retention window.

6. The method according to claim 1, characterized in that, The method further includes: In response to the addition of a new device node to the existing secondary version number tree, identify any discrepancies in the secondary version number tree; By comparing and identifying newly added device nodes that do not exist in the service to be synchronized, the device information and version number of the newly added device nodes are sent to the service to be synchronized, and the device nodes and tree structure in the secondary version number tree are updated.

7. A view device information synchronization device based on a version number tree, characterized in that, The device includes: The local query module is used to respond to newly added services to be synchronized. The services to be synchronized send the first-level version number tree of the device information maintained locally to the source service. The leaf nodes of the first-level version number tree are the root nodes of the second-level version number tree, and the leaf nodes of the second-level version number tree are the view device information of the view device. The first comparison module is used to compare the first-level version number tree of the source service with the first-level version number tree of the service to be synchronized. If the root nodes are different, the module returns the identification information of the second-level version number tree that is different to the service to be synchronized. The secondary version number tree module is used to obtain the secondary version number tree corresponding to the identification information returned by the service to be synchronized; The second comparison module is used to compare the local secondary version number tree of the source service with the secondary version number tree returned by the service to be synchronized, identify the target device that has changed, and synchronize the identifier of the target device, the changed sub-information, and the sub-information version number to the service to be synchronized.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.

10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.