Third-party library management method, system, device and equipment and storage medium
By introducing a third-party library adaptation layer into the database project, analyzing and encapsulating the functions of each third-party library, a variety of complex problems in third-party library management have been solved, and unified management and simplified maintenance have been achieved.
Patent Information
- Application Number
- CN202510347228.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2025-06-27
AI Technical Summary
When introducing multiple third-party libraries into database projects, the implementation of each library is different, resulting in a large number of modifications to adapt to the database, which is complex in management and difficult to maintain and reuse.
By introducing the connection function layer and the functional function layer into the third-party library adaptation layer, the problems of each third-party library are analyzed and their functions are encapsulated to achieve unified management and loading of all third-party libraries.
It realizes unified management of different third-party libraries, reduces management difficulty and maintenance costs, and simplifies the process of code reuse and introducing new libraries.
Smart Images

Figure CN120216222A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the technical field of databases, and in particular, to a method, system, device, equipment and storage medium for managing third-party libraries. Background Art
[0002] Currently, in database projects, it is common to involve other third-party library files. Introducing various third-party library files in the project can enable the database to support the functions of the corresponding libraries, improving the development progress and the reliability of the database.
[0003] However, since the implementations of third-party libraries are generally different, it is necessary to adjust them after introducing the third-party libraries to adapt to the database project. This will involve a large number of modifications when introducing multiple third-party libraries, and the management of each third-party library is also very complex. However, when multiple third-party libraries need to be introduced simultaneously, the problems existing in each third-party library may be different. In this case, it is often difficult to maintain and reuse the code when calling third-party libraries. Moreover, as the number of third-party libraries increases, the management of third-party libraries will become more complex and difficult.
[0004] Therefore, how to provide a method to uniformly manage different third-party libraries is a problem that needs to be solved. Summary of the Invention
[0005] The present invention provides a method, system, device, equipment and storage medium for managing third-party libraries to solve the problem of difficult management of third-party libraries in the prior art.
[0006] According to one aspect of the present invention, there is provided a method for managing third-party libraries, which is applied to the connection function layer in the third-party library adaptation layer. The method includes:
[0007] Obtain one or more third-party libraries to be loaded by the database;
[0008] Analyze each of the third-party libraries respectively to determine the problems existing in each of the third-party libraries when adapting to the database;
[0009] Package the functions in each of the third-party libraries according to the problems corresponding to each third-party library to complete the loading of all third-party libraries.
[0010] According to another aspect of the present invention, there is provided a third-party library adaptation system. The third-party library adaptation system includes an external third-party library function layer and a third-party library adaptation layer in the database management layer. The third-party library adaptation layer includes the connection function layer according to any embodiment of the present invention and a function function layer. The connection function layer is respectively connected to the function function layer and the external third-party library function layer;
[0011] The connection function layer is used to encapsulate the functions of the third-party libraries in the external third-party library function layer;
[0012] The functional function layer is used to call the encapsulated third-party libraries through the security interfaces of the connection function layer to use the functions of the third-party libraries.
[0013] According to another aspect of the present invention, a third-party library management device is provided. The device includes:
[0014] An acquisition module, configured to acquire one or more third-party libraries to be loaded in the database;
[0015] An analysis module, configured to analyze each of the third-party libraries respectively to determine the problems existing in each of the third-party libraries when adapting to the database;
[0016] An encapsulation module, configured to encapsulate the functions in each of the third-party libraries according to the problems corresponding to each third-party library to complete the loading of all third-party libraries.
[0017] According to another aspect of the present invention, an electronic device is provided. The electronic device includes: at least one processor; and
[0018] A memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program executable by the at least one processor. When the computer program is executed by the at least one processor, the at least one processor is enabled to execute the third-party library management method according to any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores computer instructions, and the computer instructions are used to implement the third-party library management method according to any embodiment of the present invention when executed by a processor.
[0021] A third-party library management method, system, device, equipment and storage medium according to an embodiment of the present invention. The method includes: acquiring one or more third-party libraries to be loaded in the database; analyzing each of the third-party libraries respectively to determine the problems existing in each of the third-party libraries when adapting to the database; encapsulating the functions in each of the third-party libraries according to the problems corresponding to each third-party library to complete the loading of all third-party libraries. By analyzing the problems existing in the third-party libraries and encapsulating the third-party libraries according to the problems, this method can uniformly manage the third-party libraries and solve the problem of difficult management of third-party libraries in the prior art.
[0022] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become readily understood from the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0024] Figure 1 FIG. is a schematic flowchart of a third-party library management method provided in Embodiment 1 of the present invention;
[0025] Figure 2 FIG. is a schematic flowchart of a third-party library management method provided in an embodiment of the present invention;
[0026] Figure 3 FIG. is a schematic structural diagram of a third-party library adaptation system provided in Embodiment 2 of the present invention;
[0027] Figure 4 FIG. is a schematic structural diagram of a third-party library adaptation system provided in an embodiment of the present invention;
[0028] Figure 5 FIG. is a schematic structural diagram of a third-party library management device provided in Embodiment 3 of the present invention;
[0029] Figure 6 FIG. is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0030] In order to enable those skilled in the art to better understand the solutions of the present invention, the following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. It should be understood that the various steps recorded in the method embodiments of the present invention can be executed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present invention is not limited in this regard.
[0031] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0032] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present invention are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, any variations of the terms "including" and "having" are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0033] It should be noted that the modifications of "one" and "multiple" mentioned in the present invention are illustrative rather than restrictive. Those skilled in the art should understand that unless clearly specified otherwise in the context, it should be understood as "one or more".
[0034] The names of the messages or information exchanged between multiple devices in the embodiments of the present invention are only for illustrative purposes and do not limit the scope of these messages or information.
[0035] The handling of exception error reports by different third-party libraries is usually different. After being called in a database project, the error information may not be returned in the expected form; the memory management methods of different third-party libraries also have differences, and there may even be situations that cause memory leaks; at the same time, third-party libraries may have thread safety issues, and thread safety issues in a database may lead to very serious consequences. Therefore, third-party libraries with thread safety hazards can hardly be used in a database.
[0036] After introducing third-party library files into the current database project, for different problems, it is usually necessary to handle them separately. This handling method cannot effectively manage all third-party libraries, and it is difficult to trace the source of problems.
[0037] Embodiment 1
[0038] Figure 1The flowchart shows a method for managing third-party libraries provided in the first embodiment of the present invention. This method is applicable to the situation where a database calls a third-party library and encapsulates the third-party library. This method can be executed by a third-party library management device, which can be implemented by software and / or hardware and is generally integrated into an electronic device. In this embodiment, an interface function layer in a third-party library adaptation layer is provided on the electronic device.
[0039] As Figure 1 shown, a method for managing third-party libraries provided in the first embodiment of the present invention includes the following steps:
[0040] S110. Obtain one or more third-party libraries to be loaded by the database.
[0041] Among them, the database can be a relational database, a non-relational database, or other databases. A third-party library can be a module with specific functions released by other third-party institutions.
[0042] In this embodiment, one or more third-party libraries required by the database can be obtained.
[0043] S120. Analyze each of the third-party libraries separately to determine the problems existing in each of the third-party libraries when adapting to the database.
[0044] Among them, the problems existing in different third-party libraries may be the same or different. The problems existing in the third-party libraries in this embodiment can be classified into the following types: thread safety problems, memory management problems, and exception reporting problems. Analyzing the third-party library can specifically be analyzing the functions in the third-party library, and the specific analysis method can be manual or automatic. For example, when determining whether a third-party library has thread safety problems, the use of global variables, pipes, shared variables, etc. in the third-party library can be analyzed.
[0045] In this embodiment, the third-party libraries can be analyzed to determine the problems that may exist in the third-party libraries when adapting to the database. Exemplarily, taking the Topology Relation Operation Utility Library (Geometry Engine - Open Source, GEOS), proj library, and Light-weight geometry (lwgeom) library, which are often used to develop functions related to geometric graphics and geographic data, as examples, the functions of the geos library have thread safety problems, and the error reporting mechanism needs to be processed separately; while the proj library and the geos library have the same thread safety problems, but the error reporting mechanism is different from that of the geos library; the lwgeom library mainly has memory management problems and exception reporting problems.
[0046] S130. Encapsulate the functions in each of the third - party libraries according to the problems corresponding to each third - party library to complete the loading of all third - party libraries.
[0047] Among them, encapsulation can be a process of defining a class, encapsulating data and related operations inside the class, and providing public interfaces to the outside to access and operate on the data. Through encapsulation, information hiding can be achieved, and the maintainability of the code can be improved.
[0048] In this embodiment, for the problems existing in the third - party libraries, different methods can be used to encapsulate the functions in the third - party libraries, so as to obtain the encapsulated third - party libraries and complete the loading of all third - party libraries.
[0049] A method for managing third - party libraries provided in Embodiment 1 of the present invention includes: obtaining one or more third - party libraries to be loaded in a database; analyzing each of the third - party libraries separately to determine the problems existing in each of the third - party libraries when adapting to the database; encapsulating the functions in each of the third - party libraries according to the problems corresponding to each third - party library to complete the loading of all third - party libraries. This method can uniformly manage third - party libraries by analyzing the problems existing in third - party libraries and encapsulating the third - party libraries according to the problems, and solves the problem of difficult management of third - party libraries in the prior art.
[0050] Based on the above - mentioned embodiment, a variant embodiment of the above - mentioned embodiment is proposed. Here, it should be noted that for the sake of brief description, only the differences from the above - mentioned embodiment are described in the variant embodiment.
[0051] In one embodiment, when the problems existing in the third - party library include thread - safety problems, encapsulating the functions in the third - party library includes: determining whether the third - party library provides a thread - local storage function; if so, directly encapsulating the functions in the third - party library, otherwise encapsulating the functions in the third - party library through a lock mechanism.
[0052] Among them, the thread - safety problem may refer to the problem that when multiple threads access shared resources concurrently, the correctness and consistency of the program cannot be guaranteed. When multiple threads operate on the same data simultaneously, without appropriate control measures, data inconsistency or unpredictable behavior may occur. Thread - Local Storage (TLS) is a mechanism set for the consideration that each thread in a multi - threaded process itself needs to maintain some states. Each thread in a given multi - threaded process can use this method to allocate a location for storing thread - specific data. The lock mechanism is a method to ensure data consistency and thread safety in multi - threaded programming. The lock mechanism can make it so that at a certain moment, only one thread can access the shared resource or the critical - section code. Other threads must wait for the release of the lock before they can compete for the lock again.
[0053] In this embodiment, when there are thread safety issues in the third-party library, it can be determined whether the third-party library provides the function of thread-local storage. If so, it means that the third-party library can solve the thread safety problem through the dynamic TLS method, and then the functions in the third-party library can be directly encapsulated; otherwise, mechanisms such as lock mechanisms or mutexes need to be added when encapsulating the functions.
[0054] In one embodiment, when the problems existing in the third-party library include memory management problems, encapsulating the functions in the third-party library includes: determining whether the third-party library provides a method for setting a callback function; if so, encapsulating the memory processing functions in the third-party library through the callback function; if not, encapsulating the functions in the third-party library through overloaded functions.
[0055] Among them, memory management problems can refer to problems such as the inability to effectively allocate, use, and release memory. A callback function can refer to a function that is passed as a parameter to another function and is called and executed when a specific event occurs or a condition is met. A memory processing function can be a function library for managing memory resources.
[0056] In this embodiment, when there are memory management problems in the third-party library, it can be determined whether the third-party library provides a method for setting a callback function. If so, the memory processing functions in the third-party library can be encapsulated through the callback function; if not, the functions in the third-party library need to be encapsulated through overloaded functions. For example, for a third-party library with C++ as the main language, the way of overloaded functions can be to overload the new and delete methods in each base class.
[0057] In one embodiment, encapsulating the memory processing functions in the third-party library through the callback function includes: finding the pointers of the memory processing functions in the third-party library and the pointers of the memory processing functions in the database through the callback function; replacing the memory processing functions in the third-party library with the memory processing functions in the database through the pointers of the memory processing functions in the third-party library and the pointers of the memory processing functions in the database.
[0058] Among them, a pointer can refer to a memory address.
[0059] In this embodiment, when the third-party library sets a memory processing function, it means that it allows the caller to pass in its own memory processing function. Then, the pointers of the memory processing functions in the third-party library and the pointers of the memory processing functions in the database can be found through the callback function. Through their respective pointers, the memory processing functions in the third-party library can be replaced with the memory processing functions in the database.
[0060] In one embodiment, when the problems existing in the third-party library include abnormal error reporting problems, encapsulating the functions in the third-party library includes: determining whether the third-party library provides an exception handling function; if so, directly encapsulating the functions in the third-party library, otherwise encapsulating the functions in the third-party library by setting a jump mechanism.
[0061] Among them, the abnormal error reporting problem can be a problem related to error handling during program operation. The jump mechanism can be a method that enables a program to jump from one function to another function according to conditions or direct instructions. The exception handling function can be a specific code structure used to capture and handle exception situations that occur during program operation.
[0062] In this embodiment, when there are abnormal error reporting problems in the third-party library, it can be determined whether the third-party library provides an exception handling function. If so, the functions in the third-party library can be directly encapsulated. Otherwise, a jump mechanism needs to be set to solve the abnormal error reporting problems existing in the third-party library.
[0063] In one embodiment, encapsulating the functions in the third-party library by setting a jump mechanism includes: setting an error reporting function for the third-party library; setting a jump mechanism for the function at the error reporting position in the third-party library, and the jump mechanism is to jump to the error reporting function when an error occurs.
[0064] Among them, the error reporting function can be a function used for error reporting. The process of the jump mechanism is to jump to the error reporting function when an error occurs.
[0065] In this embodiment, a jump mechanism can be set for a third-party library without an exception handling function, that is, an error reporting function is set for the third-party library, and a jump mechanism is set for the function at the error reporting position in the third-party library.
[0066] Exemplarily, Figure 2 is a schematic flowchart of a method for managing a third-party library provided by an embodiment of the present invention, as Figure 2As shown, it is possible to determine whether there are thread safety issues, memory management issues, and exception reporting issues in the third-party library. Taking the geos library, proj library, and lwgeom library as examples, after adopting the method of unified management of the third-party library adaptation layer, after introducing the geos library into the adaptation layer, for thread safety issues, the thread-safe interfaces provided by the geos library can be used; for exception reporting issues, a callback function can be set for exception reporting. After introducing the proj library, the same method can be used to handle thread safety issues. For exception reporting issues, since the proj library provides functions specifically for handling error messages, the error messages can be directly called to obtain and then report exceptions. After introducing the lwgeom library, the dynamic tls mechanism can be used to solve thread safety issues, and the callback function method can be used to handle memory issues.
[0067] Embodiment 2
[0068] Figure 3 FIG. is a schematic structural diagram of a third-party library adaptation system provided by Embodiment 2 of the present invention. For details not described in this embodiment, please refer to Embodiment 1. As Figure 3 shown, a third-party library adaptation system provided by Embodiment 2 of the present invention includes an external third-party library function layer 10 and a third-party library adaptation layer 200 in the database management layer 20. The third-party library adaptation layer 200 includes an interface function layer 201 and a functional function layer 202. The interface function layer 201 is respectively connected to the functional function layer 202 and the external third-party library function layer 10;
[0069] The interface function layer 201 is used to encapsulate the functions of the third-party library in the external third-party library function layer 10;
[0070] The functional function layer 202 is used to call the encapsulated third-party library through the security interface of the interface function layer 201 to use the functions of the third-party library.
[0071] Among them, the external third-party library function layer 10 may include different third-party libraries. The database management layer 20 may be a module for managing the database, and the database management layer 20 may be a Database Management System (DBMS). The third-party library adaptation layer 200 may be a module for processing the third-party library. The interface function layer 201 may be a module for processing and encapsulating the third-party library, and the functional function layer 202 may be a module for calling the functions of the third-party library.
[0072] In this embodiment, a third-party library adaptation layer can be added to the database project, and the third-party libraries are uniformly managed through the third-party library adaptation layer. The connection function layer 201 can obtain the third-party libraries in the external third-party library function layer 10, encapsulate the functions of the third-party libraries, and the functional function layer 202 can call the encapsulated third-party libraries through the security interface of the connection function layer 201, so as to use the functions of the third-party libraries.
[0073] Exemplarily, Figure 4 FIG. is a schematic structural diagram of a third-party library adaptation system provided by an embodiment of the present invention. As Figure 4 shown, the external third-party library function layer may include multiple third-party libraries, such as GEOS, Proj, etc. The functional function layer may also be connected to the internal functions. When the corresponding functions need to be executed, the functional function layer may call the internal functions to execute the internal functions of the database, and execute the functions of the third-party libraries by calling the connection function layer.
[0074] In this embodiment, by adopting a vertical layered structure, only the functional function layer is provided for the database project to use. The connection function layer encapsulates the third-party library functions, and the functional function layer indirectly calls the third-party libraries by calling the security interface provided by the connection function layer, which can solve the problems such as thread safety, memory management, and error reporting and exceptions existing when directly calling the third-party library functions.
[0075] A third-party library adaptation system provided by Embodiment 2 of the present invention includes an external third-party library function layer and a third-party library adaptation layer in the database management layer. The third-party library adaptation layer includes a connection function layer and a functional function layer. The connection function layer is respectively connected to the functional function layer and the external third-party library function layer; the connection function layer is used to encapsulate the functions of the third-party libraries in the external third-party library function layer; the functional function layer is used to call the encapsulated third-party libraries through the security interface of the connection function layer to use the functions of the third-party libraries. By separately solving the problems of each third-party library and uniformly managing them in the third-party library adaptation layer, the management difficulty and maintenance cost of the third-party libraries are reduced, and it is easy to introduce new third-party libraries and update and modify the existing third-party libraries, solving the problem of difficult management of third-party libraries in the prior art.
[0076] Embodiment 3
[0077] Figure 5 FIG. is a schematic structural diagram of a third-party library management device provided by Embodiment 3 of the present invention. This device is applicable to the situation where the database calls a third-party library and encapsulates the third-party library. The device can be implemented by software and / or hardware and is generally integrated on an electronic device.
[0078] As Figure 5 shown, the device includes:
[0079] An acquisition module 310, configured to acquire one or more third-party libraries to be loaded into the database;
[0080] An analysis module 320, configured to analyze each of the third-party libraries respectively to determine problems existing in each of the third-party libraries when adapting to the database;
[0081] An encapsulation module 330, configured to encapsulate functions in each of the third-party libraries according to the problems corresponding to each third-party library, so as to complete the loading of all the third-party libraries.
[0082] This embodiment provides a third-party library management device, including: an acquisition module, configured to acquire one or more third-party libraries to be loaded into the database; an analysis module, configured to analyze each of the third-party libraries respectively to determine problems existing in each of the third-party libraries when adapting to the database; an encapsulation module, configured to encapsulate functions in each of the third-party libraries according to the problems corresponding to each third-party library, so as to complete the loading of all the third-party libraries. By analyzing the problems existing in the third-party libraries and encapsulating the third-party libraries according to the problems, the third-party libraries can be uniformly managed, and the problem of difficult management of third-party libraries in the prior art is solved.
[0083] Further, when the problems existing in the third-party libraries include thread safety problems, the encapsulation module 330 includes:
[0084] Judge whether the third-party library provides a thread local storage function;
[0085] If so, directly encapsulate the functions in the third-party library, otherwise encapsulate the functions in the third-party library through a lock mechanism.
[0086] Further, when the problems existing in the third-party libraries include memory management problems, the encapsulation module 330 includes:
[0087] Judge whether the third-party library provides a callback function setting;
[0088] If so, encapsulate the memory processing functions in the third-party library through the callback function;
[0089] If not, encapsulate the functions in the third-party library through overloaded functions.
[0090] Further, the encapsulating the memory processing functions in the third-party library through the callback function includes:
[0091] Find the pointers of the memory processing functions in the third-party library and the pointers of the memory processing functions in the database through the callback function;
[0092] Replace the memory processing function in the third-party library with the memory processing function in the database through the pointer of the memory processing function in the third-party library and the pointer of the memory processing function in the database.
[0093] Further, when the problems existing in the third-party library include exception reporting problems, the encapsulation module 330 includes:
[0094] Determine whether the third-party library provides an exception handling function;
[0095] If so, directly encapsulate the functions in the third-party library, otherwise encapsulate the functions in the third-party library by setting a jump mechanism.
[0096] Further, the encapsulating the functions in the third-party library by setting a jump mechanism includes:
[0097] Set an error reporting function for the third-party library;
[0098] Set a jump mechanism for the function at the error reporting position in the third-party library, and the jump mechanism is to jump to the error reporting function when an error occurs.
[0099] The above third-party library management device can execute the third-party library management method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the method.
[0100] Embodiment 4
[0101] Figure 6 FIG. shows a schematic structural diagram of an electronic device 10 that can be used to implement the embodiments of the present invention. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0102] As Figure 6As shown, the electronic device 10 includes at least one processor 11 and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. The memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0103] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disc, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0104] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include but are not limited to a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the third-party library management method.
[0105] In some embodiments, the third-party library management method can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the third-party library management method described above can be executed. Alternatively, in other embodiments, the processor 11 can be configured to execute the third-party library management method by any other appropriate means (e.g., by means of firmware).
[0106] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.
[0107] The computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0108] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0109] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) through which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0110] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
[0111] The computing system can include a client and a server. The client and the server are generally far from each other and usually interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system, solving the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0112] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in the present invention can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is imposed herein.
[0113] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims
1. A third-party library management method, characterized in that: Applied to the connection function layer in the third-party library adaptation layer, the method includes: Get one or more third-party libraries to be loaded into the database; Analyze each of the third-party libraries respectively to determine problems existing in each of the third-party libraries when adapting the database; According to the problems corresponding to each third-party library, the functions in each third-party library are encapsulated to complete the loading of all third-party libraries.
2. The method according to claim 1, characterized in that When the problem existing in the third-party library includes a thread safety problem, encapsulating the functions in the third-party library includes: Determine whether the third-party library provides a thread local storage function; If so, the function in the third-party library is directly encapsulated, otherwise the function in the third-party library is encapsulated through a lock mechanism.
3. The method according to claim 1, characterized in that When the problem existing in the third-party library includes a memory management problem, encapsulating the functions in the third-party library includes: Determine whether the third-party library provides a setting callback function; If so, encapsulate the memory processing function in the third-party library through the callback function; If not, the function in the third-party library is encapsulated by overloading the function.
4. The method according to claim 3, characterized in that The encapsulating the memory processing function in the third-party library by using the callback function includes: Searching for a pointer to a memory processing function in the third-party library and a pointer to a memory processing function in the database through a callback function; The memory processing function in the third-party library is replaced with the memory processing function in the database through the pointer of the memory processing function in the third-party library and the pointer of the memory processing function in the database.
5. The method according to claim 1, characterized in that When the problem existing in the third-party library includes an abnormal error problem, encapsulating the functions in the third-party library includes: Determine whether the third-party library provides an exception handling function; If so, the function in the third-party library is directly encapsulated; otherwise, the function in the third-party library is encapsulated by setting a jump mechanism.
6. The method according to claim 5, characterized in that The encapsulating the function in the third-party library by setting a jump mechanism includes: Setting an error reporting function for the third-party library; A jump mechanism is set for a function at an error reporting position in the third-party library, and the jump mechanism jumps to the error reporting function when an error is reported.
7. A third-party library adaptation system, characterized in that: The third-party library adaptation system includes an external third-party library function layer and a third-party library adaptation layer in a database management layer, wherein the third-party library adaptation layer includes a connection function layer as described in claims 1-6 and a functional function layer, wherein the connection function layer is connected to the functional function layer and the external third-party library function layer respectively; The connection function layer is used to encapsulate the functions of the third-party library in the external third-party library function layer; The functional function layer is used to call the encapsulated third-party library through the security interface of the connection function layer to use the functions of the third-party library.
8. A third-party library management device, characterized in that: The device comprises: An acquisition module is used to acquire one or more third-party libraries to be loaded into the database; An analysis module, used to analyze each of the third-party libraries respectively to determine problems existing in each of the third-party libraries when adapting the database; The encapsulation module is used to encapsulate the functions in each third-party library according to the problem corresponding to each third-party library, so as to complete the loading of all third-party libraries.
9. An electronic device, characterized in that: The device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the third-party library management method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the third-party library management method according to any one of claims 1 to 6 when executed.