Plug-in association scheduling method based on topological sorting

CN116302156BActive Publication Date: 2026-09-22CHENGDU ANSI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211603719.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-13
Publication Date
2026-09-22
Estimated Expiration
2042-12-13

AI Technical Summary

Technical Problem

为了去除多个插件中重复的处理逻辑,常规的解决方案是将这些类似插件合并为一个插件,统一处理逻辑,实现多种业务需求,但这种方案中统一成的单个插件随着需求的增加代码会越来越臃肿,最终导致不易维护,增加了开发成本

Benefits of technology

[0014]本发明的有益效果在于:基于业务将插件区分为业务插件和整合插件,并在所有插件中配置好其依赖的插件以及注册信息以后,通过加载业务插件实现关联加载其依赖的整合插件,进一步地,在关联加载整合插件时又关联加载其依赖的其他整合插件,然后以业务插件与整合插件、整合插件与其他整合插件的依赖关系为边,构造有向无环图,最后拓扑排序该有向无环图并正向或反向遍历排序后的插件,实现了所有插件的有序调度,也能够实现统一多个相似插件中的处理逻辑,使系统具备能够满足更多需求的可扩展性,降低了需求的开发难度和插件的维护难度。

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The application discloses a plug-in association scheduling method based on topological sorting and relates to the technical field of computers, which comprises the following steps: S1, dividing plug-ins into integrated plug-ins and business plug-ins; S2, acquiring business plug-ins to be loaded; S3, acquiring all integrated plug-ins depended by each business plug-in to construct a mapping relationship; S4, creating a mapping table and importing the mapping relationship into the mapping table; S5, traversing each mapping relationship in the mapping table, creating a directed edge, connecting all the directed edges and finally forming a directed acyclic graph; S6, generating the directed acyclic graph according to a topological sorting algorithm; S7, forwardly traversing the result of the topological sorting to acquire registration information and construct a plug-in scheduling linked list; and S8, reversely traversing the result of the topological sorting to initialize each plug-in according to the principle of business plug-in priority initialization. Through the method, the processing logic in multiple similar plug-ins can be unified, the system has the scalability capable of meeting more requirements, and the development difficulty of requirements and the maintenance difficulty of plug-ins are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a plug-in association scheduling method based on topology sorting. Background Technology

[0002] In systems where plugins are the processing units, each plugin typically handles a single business requirement. As the number of requirements increases and more plugins are developed, it becomes possible to create multiple similar plugins for different needs within the same business logic. These plugins contain unnecessary repetitive processing logic. For example, in a traffic processing system, plugins for HTTP protocol file restoration, anomaly detection, and field extraction require each plugin to repeatedly parse the HTTP protocol, significantly slowing down the system's processing speed. To eliminate redundant processing logic across multiple plugins, a common solution is to merge these similar plugins into a single plugin, unifying the processing logic to fulfill various business requirements. However, this unified single plugin becomes increasingly bloated with rising requirements, ultimately leading to poor maintainability and increased development costs. Another solution is to integrate repetitive logic into a single plugin, develop different plugins for different needs, and then dispatch the data processed by the integrated plugin to each business plugin. Compared to the conventional solution, this solution not only achieves unified processing logic but also reduces the code complexity and maintenance difficulty of the plugins. However, there are complex dependencies between plugins in this solution. The integrated plugin needs to process data before the business plugins, and the business plugins may need to depend on the data processed by multiple integrated plugins. Therefore, there are sequential relationships between the integrated plugins, and some business plugins may even need to register information with the integrated plugins first due to their requirements. Summary of the Invention

[0003] The purpose of this invention is to design a plug-in association scheduling method based on topology sorting to solve the above problems.

[0004] The present invention achieves the above objectives through the following technical solutions:

[0005] The plugin association scheduling method based on topology sorting includes:

[0006] S1. Plugins are divided into integration plugins and business plugins. Integration plugins are used to provide a registration interface to obtain registration information; business plugins depend on integration plugins and the registration interface they provide.

[0007] S2. Obtain the business plugins that need to be loaded;

[0008] S3. Obtain all the integration plugins that each business plugin depends on, and construct a mapping relationship with the business plugin as the key and the integration plugins it depends on as the value.

[0009] S4. Create a mapping table between the plugin and its dependent plugins, and import the mapping relationship into the mapping table;

[0010] S5. Traverse each mapping relationship in the mapping table, starting from the value in the mapping relationship and ending from the key in the mapping relationship, create directed edges, and connect all the directed edges to finally form a directed acyclic graph.

[0011] S6. A directed acyclic graph generated by sorting according to the topological sorting algorithm;

[0012] S7. Obtain registration information by traversing the topological sorting results in the forward direction and construct the plugin scheduling list;

[0013] S8. The result of reverse traversal of the topological sort is used to initialize each plugin according to the principle of prioritizing the initialization of business plugins.

[0014] The beneficial effects of this invention are as follows: Based on business needs, plugins are divided into business plugins and integration plugins. After configuring the plugins they depend on and their registration information in all plugins, the integration plugins they depend on are loaded in association by loading the business plugins. Furthermore, when loading the integration plugins in association, other integration plugins they depend on are also loaded in association. Then, a directed acyclic graph is constructed using the dependencies between business plugins and integration plugins, and between integration plugins and other integration plugins, as edges. Finally, the directed acyclic graph is topologically sorted and the sorted plugins are traversed in forward or reverse order. This achieves ordered scheduling of all plugins and also enables the unification of processing logic in multiple similar plugins. This gives the system scalability to meet more needs and reduces the difficulty of developing requirements and maintaining plugins. Detailed Implementation

[0015] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.

