Method for cascading synchronization equipment on video platform
By using the distributed lock mechanism and temporary synchronization table comparison method in the cascade synchronization device of the video platform, the problems of data conflicts and inconsistencies in the multi-user environment are solved, synchronization efficiency and data consistency are improved, and user experience is improved.
Patent Information
- Application Number
- CN202510267653.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-07
- Publication Date
- 2025-06-06
AI Technical Summary
In a multi-user environment, data conflicts and data inconsistencies will occur when the video platform cascades and synchronizes devices.
The target video platform is locked through the distributed lock mechanism to ensure that only one synchronization request operation is in progress at the same time, and the device information is obtained batch by batch through HTTP requests, and the temporary synchronization table is used to compare and update the data to ensure accurate data synchronization.
It improves the efficiency and data consistency of device synchronization, avoids concurrent conflicts and data inconsistency, ensures high performance and low latency of the system in a high concurrency environment, and improves user experience.
Smart Images

Figure CN120111295A_ABST
Abstract
Description
Technical Field
[0001] The invention discloses a method for cascading synchronization equipment of a video platform, and relates to the technical field of communications. Background Art
[0002] A video platform is a system that integrates video surveillance, video storage, video management, and video analysis functions. It is widely used in security monitoring, smart cities, traffic management, and other fields. A video platform is usually composed of cameras, video servers, storage devices, management software, and client devices, and can realize the acquisition, transmission, storage, processing, and display of video data. Cascading refers to the process of connecting multiple video platforms in series in a video surveillance system to achieve cross-platform video data transmission and management. The cascading mechanism allows a video platform to report video data to a higher-level platform, or to obtain video data from a higher-level platform. This mechanism can achieve a wider range of monitoring and resource integration. For example, the monitoring system of a district can be cascaded to a municipal monitoring center, and then cascaded to a provincial monitoring center, thereby achieving unified monitoring and management across the province. However, in a multi-user environment, data conflicts and data inconsistencies may occur when video platforms cascade and synchronize devices. Summary of the invention
[0003] In view of the problems of the prior art, the present invention provides a method for cascading synchronization devices on a video platform, which improves the efficiency of device synchronization and data consistency by effectively managing synchronization requests and data processing procedures.
[0004] The specific scheme proposed by the present invention is:
[0005] The present invention provides a method for cascading synchronization devices of a video platform, comprising:
[0006] Step 1: Receive multi-user synchronization requests and lock the target video platform through a distributed lock mechanism so that only one synchronization request operation is in progress at the same time;
[0007] Step 2: Update the synchronization field of the target video platform to the synchronization status, indicating that the synchronization operation is currently in progress;
[0008] Step 3: Obtain the device information of each node in batches through HTTP requests, and store the data that needs to be synchronized each time in a temporary synchronization table;
[0009] Step 4: Compare the data in the temporary synchronization table with the data in the formal table, write the new data into the formal table, and update the modified data to the formal table;
[0010] Step 5: Repeat steps 3 and 4 until all device data are synchronized;
[0011] Step 6: After the synchronization is completed, regenerate the hierarchical relationship between the device and the directory, recursively calculate the groupPath value of each node and update it to the device;
[0012] Step 7: Calculate the number of devices under each node and update the result;
[0013] Step 8: Compare the data in the temporary synchronization table and the official table to find and clear the device data that has been deleted in the official table.
[0014] Furthermore, in step 1 of the method for cascading synchronization devices of video platforms, the distributed lock mechanism of Redis is used to lock the target video platform through atomic operations, so that only one synchronization request operation is performed at the same time.
[0015] Furthermore, in step 3 of the method for cascading synchronization devices on a video platform, device information is obtained in batches through HTTP requests. If the request fails, it is retried three times. If three consecutive retries fail, the synchronization task will be forcibly terminated.
[0016] Furthermore, in step 6 of the method for cascading synchronization devices of a video platform, the groupPath value of each node is recursively calculated, including: starting from the root node and going down level by level until the calculation of the groupPath value of all child nodes is completed.
[0017] The present invention also provides a device for cascading synchronization devices on a video platform, comprising a locking module, a status updating module, an information acquisition module, a comparison module and a synchronization management module.
[0018] The locking module receives multi-user synchronization requests and locks the target video platform through a distributed lock mechanism, so that only one synchronization request operation is in progress at the same time;
[0019] The status update module updates the synchronization field of the target video platform to a synchronization state, indicating that a synchronization operation is currently in progress;
[0020] The information acquisition module obtains the device information of each node in batches through HTTP requests, and stores the data that needs to be synchronized each time in a temporary synchronization table;
[0021] The comparison module compares the data in the temporary synchronization table with the data in the formal table, writes the newly added data to the formal table, and updates the modified data to the formal table;
[0022] Until all device data is synchronized, the synchronization management module regenerates the hierarchical relationship between the device and the directory, recursively calculates the groupPath value of each node and updates it to the device; calculates the number of devices under each node and updates the result; compares the data in the temporary synchronization table and the formal table, finds out and clears the device data that has been deleted in the formal table.
[0023] Furthermore, the locking module of the apparatus of the video platform cascade synchronization device utilizes the distributed lock mechanism of Redis to lock the target video platform through atomic operations, so that only one synchronization request operation is performed at the same time.
[0024] Furthermore, the information acquisition module of the device for cascading synchronization of the video platform obtains the device information in batches through HTTP requests. If the request fails, it will be retried three times. If it fails for three consecutive retries, the synchronization task will be forced to end.
[0025] Furthermore, the synchronization management module of the apparatus of the video platform cascade synchronization device recursively calculates the groupPath value of each node, including: starting from the root node and going down level by level until all child nodes complete the calculation of the groupPath value.
[0026] The benefits of the present invention are:
[0027] The present invention manages synchronization requests in a multi-user environment, and the distributed lock ensures that only one user can perform synchronization operations at the same time, avoiding concurrency conflicts and data inconsistency problems. This not only improves the stability and reliability of synchronization operations, but also maintains high performance and low latency of the system in a high-concurrency environment, improving user experience.
[0028] The present invention efficiently performs data processing and synchronization logic, and adopts batch processing and temporary synchronization table comparison methods to achieve accurate synchronization of device data. Each batch of data will be temporarily stored in a temporary synchronization table before synchronization, and will be written into the formal table after comparison with the existing data. In this way, both new and modified data can be accurately processed, avoiding data loss or redundancy problems. It not only improves the accuracy and integrity of data synchronization, but also simplifies the data processing process, so that the system can still maintain high efficiency when processing large-scale data.
[0029] After the synchronization is completed, the comprehensive update not only ensures the consistency and accuracy of the data, but also optimizes the efficiency of device management and query, and improves the overall performance and management capabilities of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] Figure 1 It is a schematic flow chart of the method of the present invention. DETAILED DESCRIPTION
[0031] Distributed locks are a mechanism used in distributed systems to control concurrent access to shared resources by multiple nodes, ensuring that only one node can hold a lock at any time, thereby preventing data conflicts and inconsistencies. It is often used to solve resource competition problems in distributed environments, such as in distributed databases, cache systems, or distributed file systems. Distributed locks can be implemented in a variety of ways, such as database-based optimistic locks, Redis-based distributed locks, ZooKeeper-based distributed locks, etc. These implementations ensure mutual exclusivity and reliability of locks through different protocols and algorithms, and can ensure system consistency and high availability even in the event of node failures or network partitions.
[0032] The present invention is further described below in conjunction with the accompanying drawings and specific embodiments so that those skilled in the art can better understand the present invention and implement it, but the embodiments are not intended to limit the present invention.
[0033] Example 1
[0034] The present invention provides a method for cascading synchronization devices of a video platform, comprising:
[0035] Step 1: Receive multi-user synchronization requests and lock the target video platform through a distributed lock mechanism so that only one synchronization request operation is in progress at the same time.
[0036] Distributed locks are implemented through Redis to lock the target video platform to prevent other users from issuing synchronization requests at the same time. This lock mechanism ensures the mutual exclusivity of synchronization operations through Redis atomic operations, avoiding data conflicts and resource competition. Distributed locks also have good performance and fault tolerance, and can maintain stable lock management even in high-concurrency environments.
[0037] Step 2: Subsequently, the synchronization field of the target video platform is updated to the "synchronizing" state to indicate that the synchronization operation is currently in progress. This can prevent duplicate synchronization and provide a clear status indication for the execution of subsequent processes.
[0038] Step 3: Obtain the device information of each node in batches through HTTP requests, and store the data that needs to be synchronized each time in a temporary synchronization table.
[0039] The device information is obtained in batches through HTTP requests. To ensure the progress of the synchronization task, if the request fails, it will be retried three times. Then the synchronization task will be forced to end, and the synchronization status in the database will be changed to store the data obtained each time during the synchronization in the temporary synchronization table.
[0040] Step 4: Compare the data in the temporary synchronization table with the data in the formal table, write the new data to the formal table, and update the modified data to the formal table.
[0041] Temporary synchronization tables are used to temporarily store newly acquired data for comparison with existing data. During the comparison process, new data is directly written to the official table to ensure data integrity; modified data is updated to the official table in real time to keep the data up to date. This batch processing and comparison method not only improves the accuracy of synchronization, but also effectively handles large-scale data and avoids data loss or redundancy. The synchronization operation will be executed in a loop until all device data is synchronized to ensure the integrity of the synchronization process.
[0042] Step 5: Repeat steps 3 and 4 until all device data are synchronized.
[0043] Step 6: After the synchronization is completed, the hierarchical relationship between the device and the directory is regenerated, and the groupPath value of each node is recursively calculated and updated to the device. The groupPath value of each node is calculated recursively, and this value is updated to the corresponding device to ensure the correctness of the device hierarchy. The hierarchical relationship of the device can be managed accurately. Rebuilding the hierarchical relationship is a key step to ensure device management and query efficiency. It not only maintains the logical connection between devices, but also provides a solid and reliable foundation for subsequent resource scheduling and management.
[0044] This process includes the following key steps: First, start from the root node and go down level by level until all child nodes have completed the calculation of the groupPath value. Then, the calculated groupPath value is updated to the corresponding device.
[0045] Step 7: Calculate the number of devices under each node and update the results. After the statistical update is completed, the system will start a data comparison process. This process involves a detailed comparison of the data in the temporary synchronization table with the official data table. Through this comparison, the system can find device data that has been marked for deletion in the official table. Once this data is found, the system will immediately perform the deletion operation to ensure that the information in the official data table always reflects the actual situation in the current system.
[0046] By performing such data maintenance steps, the system not only greatly improves the accuracy and real-time nature of the data itself, but also avoids the waste of resources that may be caused by the existence of obsolete or redundant data. In addition, this process also reflects the system's efficiency and strictness in data management, ensuring the efficiency and stability of system operation. This data management method plays a decisive role in keeping the entire system data environment clean and efficient.
[0047] Step 8: Compare the data in the temporary synchronization table and the official table to find and clear the device data that has been deleted in the official table.
[0048] Example 2
[0049] The present invention also provides a device for cascading synchronization devices on a video platform, comprising a locking module, a status updating module, an information acquisition module, a comparison module and a synchronization management module.
[0050] The locking module receives multi-user synchronization requests and locks the target video platform through a distributed lock mechanism, so that only one synchronization request operation is in progress at the same time;
[0051] The status update module updates the synchronization field of the target video platform to a synchronization state, indicating that a synchronization operation is currently in progress;
[0052] The information acquisition module obtains the device information of each node in batches through HTTP requests, and stores the data that needs to be synchronized each time in a temporary synchronization table;
[0053] The comparison module compares the data in the temporary synchronization table with the data in the formal table, writes the newly added data to the formal table, and updates the modified data to the formal table;
[0054] Until all device data is synchronized, the synchronization management module regenerates the hierarchical relationship between the device and the directory, recursively calculates the groupPath value of each node and updates it to the device; calculates the number of devices under each node and updates the result; compares the data in the temporary synchronization table and the formal table, finds out and clears the device data that has been deleted in the formal table.
[0055] As the information interaction and execution process between the modules in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention, the specific contents can be found in the description of the embodiment of the method of the present invention and will not be repeated here.
[0056] Similarly, the device of the present invention manages synchronization requests in a multi-user environment, and the distributed lock ensures that only one user can perform synchronization operations at the same time, avoiding concurrency conflicts and data inconsistency problems. This not only improves the stability and reliability of synchronization operations, but also maintains high performance and low latency of the system in a high-concurrency environment, improving the user experience.
[0057] The present invention efficiently performs data processing and synchronization logic, and adopts batch processing and temporary synchronization table comparison methods to achieve accurate synchronization of device data. Each batch of data will be temporarily stored in a temporary synchronization table before synchronization, and will be written into the formal table after comparison with the existing data. In this way, both new and modified data can be accurately processed, avoiding data loss or redundancy problems. It not only improves the accuracy and integrity of data synchronization, but also simplifies the data processing process, so that the system can still maintain high efficiency when processing large-scale data.
[0058] After the synchronization is completed, the comprehensive update not only ensures the consistency and accuracy of the data, but also optimizes the efficiency of device management and query, and improves the overall performance and management capabilities of the system.
[0059] It should be noted that not all steps and modules in the above-mentioned processes and device structures are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.
[0060] The above-described embodiments are only preferred embodiments for fully illustrating the present invention, and the protection scope of the present invention is not limited thereto. Equivalent substitutions or changes made by those skilled in the art based on the present invention are within the protection scope of the present invention. The protection scope of the present invention shall be subject to the claims.
Claims
1. A method for cascading synchronization devices on a video platform, characterized in that include: Step 1: Receive multi-user synchronization requests and lock the target video platform through a distributed lock mechanism so that only one synchronization request operation is in progress at the same time; Step 2: Update the synchronization field of the target video platform to the synchronization status, indicating that the synchronization operation is currently in progress; Step 3: Obtain the device information of each node in batches through HTTP requests, and store the data that needs to be synchronized each time in a temporary synchronization table; Step 4: Compare the data in the temporary synchronization table with the data in the formal table, write the new data into the formal table, and update the modified data to the formal table; Step 5: Repeat steps 3 and 4 until all device data are synchronized; Step 6: After the synchronization is completed, regenerate the hierarchical relationship between the device and the directory, recursively calculate the groupPath value of each node and update it to the device; Step 7: Calculate the number of devices under each node and update the result; Step 8: Compare the data in the temporary synchronization table and the official table to find and clear the device data that has been deleted in the official table.
2. A method for cascading synchronization devices of video platforms according to claim 1, characterized in that In step 1, the distributed lock mechanism of Redis is used to lock the target video platform through atomic operations, so that only one synchronization request operation is in progress at the same time.
3. A method for cascading synchronization devices of video platforms according to claim 1, characterized in that In step 3, the device information is obtained in batches through HTTP requests. If the request fails, it will be retried three times. If it fails three times in a row, the synchronization task will be forced to end.
4. The method of cascading synchronization devices of a video platform according to claim 1, characterized in that In step 6, the groupPath value of each node is recursively calculated, including: starting from the root node, step by step downward, until the groupPath value calculation of all child nodes is completed.
5. A device for cascading synchronization equipment of a video platform, characterized in that It includes locking module, status update module, information acquisition module, comparison module and synchronization management module. The locking module receives multi-user synchronization requests and locks the target video platform through a distributed lock mechanism, so that only one synchronization request operation is in progress at the same time; The status update module updates the synchronization field of the target video platform to a synchronization state, indicating that a synchronization operation is currently in progress; The information acquisition module obtains the device information of each node in batches through HTTP requests, and stores the data that needs to be synchronized each time in a temporary synchronization table; The comparison module compares the data in the temporary synchronization table with the data in the formal table, writes the newly added data to the formal table, and updates the modified data to the formal table; Until all device data is synchronized, the synchronization management module regenerates the hierarchical relationship between the device and the directory, recursively calculates the groupPath value of each node and updates it to the device; Calculate the number of devices under each node and update the result; compare the data in the temporary synchronization table and the official table, find out and clear the device data that has been deleted in the official table.
6. The apparatus of the video platform cascade synchronization device according to claim 5, characterized in that The locking module uses the distributed lock mechanism of Redis to lock the target video platform through atomic operations, so that only one synchronous request operation is in progress at the same time.
7. The apparatus of the video platform cascade synchronization device according to claim 5, characterized in that The information acquisition module obtains device information in batches through HTTP requests. If the request fails, it will be retried three times. If it fails three times in a row, the synchronization task will be forced to end.
8. The apparatus of the video platform cascade synchronization device according to claim 5, characterized in that The synchronization management module recursively calculates the groupPath value of each node, including: starting from the root node, step by step downward, until all child nodes complete the calculation of the groupPath value.