Method for managing plug-ins, plug-in type framework system and computing equipment
By adopting a plug-in framework system in software development, dynamically manage and load plug-ins, the complexity and high cost problems of traditional software architectures when function expansion is solved, and higher flexibility and maintainability are achieved.
Patent Information
- Application Number
- CN202411632541.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-14
- Publication Date
- 2025-03-18
AI Technical Summary
Traditional software architectures need to recompile the entire program when function is expanded, which is time-consuming and labor-intensive, and it is difficult to reuse and integrate software, resulting in high maintenance costs and error rates.
The plug-in framework system is adopted to find all plug-ins in the main program directory, collect dependency information, build a directed acyclic graph, and manage the loading order and unloading order of the plug-in to achieve dynamic loading and unloading functions.
It improves the customization and flexibility of software development methods, reduces development costs and error rates, and enhances the maintainability and scalability of the system.
Smart Images

Figure CN119645515A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software development, and in particular to a method for managing plug-ins, a plug-in framework system and a computing device. Background Art
[0002] In the course of computer software development, software architecture has been constantly evolving. Early software usually adopts a monolithic architecture, where all functions are integrated into a large program. This architecture can meet the needs when the functions are relatively simple and the scale is small, but with the continuous increase of software functions and the increase of complexity, its maintenance cost and scalability issues gradually become prominent. On the Linux platform, traditional software systems also face similar challenges. In order to improve the maintainability and scalability of software, developers began to explore new architectural models. The plug-in architecture has gradually developed in this context. Traditional Linux software may need to recompile the entire program in terms of functional expansion, or add new functions by modifying a large amount of code. This is not only time-consuming and labor-intensive, but also easy to introduce new errors. In addition, there may be compatibility issues between different software, making it difficult to achieve software reuse and integration.
[0003] To this end, a technical solution is needed that can address the limitations of traditional software architecture, improve the customizability and flexibility of software development methods, reduce development costs and error rates, and enhance system maintainability. Summary of the invention
[0004] The present invention aims to provide a method for managing plug-ins, a plug-in framework system and a computing device, which can address the limitations of traditional software architecture, improve the customizability and flexibility of software development methods, reduce development costs and error rates, and enhance system maintainability.
[0005] According to one aspect of the present invention, a method for managing plug-ins is provided, the method being used for an application based on a plug-in framework system, the method comprising:
[0006] Traverse and search for all plugins in the directory where the main program is located;
[0007] Collect dependency information of each plugin and form a dependency list;
[0008] According to the dependency relationships in the dependency list, a directed acyclic graph is constructed to represent the dependency relationships between the plug-ins;
[0009] The loading order and unloading order of the plug-ins are managed according to the directed acyclic graph.
[0010] According to some embodiments, traversing and searching for all plug-ins in the directory where the main program is located includes: searching for registered plug-ins in the directory using a binary search algorithm.
[0011] According to some embodiments, searching for registered plug-ins in the directory using a binary search algorithm includes:
[0012] Define the to-be-searched interval of the directory as a list of registered plug-ins;
[0013] Setting the left and right boundaries of the interval to be searched;
[0014] Taking the middle element of the interval to be searched, and matching the middle element with the feature of the target plug-in;
[0015] If the match is successful, the search is successful. If the match fails, the boundary is updated and the search continues until the target plug-in is found and / or the search interval is empty.
[0016] According to some embodiments, collecting dependency information of each plug-in and forming a dependency list includes:
[0017] Dependencies between the plugins are explicitly declared through configuration files, code comments, and / or specific dependency management tools.
[0018] According to some embodiments, based on the dependency relationships in the dependency list, a directed acyclic graph is constructed to represent the dependency relationships between the plug-ins, including:
[0019] Represent each plug-in as a node in the directed acyclic graph, wherein the node contains name information and description information of the plug-in;
[0020] According to the dependency relationship, directed edges between the nodes are added.
[0021] According to some embodiments, when the plug-in generates an event, the event is added to an event queue;
[0022] The event queue is traversed, and the event is distributed to the plug-in listening to the event.
[0023] According to some embodiments, the plug-in transfers data using a shared memory. After writing data to the shared memory, the plug-in notifies other plug-ins that the data is ready by using a conditional variable. The other plug-ins obtain a mutex lock before reading the data.
[0024] According to another aspect of the present invention, a plug-in framework system based on a Linux platform is provided, wherein the system customizes and maintains system functions by loading and unloading plug-ins, and the system includes basic support library management and business application management, wherein the basic support library includes a driver device management module, a message queue telemetry transmission service module, a shared memory management module, and a task management module, and the business application management includes a channel management module and a protocol management module, wherein:
[0025] The drive management module is configured as follows:
[0026] Provides interfaces for opening, setting, receiving and sending drive devices;
[0027] Transfer data between operating systems and hardware devices;
[0028] Dynamically load and / or unload driver plugins based on demand;
[0029] The message queue telemetry transmission service module is configured as follows:
[0030] Publish and subscribe messages between devices and services;
[0031] The shared memory management module is configured as follows:
[0032] Allocate, manage, and access shared memory areas between multiple processes;
[0033] The task management module is configured as follows:
[0034] Maintain at least one virtual clock to track time within the system;
[0035] The channel management module is configured as follows:
[0036] Manage the creation, configuration, monitoring and maintenance of various channels in the system;
[0037] The protocol management module is configured as follows:
[0038] Manage and maintain various specifications to ensure stable execution of plugins and other data.
[0039] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the method as described above is implemented.
[0040] According to another aspect of the present invention, there is provided a computing device, comprising:
[0041] Processor; and
[0042] A memory stores a computer program, and when the computer program is executed by the processor, the method described in any one of the above items is implemented.
[0043] According to an embodiment of the present invention, all plug-ins in the directory where the main program is located are traversed and searched, the dependency information of each plug-in is collected and a dependency list is formed, and a directed acyclic graph is constructed using a parsing algorithm according to the dependency relationship in the dependency list, and the directed acyclic graph determines the loading order and dependency relationship of the plug-ins, which facilitates the loading, management and operation of the plug-ins. Through the management of plug-ins, the present invention can solve the limitations of traditional software architecture, improve the customizability and flexibility of software development methods, reduce development costs and error rates, and enhance system maintainability.
[0044] According to some embodiments, the present invention decomposes core functions and services into independent components or plug-ins, which can be dynamically loaded and unloaded, thereby providing flexibility and scalability. New plug-ins can be easily added to expand system functions according to needs without major modifications to the existing system.
[0045] According to some embodiments, the method of the present invention can make the system consist of multiple independent modules, each module is responsible for a specific function, which makes the system more flexible and can add or delete functions as needed. Since each plug-in is independent, it can be updated and maintained separately without affecting other parts of the system, reducing maintenance costs and reducing the risk of instability of the entire system due to updating one component.
[0046] According to some embodiments, since the plug-in can run independently of the core, potentially dangerous operations can be performed in a safe sandbox environment, reducing the risk of system attacks. By defining standardized interfaces, different plug-ins can implement the same functions on different operating systems, promoting cross-platform compatibility and interoperability.
[0047] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for describing the embodiments are briefly introduced below.
[0049] Figure 1 A flow chart of a method for managing plug-ins according to an example embodiment is shown.
[0050] Figure 2 A schematic diagram showing a system architecture according to an example embodiment.
[0051] Figure 3 A schematic diagram illustrating plug-in management according to an example embodiment.
[0052] Figure 4 A flow chart showing a simplified loading process according to an example embodiment is shown.
[0053] Figure 5 A block diagram of a computing device is shown according to an exemplary embodiment. DETAILED DESCRIPTION
[0054] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0055] In addition, the described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention can be practiced without one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0056] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities may be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0057] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps can be decomposed, and some operations / steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0058] It should be understood that although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one component from another component. Therefore, the first component discussed below can be referred to as the second component without departing from the teachings of the present inventive concept. As used herein, the term "and / or" includes any one of the associated listed items and all combinations of one or more.
[0059] 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, stored data, displayed data, etc.) involved in the present invention are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0060] Those skilled in the art will appreciate that the drawings are merely schematic diagrams of example embodiments, and the modules or processes in the drawings are not necessarily necessary for implementing the present invention, and therefore cannot be used to limit the protection scope of the present invention.
[0061] As business needs continue to change, people have higher and higher requirements for software flexibility and customizability, and the system needs to be able to quickly adapt to new functional requirements. Traditional software often requires a lot of modifications to the core code or even recompile the entire program when expanding its functions. How to conveniently add new functional plug-ins without modifying the core code and improve the scalability of the system has become an urgent problem to be solved.
[0062] Most plug-in frameworks are faced with the problem of how to effectively manage the loading, unloading and updating of numerous plug-ins. Therefore, it is necessary to design an efficient plug-in management mechanism that can not only automatically detect available plug-ins, dynamically load plug-ins, and safely unload plug-ins when they are not needed. Through plug-in management methods, automatic loading, unloading and exception handling of plug-ins can be achieved, reducing the workload of personnel development, reducing system complexity, and improving system stability and work efficiency. In addition, it can reduce code coupling, split different functions, and implement permission grading, thereby improving the security of the framework system.
[0063] To this end, the present invention proposes a method for managing plug-ins and a plug-in framework system, which can address the limitations of traditional software architecture, improve the customizability and flexibility of software development methods, reduce development costs and error rates, and enhance system maintainability.
[0064] Exemplary embodiments of the present invention are described below with reference to the accompanying drawings.
[0065] Figure 1 A flow chart of a method for managing plug-ins according to an example embodiment is shown.
[0066] In S101, all plug-ins in the directory where the main program is located are searched.
[0067] According to some embodiments, the plug-in is an operating system function plug-in, and the plug-in is used to form a component-based application. A binary search algorithm is used to search for registered plug-ins in the directory. The plug-ins are stored according to a dictionary of plug-in names; the dictionary includes information such as Chinese name, English name, version number, author, etc.
[0068] According to some embodiments, the interval to be searched of the directory is defined as a list of registered plug-ins; the left and right boundaries of the interval to be searched are set; the middle element of the interval to be searched is taken, and the middle element is matched with the characteristics of the target plug-in; if the match is successful, the search is successful, and if the match fails, the boundary is updated and the search continues until the target plug-in is found and / or the search interval is empty. If the middle element is smaller than the target plug-in, the right boundary of the boundary is updated, and the search continues in the right half of the search interval until the target plug-in is found and / or the search interval is empty; if the middle element is larger than the target plug-in, the left boundary of the boundary is updated, and the search continues in the left half of the search interval until the target plug-in is found and / or the search interval is empty.
[0069] Through the dynamic link library loading algorithm, all plug-ins in the directory where the main program is located are traversed and searched. For example, the system plug-in is named plg.systems, the global variable plug-in is named plg.symbols, the third-party library plug-in is named plg.third.xxx, and the protocol plug-in is named plg.pcol.xxx.
[0070] The plug-in framework system developed using the plug-in management method of the present invention stores registered plug-ins in a dictionary of plug-in names, which includes information such as Chinese name, English name, version number, author, etc., and can be sorted and loaded using a binary search algorithm. The algorithm has high search efficiency and a time complexity of O(log n), where n is the number of registered plug-ins.
[0071] Define the interval to be searched as the entire list of registered plug-ins, set the left and right boundaries of the search interval, initially the left boundary low = 0, the right boundary hig = n-1, where n is the length of the sequence to be searched; take the middle element of the interval, mid = low + (high-low) / 2, and compare it with the characteristics of the target plug-in (such as name, ID, etc.).
[0072] If the middle element is the target plug-in, the search is successful; if the middle element is smaller than the target plug-in, the right boundary is updated to high = mid-1, and the search continues in the right half of the interval; if the middle element is larger than the target plug-in, the left boundary is updated to low = mid + 1 and the search continues in the left half of the interval; repeat the above steps until the target plug-in is found or the interval is empty, and an empty interval indicates a search failure.
[0073] In S103, dependency information of each plug-in is collected and a dependency list is formed.
[0074] According to some embodiments, the dependency relationship between the plug-ins is explicitly declared through configuration files, code comments and / or specific dependency management tools.
[0075] Through the dependency resolution algorithm, a directed acyclic graph (DAG) is constructed to represent the dependencies between plug-ins. Each plug-in is represented as a node in the directed acyclic graph, and the node contains the name information and description information of the plug-in; according to the dependency, directed edges between the nodes are added. First, the representation of the plug-in nodes and edges is determined. Each plug-in can be represented as a node in the graph, and the node contains the name, description and other information of the plug-in. If a plug-in A depends on another plug-in B, then a directed edge is drawn from the node of plug-in A to the node of plug-in B. This edge indicates that plug-in A needs plug-in B to be loaded and initialized before running.
[0076] To collect dependency information of a plug-in, developers need to explicitly declare other plug-ins that the plug-in depends on through configuration files, code comments, or specific dependency management tools, and then traverse all plug-ins, collect dependency information for each plug-in, and form a dependency list.
[0077] In S105, a directed acyclic graph is constructed according to the dependency relationships in the dependency list to represent the dependency relationships between the plug-ins.
[0078] According to some embodiments, the directed acyclic graph is used to determine the order in which plug-ins are loaded. Each plug-in is represented as a node in the directed acyclic graph, and the node contains the name information and description information of the plug-in; if two nodes are randomly selected, and the first node depends on the second node, a directed edge is drawn from the first node to the second node.
[0079] According to some embodiments, when the plug-in generates an event, the event is added to a queue; the framework system traverses the queue and distributes the event to the corresponding plug-in. An event-driven algorithm is used to solve the logic of event queue management and event distribution; a linked list and / or queue data structure is used to store the event.
[0080] Build a directed acyclic graph, using appropriate data structures in the programming language to represent the graph, such as adjacency lists, adjacency matrices, etc. You can create a dictionary where the key is the plugin node and the value is the list of plugins that the plugin depends on, adding nodes and edges one by one: For each plugin, add it as a node to the graph. Based on the collected dependency information, add the corresponding directed edges to the graph. For example, if plugin A depends on plugin B and plugin C, then in the graph, the node of plugin A will have edges pointing to the nodes of plugin B and plugin C.
[0081] S107: managing the loading order and unloading order of the plug-ins according to the directed acyclic graph.
[0082] In order to facilitate other parts of the system to use the constructed directed acyclic graph, some interface functions can be provided to access the nodes and edges of the graph. For example, a function can be provided to query the list of dependent plug-ins of a plug-in, or to query whether a specific plug-in node exists in the graph. Ensure the stability and ease of use of the interface so that the graph structure can be easily used to determine the loading order of plug-ins and the satisfaction of dependencies during plug-in loading, management and operation.
[0083] According to some embodiments, according to the dependency relationship represented by the directed acyclic graph, the dependency relationship is resolved by using topological sorting, and the plug-ins having the dependency relationship are loaded preferentially.
[0084] When resolving dependencies, use topological sorting to ensure that dependent plug-ins are loaded first. The pseudo code is as follows:
[0085]
[0086] According to some embodiments, when the plug-in generates an event, the event is added to the event queue; the event queue is traversed and the event is distributed to the corresponding plug-in; an event-driven algorithm is used to solve the logic of event queue management and event distribution. The plug-in uses shared memory to transfer data; after the plug-in writes data to the shared memory, the message that the data is ready is notified to the corresponding plug-in by using a conditional variable.
[0087] According to some embodiments, when it comes to the management of event queues and the logic of event distribution, an event-driven algorithm is added. A linked list or queue data structure is used to store events. When a plug-in generates an event, the event is added to the queue, and then the framework system traverses the queue and distributes the event to interested plug-ins. At the same time, shared memory is used to transfer data, and mutex locks (such as pthread_mutex_t) and conditional variables (such as pthread_cond_t) are used to ensure data consistency. When a plug-in writes data to shared memory, conditional variables are used to notify other plug-ins that the data is ready. Other plug-ins need to obtain mutex locks before reading data to prevent data from being modified at the same time.
[0088] The present invention makes each module of the system independent and decoupled through plug-in management, and the components added to task scheduling will share resources in the form of message mechanism and global symbols. The manager of the framework system can classify the permissions of plug-ins, and different developers develop different modules, providing a set of standardized plug-in interfaces and protocols to ensure the compatibility and interoperability between plug-ins and frameworks. The plug-in framework system based on the Linux platform provides developers and users with powerful functions and convenient user experience through its innovations in flexibility, scalability, modular design, and dynamic loading and unloading capabilities.
[0089] Figure 2 A schematic diagram showing a system architecture according to an example embodiment.
[0090] See also Figure 2 , Figure 2 A plug-in framework system based on the Linux platform is shown. The system customizes and maintains system functions by loading and unloading plug-ins. The system includes basic support library management and business application management. The basic support library includes a driver device management module, a message queue telemetry transmission service module, a shared memory management module, and a task management module. The business application management includes a channel management module and a protocol management module.
[0091] Among them, the driver management module is configured to: provide an interface for opening, setting, receiving and sending driver devices; transmit data between the operating system and the hardware device; and dynamically load and / or unload driver plug-ins according to demand. The message queue telemetry transmission service module is configured to: publish and subscribe to messages between devices and services. The shared memory management module is configured to: allocate, manage and access multiple inter-process shared memory areas. The task management module is configured to: maintain at least one virtual clock to track time within the system. The channel management module is configured to: manage the creation, configuration, monitoring and maintenance of various channels in the system. The protocol management module is configured to: manage and maintain various protocols to ensure stable execution of plug-ins and other data.
[0092] The present invention provides a plug-in framework system based on the Linux platform, which can be widely used in industries such as artificial intelligence, the Internet of Things, big data, and cloud computing, and has strong compatibility and scalability. Due to the independence of the plug-in, developers can quickly iterate and update a certain functional module without having to reconstruct or redeploy the entire system. This not only greatly reduces the complexity and cost of system maintenance, but also speeds up product iteration, enabling products to respond to market demand more quickly. At the same time, an open platform is provided for developers to develop and share plug-ins. With the increase in the number of plug-ins and the improvement in quality, a rich plug-in ecosystem is formed. This provides users with more choices and promotes product diversification and innovation.
[0093] The plug-in framework system includes basic support library management and business application management. The basic support library includes a driver device management module, a message queue telemetry transmission service module (MQTT service module), a shared memory management module, a task management module, etc. The business application management includes a channel management module, a protocol management module, etc., as shown in the system architecture diagram.
[0094] The driver management module provides interfaces for opening, setting, receiving and sending driver devices. Through these interfaces, the system can manage the hardware devices of the embedded terminal and transfer data between the operating system and the hardware devices, thereby achieving the purpose of obtaining data and controlling the devices. At the same time, users can dynamically load and unload drivers as needed to improve the flexibility and maintainability of the system.
[0095] The MQTT service module uses a publish / subscribe mode for communication, where devices and services publish and subscribe messages through topics. This mode simplifies the integration process between devices and services, reduces the coupling degree of the system, and provides a real-time and reliable message service;
[0096] The shared memory management module is a component in the plug-in framework system used to allocate, manage and access shared memory areas between multiple processes. This component allows different processes to directly access the same physical memory area, thereby achieving efficient data exchange and communication;
[0097] The task management module is responsible for maintaining one or more soft clocks (or virtual clocks) that are used to track time within the system and implement timing and delay functions. The system can schedule and execute scheduled tasks according to set time intervals or specific time points. These tasks may include periodic inspections, data collection, system maintenance, etc. It is an important component to ensure stable system operation and efficient execution of scheduled tasks;
[0098] The channel management module is mainly responsible for the creation, configuration, monitoring and maintenance of various channels (such as physical channels, logical channels, data channels, etc.) in the system to ensure the normal operation of the channels and improve the reliability and efficiency of the system. The plug-in framework system encapsulates the read and write interface, simplifies the user process, and implements the call of the physical interface;
[0099] The protocol management module is used to manage and maintain system components of various protocols (such as technical standards, communication protocols, management specifications, etc.). It aims to ensure the effective execution, timely update and compliance of the protocols to support the stable operation and efficient management of the system. Users can load different protocols according to the usage scenarios, such as State Grid 101, State Grid 104, Modbus and other protocols, to interact with different external devices or platforms. The system provides flexible permission management and role configuration functions to meet the needs of different user groups.
[0100] In order to solve the problems in the above background technology, the present invention proposes a plug-in framework system based on the Linux platform. On the one hand, by decomposing functions into independent plug-ins, the complexity of the entire system is reduced, which makes each part of the system easier to understand and maintain; on the other hand, it allows developers to expand or modify system functions by adding or replacing plug-ins without modifying the core system code. This flexibility enables the system to quickly adapt to new requirements and technical changes.
[0101] The plug-in framework system loads different components through plug-in management. Each plug-in is an independent module responsible for implementing specific functions, such as serial port communication, protocol conversion, etc. The plug-in framework system on the Linux platform supports dynamic loading and unloading of plug-ins at runtime, and uses intelligent algorithms to load plug-ins in specific scenarios in real time. This means that users can add or remove functions at any time as needed without recompiling or restarting the entire system.
[0102] Figure 3 A schematic diagram illustrating plug-in management according to an example embodiment.
[0103] Figure 4 A flow chart showing a simplified loading process according to an example embodiment is shown.
[0104] In S401, do a good job of dividing and combining the plug-ins, and place the plug-ins required in the project in the specified directory.
[0105] Do a good job of dividing and combining plug-ins, put the plug-ins needed in the project in the specified directory, and derive different usage scenarios, such as Figure 3 As shown, the basic plug-in, Ethernet plug-in, and GB104 plug-in are combined together to form 104APP.
[0106] In S403, the plug-in in the specified directory is loaded and loaded into the plug-in pool, and the configuration file is read and synchronized to the structure.
[0107] After the system starts, the plug-ins in the specified directory are first loaded and loaded into the plug-in pool; at the same time, the configuration file is read and synchronized to the structure, and finally a plug-in structure (PluginMap) is formed for developers to dynamically load and unload.
[0108] In S405, the task management module is called to adjust the task priority.
[0109] Call the task management module to increase the priority of important tasks, reduce the time slice rotation cycle of non-essential tasks, cooperate with the thread management module to complete the task scheduling algorithm, trigger and execute the corresponding tasks according to the set time or cycle, ensure that each task can be executed within the scheduled time, and avoid resource conflicts and waste.
[0110] In S407, the sending interface provided by the channel management library is called to read, write and obtain data.
[0111] When a channel idle event is triggered, the system calls the interface function provided by the protocol management to form a complete and correct message frame. The system writes data to the external smart device or platform by calling the sending interface provided by the channel management library, and obtains available information through the reading interface.
[0112] In S409, the service interface is called to package the data and upload it to the data center.
[0113] Analyze the available information, call the MQTT service interface of the basic support library, package the data, and then upload it to the data center to realize resource exchange between multiple processes or threads.
[0114] Figure 5 A block diagram of a computing device is shown according to an exemplary embodiment.
[0115] like Figure 5 As shown, computing device 30 includes processor 12 and memory 14. Computing device 30 may also include bus 22, network interface 16, and I / O interface 18. Processor 12, memory 14, network interface 16, and I / O interface 18 may communicate with each other via bus 22.
[0116] The processor 12 may include one or more general-purpose CPUs (Central Processing Units, processors), microprocessors, or application-specific integrated circuits, etc., for executing relevant program instructions. According to some embodiments, the computing device 30 may also include a high-performance graphics card (GPU) 20 for accelerating the processor 12.
[0117] The memory 14 may include a machine system readable medium in the form of a volatile memory, such as a random access memory (RAM), a read-only memory (ROM) and / or a cache memory. The memory 14 is used to store one or more programs including instructions and data. The processor 12 can read the instructions stored in the memory 14 to execute the above-mentioned method according to the embodiment of the present invention.
[0118] The computing device 30 may also communicate with one or more networks via the network interface 16. The network interface 16 may be a wireless network interface.
[0119] The bus 22 may include an address bus, a data bus, a control bus, etc. The bus 22 provides a path for exchanging information between components.
[0120] It should be noted that, in the specific implementation process, the computing device 30 may also include other components necessary for normal operation. In addition, those skilled in the art may understand that the above device may only include components necessary for implementing the embodiments of this specification, and need not include all components shown in the figure.
[0121] The present invention also provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above method when executed by a processor. The computer-readable storage medium may include, but is not limited to, any type of disk, including a floppy disk, an optical disk, a DVD, a CD-ROM, a microdrive, and a magneto-optical disk, a ROM, a RAM, an EPROM, an EEPROM, a DRAM, a VRAM, a flash memory device, a magnetic card or an optical card, a nanosystem (including a molecular memory IC), a network storage device, a cloud storage device, or any type of medium or device suitable for storing instructions and / or data.
[0122] An embodiment of the present invention further provides a computer program product, which includes a computer program. The computer program is operable to enable a computer to execute part or all of the steps of any one of the methods described in the above method embodiments.
[0123] Those skilled in the art can clearly understand that the technical solution of the present invention can be implemented with the help of software and / or hardware. "Unit" and "module" in this specification refer to software and / or hardware that can independently complete or cooperate with other components to complete specific functions, where the hardware can be, for example, a field programmable gate array, an integrated circuit, etc.
[0124] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0125] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0126] In the several embodiments provided by the present invention, it should be understood that the disclosed devices can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some service interfaces, and the indirect coupling or communication connection of devices or units can be electrical or other forms.
[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0128] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present invention.
[0130] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0131] The exemplary embodiments of the present invention are specifically shown and described above. It should be understood that the present invention is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present invention is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended clauses.
Claims
1. A method for managing plug-ins, the method being used for an application based on a plug-in framework system, the method comprising: Traverse and search for all plugins in the directory where the main program is located; Collect dependency information of each plugin and form a dependency list; According to the dependency relationships in the dependency list, a directed acyclic graph is constructed to represent the dependency relationships between the plug-ins; The loading order and unloading order of the plug-ins are managed according to the directed acyclic graph.
2. The method according to claim 1, characterized in that: Traversing and searching all plug-ins in the directory where the main program is located, including: searching for registered plug-ins in the directory using a binary search algorithm.
3. The method according to claim 2, characterized in that Use a binary search algorithm to search for registered plugins in the directory, including: Define the to-be-searched interval of the directory as a list of registered plug-ins; Setting the left and right boundaries of the interval to be searched; Taking the middle element of the interval to be searched, and matching the middle element with the feature of the target plug-in; If the match is successful, the search is successful. If the match fails, the boundary is updated and the search continues until the target plug-in is found and / or the search interval is empty.
4. The method according to claim 1, characterized in that: Collect dependency information of each plugin and form a dependency list, including: Dependencies between the plugins are explicitly declared through configuration files, code comments, and / or specific dependency management tools.
5. The method according to claim 1, characterized in that According to the dependency relationships in the dependency list, a directed acyclic graph is constructed to represent the dependency relationships between the plug-ins, including: Represent each plug-in as a node in the directed acyclic graph, wherein the node contains name information and description information of the plug-in; According to the dependency relationship, directed edges between the nodes are added.
6. The method according to claim 1, characterized in that Also includes: When the plug-in generates an event, the event is added to the event queue; The event queue is traversed, and the event is distributed to the plug-in listening to the event.
7. The method according to claim 1, characterized in that The plug-in transfers data in a shared memory manner. After writing data to the shared memory, the plug-in notifies other plug-ins of a message that the data is ready by using a conditional variable. The other plug-ins obtain a mutex lock before reading the data.
8. A plug-in framework system based on the Linux platform, wherein the system customizes and maintains system functions by loading and unloading plug-ins, and the system includes basic support library management and business application management, wherein the basic support library includes a driver device management module, a message queue telemetry transmission service module, a shared memory management module, and a task management module, and the business application management includes a channel management module and a protocol management module, wherein: The drive management module is configured as follows: Provides interfaces for opening, setting, receiving and sending drive devices; Transfer data between operating systems and hardware devices; Dynamically load and / or unload driver plugins based on demand; The message queue telemetry transmission service module is configured as follows: Publish and subscribe messages between devices and services; The shared memory management module is configured as follows: Allocate, manage, and access shared memory areas between multiple processes; The task management module is configured as follows: Maintain at least one virtual clock to track time within the system; The channel management module is configured as follows: Manage the creation, configuration, monitoring and maintenance of various channels in the system; The protocol management module is configured as follows: Manage and maintain various specifications to ensure stable execution of plugins and other data.
9. A computer program product, characterized in that The method comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.
10. A computing device, characterized in that include: processor; as well as A memory storing a computer program, wherein when the computer program is executed by the processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Plug-in management method and device based on Qt plug-in framework
CN121560420A