[0016] The plugin association scheduling method based on topology sorting includes:

[0017] S1. Plugins are divided into integration plugins and business plugins. Integration plugins are used to provide registration interfaces to obtain registration information. Business plugins depend on integration plugins and their provided registration interfaces. Integration plugins are plugins that implement a certain unified processing logic, while business plugins are plugins that specifically implement a certain requirement.

[0018] S2. Obtain the business plugins that need to be loaded;

[0019] S3. Obtain all the integrated plugins that each business plugin depends on. Construct a mapping relationship with the business plugin as the key and the integrated plugins it depends on as the value. Recursively traverse each integrated plugin that a business plugin depends on. If other integrated plugins that an integrated plugin depends on are obtained, construct a mapping relationship with the integrated plugin as the key and the other integrated plugins it depends on as the value.

[0020] S4. Create a mapping table between the plugin and its dependent plugins, and import the mapping relationship into the mapping table;

[0021] S5. Traverse each mapping relationship in the mapping table, starting from the value in the mapping relationship and ending from the key in the mapping relationship, create directed edges, and connect all the directed edges to finally form a directed acyclic graph.

[0022] S6. The directed acyclic graph generated by the topological sorting algorithm has dependent plugins as vertices without predecessors. After topological sorting, the order from front to back is: independent integration plugins, dependent integration plugins, and business plugins.

[0023] S7. Obtain registration information from the results of forward traversal of topological sorting and construct the plugin scheduling list. Specifically, the integrated plugin obtains registration information from other integrated plugins that depend on it, and adds the sorted integrated plugins to the plugin scheduling list in turn.

[0024] Forward traversal first processes integration plugins without dependencies, then integration plugins with dependencies, and finally business plugins, which conforms to the plugin scheduling logic. The plugin scheduling list is a singly linked list.

[0025] S8. The result of the reverse traversal topological sorting is used to initialize each plugin according to the principle of prioritizing the initialization of business plugins. When traversing in reverse, the business plugins are initialized first, which ensures that after the integration plugin generates the preprocessed data, the business plugins are ready and the preprocessed data can be dispatched to the business plugins.

[0026] Only the configured business plugins need to be loaded. The plugins that the business plugins depend on are further loaded based on the dependency information configured in the business plugins. This means that plugins that are not depended on will not be loaded when the program runs, thus realizing a flexible mechanism for loading plugins on demand.

[0027] Based on business logic, plugins are categorized into business plugins and integration plugins. After configuring the plugins they depend on and their registration information in all plugins, the integration plugins they depend on are loaded in association by loading the business plugins. Furthermore, when loading the integration plugins in association, other integration plugins they depend on are also loaded in association. Then, a directed acyclic graph is constructed using the dependencies between business plugins and integration plugins, and between integration plugins and other integration plugins, as edges. Finally, the directed acyclic graph is topologically sorted, and the sorted plugins are traversed in either the forward or reverse direction. This achieves ordered scheduling of all plugins and enables the unification of processing logic in multiple similar plugins. This gives the system scalability to meet more needs and reduces the difficulty of developing requirements and maintaining plugins.

[0028] The technical solutions of the present invention are not limited to the specific embodiments described above. Any technical modifications made in accordance with the technical solutions of the present invention fall within the protection scope of the present invention.

Claims

1. A plug-in association scheduling method based on topology sorting, characterized in that, include: S1. Plugins are divided into integration plugins and business plugins. Integration plugins are used to provide a registration interface to obtain registration information. Business plugins depend on integration plugins and their provided registration interfaces; S2. Obtain the business plugins that need to be loaded; S3. Obtain all the integration plugins that each business plugin depends on, and construct a mapping relationship with the business plugin as the key and the integration plugins it depends on as the value. S4. Create a mapping table between the plugin and its dependent plugins, and import the mapping relationship into the mapping table; S5. Traverse each mapping relationship in the mapping table, starting from the value in the mapping relationship and ending from the key in the mapping relationship, create directed edges, and connect all the directed edges to finally form a directed acyclic graph. S6. A directed acyclic graph generated by sorting according to the topological sorting algorithm; S7. Obtain registration information by traversing the topological sorting results in the forward direction and construct the plugin scheduling list; S8. The result of reverse traversal of the topological sort is used to initialize each plugin according to the principle of prioritizing the initialization of business plugins.

2. The plug-in association scheduling method based on topology sorting as described in claim 1, characterized in that, Integration plugins are plugins that implement unified processing logic, while business plugins are plugins that specifically implement requirements.

3. The plug-in association scheduling method based on topology sorting as described in claim 1, characterized in that, In S3, each dependent integration plugin in the business plugin is recursively traversed. If other integration plugins that the integration plugin depends on are obtained, a mapping relationship is constructed with the integration plugin as the key and the other integration plugins it depends on as the value.

4. The plug-in association scheduling method based on topology sorting as described in claim 1, characterized in that, In S6, the dependent plugins are vertices without predecessors. After topological sorting, the order from front to back is the integration plugin without dependencies, the integration plugin with dependencies, and the business plugin.

5. The plug-in association scheduling method based on topology sorting as described in claim 1, characterized in that, In S7, the integration plugin obtains registration information from other integration plugins that depend on it, and adds the sorted integration plugins to the plugin scheduling list in sequence.

6. The plug-in association scheduling method based on topology sorting as described in claim 1, characterized in that, In S7, a forward traversal is performed to process integration plugins without dependencies, integration plugins with dependencies, and business plugins.

Citation Information

Patent Citations

  • Software architecture system

    CN109901817A

  • Plug-in, application program implementation method and system, computer system and storage medium

    CN111427579A