View library configuration method, view library platform, system and storage medium
Through the dynamic proxy and modular processing of the view library configuration method, the code structure confusion problem of low-code solutions in the development of complex business logic and interfaces is solved, the rapid configuration and efficient development of the view library are realized, and the development efficiency and availability are improved. Maintainability.
Patent Information
- Application Number
- CN202410818322.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-09-17
AI Technical Summary
When faced with the development of complex business logic and interfaces, existing low-code solutions lack a unified architectural guiding ideology and systematic integration strategy, resulting in chaotic code structure, low development efficiency, and difficulty in maintenance, which affects the maintainability and stability of the project. Scalability.
By providing a view library configuration method, using dynamic proxy and modular processing, the interface data processing process is modularized to form module code blocks corresponding to each interface type, determine the corresponding relationship between the interface and module code blocks, and implement the interface Modular and rapid configuration, reducing duplicate code and improving development efficiency and maintainability.
It realizes the modular and rapid configuration of the view library, shortens the development cycle, improves development efficiency, reduces the difficulty and cost of later maintenance, and enhances the sustainable development capability of the project.
Smart Images

Figure CN118656377A
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of view libraries, and in particular to a view library configuration method, a view library platform, a system and a storage medium. Background Art
[0002] In today's rapidly developing information society, the pace of enterprise informatization construction is accelerating, especially in the field of software development, where the requirements for development efficiency and cost control are becoming more stringent. Traditional software development models often face problems such as large amounts of code, long development cycles, and difficulties in later maintenance. Especially when faced with frequently changing business needs, a lot of manpower and material resources are often consumed for code reconstruction and updating. From demand analysis, design, coding, testing to online launch, each link requires a lot of time and human resources, resulting in slow product iteration and difficulty in adapting to the ever-changing market rhythm. With the development of low-code development platform concepts and technologies, more and more companies are beginning to seek to lower development barriers, improve development efficiency, and simplify maintenance work through highly configurable methods.
[0003] However, most existing low-code solutions are limited to the configuration of some functional modules such as form design and process building, and a lot of manual coding is still required for complex business logic and interface development. Long-term reliance on such local low-code solutions, if there is a lack of unified architectural guidance and systematic integration strategies, may cause the code structure to gradually become chaotic and disordered. Low-code development, which was originally intended to improve efficiency and simplify maintenance, may introduce new complexities during the project evolution process, making the base code increasingly bloated and difficult to control, ultimately affecting the maintainability and scalability of the overall project.
[0004] The view library service framework based on the GA / T 1400 standard mainly provides services to the outside world through interfaces, covering seventy or eighty object types and hundreds of interfaces. However, it has a unified set of standards, and the data structures of all objects are highly similar. This project is very suitable for this configurable project architecture. However, due to the specificity of the view library service itself, most similar view library service frameworks on the market are still implemented in a hard-coded manner. This implementation method not only increases the workload of early development, but also significantly reduces the efficiency of later functional iterations. Summary of the invention
[0005] In view of the problems in the prior art, the purpose of this application is to provide a view library configuration method, a view library platform, a system and a storage medium, which realize the modular and rapid configuration of the view library and shorten the development cycle.
[0006] The present application provides a method for configuring a view library, including the following steps:
[0007] Receive a request for adding a new interface, wherein the request for adding a new interface includes an interface type of the new interface;
[0008] Create a new interface according to the newly added interface request, and establish a proxy relationship between the newly added interface and the module code block according to the interface type of the newly added interface;
[0009] When receiving a data processing request from an interface, determining whether a proxy instance corresponding to the interface sending the request is stored in the local cache;
[0010] If yes, calling the proxy instance in the local cache to forward the data processing request to the module code block corresponding to the interface;
[0011] If not, forwarding the data processing request to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and generating a proxy instance based on the proxy logic and storing it in the local cache;
[0012] Wherein, the module code block is configured to execute pre-stored data processing logic in response to the data processing request.
[0013] By adopting the view library configuration method of the present application, the process of interface data processing is modularized to form module code blocks corresponding to each interface type. When a new interface is added, the corresponding relationship between the interface and the module code block is determined. When a data processing request is received, the request is forwarded to the module code block to execute the pre-stored data processing logic to achieve the corresponding logic processing effect, thereby realizing modular and rapid configuration of the interface, improving the efficiency of view library development, and shortening the view library development cycle. By adopting this method, when forwarding the data processing request to the module code block, for the proxy reflection that has been executed before, the pre-stored proxy instance can be called directly from the local cache, without having to re-execute the reflection mechanism based on the dynamic proxy each time, which greatly reduces the performance overhead of each subsequent call to the module code block, and does not affect the loss of view library performance while ensuring the modular configuration of the interface.
[0014] In some embodiments, the interface type includes at least a data acquisition interface, and the data processing request includes at least a collection data upload request;
[0015] After a data collection data upload request of a data collection interface is sent to a corresponding module code block, the module code block is configured to execute the following steps:
[0016] Parsing the collected data upload request to obtain the data to be uploaded, calling a verification instance pre-stored in a local cache, and performing data verification on the data to be uploaded based on the verification instance, where the verification instance is pre-compiled from a data verification script;
[0017] After the verification is passed, the data to be uploaded is uploaded to the specified location.
[0018] In some embodiments, the interface type includes at least a data acquisition interface, and the data processing request includes at least a collection data upload request;
[0019] After a data collection data upload request of a data collection interface is sent to a corresponding module code block, the module code block is configured to execute the following steps:
[0020] Parsing the collected data upload request to obtain the data to be uploaded, and determining whether the data to be uploaded is unstructured data;
[0021] If the data to be uploaded is unstructured data, storing the data to be uploaded in a cloud storage platform;
[0022] If the data to be uploaded is structured data, the data to be uploaded is uploaded to the big data stream computing platform through a distributed publish-subscribe message system.
[0023] In some embodiments, the interface type includes at least a data query interface, and the data processing request includes at least a data query request;
[0024] After a data query request of a data query interface is sent to a corresponding module code block, the module code block is configured to execute the following steps:
[0025] Obtaining a query string and a request body from the data query request;
[0026] Determine the type of query data according to the data query request, and determine a database corresponding to the type of query data;
[0027] Based on a pre-stored underlying general translation library, the query string and the request body are translated into standard database query language instructions;
[0028] Send a query request to the corresponding database based on the database query language instruction.
[0029] In some embodiments, sending a query request to the corresponding database includes the following steps:
[0030] Determine whether there is a query instance corresponding to the database query language instruction in the local cache;
[0031] If yes, then executing the query instance and sending a query request to the corresponding database;
[0032] Wherein, when sending a query request to the corresponding database, determining whether there are multiple query requests of the same type;
[0033] If yes, the multiple query requests of the same type are merged into one batch query request, and sent to the corresponding database.
[0034] The embodiment of the present application further provides a view library platform for implementing the view library configuration method, the platform comprising:
[0035] An interface configuration module, for receiving a request for a new interface, the request for a new interface including an interface type of the new interface; and for creating a new interface according to the request for the new interface, and establishing a proxy relationship between the new interface and a module code block according to the interface type of the new interface;
[0036] A request processing module is used to determine whether a proxy instance corresponding to the interface sending the request is stored in a local cache when a data processing request of an interface is received; if so, the proxy instance in the local cache is called to forward the data processing request to the module code block corresponding to the interface; if not, the data processing request is forwarded to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and a proxy instance is generated based on the proxy logic and stored in the local cache; wherein the module code block is configured to execute pre-stored data processing logic in response to the data processing request.
[0037] By adopting the view library platform provided by the present application, each module thereof can implement the steps of the configuration method, thereby obtaining the beneficial effects of the above configuration method.
[0038] The present application also provides a view library system, including:
[0039] The view library platform;
[0040] The cloud storage platform is used to provide a data transmission interface and receive the unstructured data uploaded by the view library platform through the data transmission interface;
[0041] A big data stream computing platform, used for receiving and processing structured data uploaded by the view library platform;
[0042] The database is used to store the storage address of unstructured data in the cloud storage platform and the data processed by the big data stream computing platform.
[0043] By adopting the view library system provided by the present application, each module thereof can implement the steps of the configuration method, thereby obtaining the beneficial effects of the configuration method described above.
[0044] In some embodiments, the cloud storage platform is preset with modular storage services corresponding to multiple storage methods. The cloud storage platform is also used to deploy corresponding modular storage services according to the storage method configuration information corresponding to the view library platform, and instantiate the deployed modular storage services to obtain storage service instances;
[0045] The cloud storage platform is also used to call the storage service instance to store the unstructured data after receiving the unstructured data uploaded by the view library platform through the data transmission interface.
[0046] In some embodiments, at least one service in the view library system is implemented through multiple service nodes, and each of the service nodes is configured to send an update notification to other service nodes of the same service type after a configuration update, and to perform a configuration update based on the update notification when receiving an update notification from other service nodes; the view library system is also used to perform update consistency verification on service nodes of the same service type when a service node configuration is updated.
[0047] The embodiment of the present application also provides a computer-readable storage medium for storing a program, and when the program is executed by a processor, the steps of the configuration method are implemented.
[0048] By adopting the computer-readable storage medium provided in the present application, the program stored therein implements the steps of the configuration method when being executed, thereby obtaining the beneficial effects of the above configuration method. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings.
[0050] Figure 1 is a flowchart of a method for configuring a view library according to an embodiment of the present application;
[0051] Figure 2 It is a schematic diagram of an interface configuration page of this application;
[0052] Figure 3 is a structural diagram of a view library system according to an embodiment of the present application;
[0053] Figure 4 is a schematic diagram of the working process of the view library system of an embodiment of the present application;
[0054] Figure 5 It is a schematic diagram of the structure of a computer storage medium according to an embodiment of the present application. DETAILED DESCRIPTION
[0055] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this application will be comprehensive and complete and the concepts of the example embodiments will be fully conveyed to those skilled in the art. The same reference numerals in the figures represent the same or similar structures, and thus their repeated description will be omitted. Although "first" or "second" etc. are used in this specification to represent certain features, they are only used to represent the function and are not used as a limitation on the number and importance of specific features.
[0056] like Figure 1 As shown, in one embodiment, the present application provides a view library configuration method, which is implemented by a view library platform, and the method includes the following steps:
[0057] S100: receiving a request for adding a new interface, where the request for adding a new interface includes an interface type of the new interface;
[0058] In this embodiment, an interface configuration page is provided in the view library platform. Figure 2 exemplarily shows a schematic diagram of an interface configuration page, wherein each gateway corresponds to an interface. When adding a new interface, a request for adding a new interface can be initiated in the interface configuration page, such as Figure 2 In the right part of the middle view, you can configure the relevant parameters of the interface, such as configuring the gateway name, gateway description, gateway parameter verification logic, etc. The interface configuration page can also display the list of gateways corresponding to the previously added interfaces, such as gateways including "data classification label", "checkpoint", "device status", etc. Interface types include data acquisition interface and data query interface. The data acquisition interface can upload the data collected by the acquisition device to the cloud server platform or the big data stream computing platform through the view library platform, while the data query interface can query the data stored in the database through the view library platform. Users can also further select the gateway that needs to be modified in the interface configuration page and modify the interface configuration information corresponding to the gateway. Users can directly add and configure interfaces through the interface configuration page without any code development, which is more agile and flexible.
[0059] S200: creating a new interface according to the new interface request, and establishing a proxy relationship between the new interface and the module code block according to the interface type of the new interface;
[0060] The module code blocks are some pre-stored code blocks that modularize the data processing logic. In this embodiment, the data processing logic of all interfaces is classified according to the interface type according to the GA / T 1400 standard, thereby avoiding redundant codes and reducing the subsequent iteration and maintenance costs. Each interface type corresponds to at least one module code block. Optionally, each interface type and the module code block are in a one-to-one correspondence or a one-to-many relationship, but the present application is not limited thereto.
[0061] S300: upon receiving a data processing request from an interface, determining whether a proxy instance corresponding to the interface sending the request is stored in the local cache;
[0062] If yes, then S400: calling the proxy instance in the local cache to forward the data processing request to the module code block corresponding to the interface;
[0063] Therefore, the proxy logic that has been executed by the reflective proxy before has been pre-stored in the local cache Treadlocal (thread local cache) and can be called directly from the cache;
[0064] If not, then S500: forward the data processing request to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and generate a proxy instance based on the proxy logic and store it in the local cache; in this embodiment, the reflection mechanism refers to using a proxy to wrap the object, and then replacing the original object (module code block) with the proxy object. Any call to the module code block must go through the proxy object. The proxy object determines whether and when to transfer the method call to the module code block. Dynamic proxy refers to dynamically generating a proxy object at runtime, and the proxy object can replace the call made by the original object. Through dynamic proxy, software developers can enhance, intercept and control the original object without modifying the original object. Therefore, the reflection mechanism based on dynamic proxy can make the call and control of the module code block more flexible and simple. Therefore, after this type of proxy reflection is executed once, a proxy instance is generated and stored in the local cache. When the same type of proxy needs to be executed later, it can be called directly from the local cache without executing the reflection mechanism based on the dynamic proxy again, thereby solving the performance loss problem caused by calling the reflection mechanism based on the dynamic proxy every time a request is forwarded.
[0065] The module code block is configured to execute pre-stored data processing logic in response to the forwarded data processing request after receiving the forwarded data processing request.
[0066] By adopting the view library configuration method of the present application, the process of interface data processing is modularized to form module code blocks corresponding to each interface type. When a new interface is added, the corresponding relationship between the interface and the module code block is determined. When a data processing request is received, the request is forwarded to the module code block to execute the pre-stored data processing logic to achieve the corresponding logic processing effect, thereby realizing modular and rapid configuration of the interface. There is no need to develop the logic processing code corresponding to the interface each time a new interface is added, realizing low-code development and deployment, improving the efficiency of view library development, and shortening the view library development cycle. By adopting this method, when forwarding the data processing request to the module code block, for the proxy reflection that has been executed before, the pre-stored proxy instance can be called directly from the local cache, without having to re-execute the reflection mechanism based on the dynamic proxy each time, which greatly reduces the performance overhead of each subsequent call to the module code block. While ensuring the modular configuration of the interface, it will not affect the loss of view library performance.
[0067] This embodiment can complete the design and implementation of various interfaces by providing an intuitive and easy-to-understand interface configuration interface, without the need to manually write a large amount of interface code, reducing the ability requirements for developers, reducing the manpower investment required for view library system development, shortening the development cycle, and also greatly reducing the difficulty and cost of subsequent maintenance, thereby improving the sustainable development capabilities of the overall view library system.
[0068] In this embodiment, the interface type at least includes a data acquisition interface, and the data processing request at least includes a collection data upload request. In step S300, when a data processing request of an interface is received, if the request is a collection data upload request sent by the data acquisition interface, after sending the collection data upload request to the module code block corresponding to the data acquisition interface, the module code block is configured to execute the following steps:
[0069] Parsing the collected data upload request to obtain the data to be uploaded, calling a verification instance pre-stored in a local cache, and performing data verification on the data to be uploaded based on the verification instance, where the verification instance is pre-compiled from a data verification script;
[0070] In this embodiment, in order to ensure the universality of data verification codes for different interface objects, a data verification script is implemented based on jsonschema. The verification logic in the json schema data verification script is also pre-configured, and the user does not need to modify or add any code. json schema is a commonly used json data verification specification. In order to ensure that the performance is not affected under high concurrency, a pre-compilation optimization method is adopted here to pre-compile the json schema script into a verification instance JSONValidator in advance and store it in the local cache, thereby avoiding the performance loss caused by re-parsing the json schema script every time the data is verified, and greatly improving the performance of the collected data processing. JSONValidator is an open source project developed and maintained by Mirego, which makes it easy to verify the database fields of JSON type in Rails applications.
[0071] After the verification is passed, the data to be uploaded is uploaded to the specified location.
[0072] In this embodiment, not only can the data be verified based on the verification instance when the data to be uploaded is obtained. After the user adds a new interface through the interface configuration interface, the configuration data of the newly added interface can also be verified through the interface verification instance. Similarly, the interface verification instance can be a JSONValidator instance that is pre-compiled based on the json schema data verification script and stored in the local cache. By instantiating the logic of the interface verification, it is also possible to avoid re-parsing the json schema script after each new interface is added, thereby improving the efficiency of the interface verification.
[0073] Specifically, uploading the data to be uploaded to a designated location includes the following steps:
[0074] Determining whether the data to be uploaded is unstructured data;
[0075] If the data to be uploaded is unstructured data (such as pictures, videos, etc.), the data to be uploaded is stored in a cloud storage platform;
[0076] If the data to be uploaded is structured data, the data to be uploaded is uploaded to the big data stream computing platform through a distributed publish-subscribe message system.
[0077] In this embodiment, the distributed publish-subscribe messaging system is, for example, Kafka. Kafka, as a buffer, can help the view library cope with traffic peaks by temporarily storing redundant requests, smoothing the load, and preventing service overload, thereby achieving the effect of shaving peaks and filling valleys, and can meet the performance of writing data with high concurrency and high throughput of tens of thousands per second.
[0078] In this embodiment, the interface type includes at least a data query interface, and the data processing request includes at least a data query request. In step S300, when a data processing request of an interface is received, if the request is a data query request sent by the data query interface, after sending the data query request to the module code block corresponding to the data query interface, the module code block is configured to perform the following steps:
[0079] Obtain a query string QueryString and a request body RequestBody from the data query request;
[0080] In this embodiment, a unified standard query syntax is defined in the view library platform according to the GA / T1400 standard, and there is a set of agreed variable names for the query string and the request body as shown in Table 1 below;
[0081] Table 1 Conventional variable names and meanings
[0082]
[0083] Example 1: Find records of people with a height between 1.60m and 1.70m and carrying red bags. Return results sorted by upper age limit and only return the PersonID and SourceID attributes.
[0084] GET / VIID / Persons? ((Person.HeightUpLimit<=170)AND(Person.HeightLowerLimit>=160))&(Person.BagColor=Red)&(Sort=Person.AgeUpLimit)&(Fields=(PersonID,SourceID))
[0085] Example 2: Search for personnel information, query only the first 200 records, 25 records per page, return starting from the first record, sort by upper age limit, and return all attributes.
[0086] GET / VIID / Persons? (MaxNumRecordReturn=200)&(PageRecordNum=25)&(Record StartNo=1)&(Sort=Person.AgeUpLimit)
[0087] Determine the type of query data according to the data query request, and determine a database corresponding to the type of query data;
[0088] In this embodiment, cold data and hot data are distinguished on the database side. Hot data refers to data in the most recent period of time, while cold data refers to data before that. For example, based on a three-month boundary, hot data refers to data in the most recent three months, while cold data refers to data before that three months. Hot data is stored in the ES database, while cold data is stored in the big data cluster. When the type of the queried data is hot data, a data query request in the DSL language needs to be sent to the ES database. When the type of the queried data is cold data, a data query request in the SQL language needs to be sent to the ES database. The full name of the ES database in English is Elstic Search, which is a distributed search and analysis engine at the core of the Elastic Stack. It is a highly scalable, full-text retrieval and analysis engine system open sourced by Apache, which can accurately and quickly store, search and analyze massive amounts of data. By distinguishing the storage media of hot data and cold data, this embodiment achieves an effective balance between query performance, cost and data management without the user's perception.
[0089] Based on a pre-stored underlying general translation library, the query string and the request body are translated into standard database query language instructions;
[0090] In this embodiment, in order to meet the requirements of view library retrieval scenarios and universality for various interface objects, a set of druid-based underlying translation general libraries is pre-stored in the view library, which is used to encode the query string and request body of the data query request and translate them into standard SQL statements or DSL statements, thereby translating the query string and request body sent by the browser into a language that the database can recognize, so that the browser and the database can interact directly, greatly reducing the amount of business code in the intermediate links;
[0091] When translating into standard database query language instructions here, it is necessary to determine whether the query language type is an SQL statement or a DSL statement according to the type of database, and then translate it into a standard database query language instruction of the corresponding query language type; wherein, druid is a database connection pool on Alibaba's open source platform, and the underlying design of druid has an underlying translation general library. Here, an innovative method for translating data query requests based on druid's underlying translation general library is proposed. Specifically, the query string and request body are translated into standard database query language instructions, including: after the query string QueryString and request body RequestBody in the data query request are formatted according to the data structure that druid can recognize, the filter conditions and query conditions in the data query request are filtered out by the druid parser (parser), and then the filtered filter conditions and query conditions are rearranged and combined into standard database query language instructions of SQL statements or DSL statements; thus, when receiving a data query request from the interface, the standard database query language instruction can be directly translated and queried to the database, which can be compatible with data query requests of various formats, and realize fast and standardized translation of data query requests;
[0092] A query request is sent to the corresponding database based on the database query language instruction; when sending the query request, the data table in the database where the data is specifically stored can also be determined according to the information of the interface sending the data query request.
[0093] In this embodiment, in order to further improve the efficiency of data query, for data query requests with relatively fixed query structures or high repetition rates, they are precompiled into query instances and stored in the local cache, reducing the parsing time each time the data query logic is executed. For example, for a data query request to query vehicle data based on a license plate number, it is saved as a query instance, and each subsequent query is performed by passing the queried license plate number as a variable parameter into the query instance. Specifically, sending a query request to the corresponding database includes the following steps:
[0094] Determine whether there is a query instance corresponding to the database query language instruction in the local cache;
[0095] If yes, the query instance is executed and a query request is sent to the corresponding database, thereby reducing the time for parsing the query logic code each time the query is executed;
[0096] If not, the corresponding query logic code is parsed and executed according to the database query language instruction, and a query request is sent to the corresponding database.
[0097] When sending a query request to the ES server, further query optimization can be performed to determine whether there are multiple query requests of the same type. For example, if there is a query request for querying the data of people wearing red clothes, a query request for querying the data of people wearing yellow clothes, and a query request for querying the data of people wearing white clothes, then these are multiple query requests of the same type.
[0098] If yes, the multiple query requests of the same type are merged into one batch query request and sent to the corresponding database, thereby reducing the network round-trip delay and network transmission processing overhead of each transmission of the query request and reception of the query result.
[0099] like Figure 3 As shown, the embodiment of the present application also provides a view library system, including:
[0100] A view library platform, used to implement the view library configuration method;
[0101] The cloud storage platform is used to provide a data transmission interface and receive the unstructured data uploaded by the view library platform through the data transmission interface;
[0102] A big data stream computing platform, used for receiving and processing structured data uploaded by the view library platform;
[0103] The database is used to store the storage address of unstructured data in the cloud storage platform and the data processed by the big data stream computing platform.
[0104] Wherein, the view library platform includes:
[0105] An interface configuration module, for receiving a request for a new interface, the request for a new interface including an interface type of the new interface; and for creating a new interface according to the request for the new interface, and establishing a proxy relationship between the new interface and a module code block according to the interface type of the new interface;
[0106] A request processing module is used to determine whether a proxy instance corresponding to the interface sending the request is stored in a local cache when a data processing request of an interface is received; if so, the proxy instance in the local cache is called to forward the data processing request to the module code block corresponding to the interface; if not, the data processing request is forwarded to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and a proxy instance is generated based on the proxy logic and stored in the local cache; wherein the module code block is configured to execute pre-stored data processing logic in response to the data processing request.
[0107] By adopting the view library platform and view library system of the present application, the process of interface data processing is modularized to form module code blocks corresponding to each interface type. When a new interface is added, the corresponding relationship between the interface and the module code block is determined. When a data processing request is received, the request is forwarded to the module code block to execute the pre-stored data processing logic to achieve the corresponding logic processing effect, thereby realizing modular and rapid configuration of the interface, improving the efficiency of view library development, and shortening the view library development cycle. By adopting this method, when forwarding the data processing request to the module code block, for the proxy reflection that has been executed before, the pre-stored proxy instance can be called directly from the local cache, without having to re-execute the reflection mechanism based on the dynamic proxy each time, which greatly reduces the performance overhead of each subsequent call to the module code block, and does not affect the loss of view library performance while ensuring the modular configuration of the interface.
[0108] Figure 4 The workflow of the view library system when an interface requests data in a specific instance is exemplarily shown in the figure. In this example, the interface types are divided into POST interface, PUT interface, DELETE interface and GET interface, and POST request, PUT request, DELETE request and GET request are sent to the view library platform respectively. The PUT request sends data to the server to change the information. This request is used to modify the content of the data, just like the update operation of the database, but it does not increase the type of data, etc. The POST request is similar to the PUT request. Both send data to the server, but this request will change the type of data and other resources, just like the insert operation of the database, it will create new content. Almost all submission operations currently use POST requests. The DELETE request is used to delete a resource. The GET request sends a request to the database to obtain data to obtain information. This request is like the select operation of the database. It is only used to query the data, and will not modify or add data, and will not affect the content of the resource. Therefore, the POST interface and the PUT interface belong to the data collection interface, which correspond to Figure 4 The commonC module code block and the commonU module code block in the GET class interface belong to the data query interface, which corresponds to Figure 4 The commonQuery module code block and the commonImageQuery module code block. The DELETE interface belongs to the data deletion interface, and its corresponding Figure 4The commonD code block. When receiving the corresponding collection data upload request, the commonC module code block and the commonU code block respectively perform data verification based on the json schema verification logic, and then upload the unstructured data to the cloud storage platform, and upload the structured data to the big data stream computing platform through kafka. When receiving data query requests, the commonQuery module code block and the commonImageQuery module code block translate into standard database query language instructions through the underlying translation library of druid and send them to the ES database or big data cluster. Therefore, this embodiment can conveniently and quickly implement multiple request methods such as POST / PUT / DELETE / GET in the view library platform through interface configuration.
[0109] In this embodiment, the cloud storage platform is preset with modular storage services corresponding to multiple storage methods. For example, the cloud storage platform can support multiple storage methods such as S3 (global storage area network), NFS (network file system), local disk, etc. When the user configures the view library platform, the required storage method can be selected for deployment as needed. The cloud storage platform implements multi-cloud storage services based on SPI (Service Provider Interface) technology, providing a flexible and scalable way to adapt to the storage needs of unstructured data of the view library platform in different scenarios. Therefore, the cloud storage platform is also used to deploy the corresponding modular storage service according to the storage method configuration information corresponding to the view library platform, and instantiate the deployed modular storage service to obtain a storage service instance; the cloud storage platform is also used to receive the unstructured data uploaded by the view library platform through the data transmission interface, and call the storage service instance to store the unstructured data.
[0110] In the cloud storage platform, various storage services are designed as plug-in modules. Based on the core idea of SPI, users who configure the view library platform can easily add new storage services without modifying the existing code. The cloud storage platform provides the same set of unified data transmission interfaces for various storage services, such as setting unified upload, download, and delete file interfaces. All storage services are connected to the unified data transmission interface to ensure that the view library platform uses storage services transparently. When the data transmission interface of the cloud storage platform receives unstructured data to be uploaded, the upload request can also include storage configuration information, dynamically specify the storage service provider currently used, so that the selection of storage services can be changed without restarting the view library platform. The cloud storage platform sets a unified deployment script. When deploying the corresponding storage service for the view library, the type of storage service can be used as the input parameter of the deployment script, and the deployment script is called to quickly implement the required storage service deployment, and the storage operation request processing logic is instantiated. When uploading data later, the data is stored through the corresponding instance, realizing the dynamic switching capability and high scalability of the storage strategy. Therefore, the view library system of this embodiment can adapt to the changing needs for unstructured data storage in different scenarios, while maintaining the simplicity and maintainability of the view library system. The unified standard interface also avoids code confusion caused by different storage media.
[0111] In this embodiment, the data transmission interface of the cloud storage is further optimized, and a breakpoint resume function is provided. During the data upload process, the offset of the current InputStream (input data stream) uploaded is recorded, and the next time the user uploads again, only the current offset position will be continued to be uploaded, which greatly improves the efficiency of video stream data upload.
[0112] In this embodiment, at least one service in the view library system is implemented by multiple service nodes, and each service node is implemented by a separate server or a separate container. For example, the cloud storage platform can deploy storage services on multiple service nodes. The verification service for uploaded data can also be deployed on multiple service nodes. The data query service can also be deployed on multiple service nodes.
[0113] Compared with the traditional service configuration modification, which requires restarting the service, all service configuration modifications in this embodiment are implemented by hot update technology, avoiding the problem of loss of collected data due to configuration modification interruption of service or restart of view library system, and making the service configuration update effective in real time without interrupting the service or restarting the view library system. Specifically, the traditional service configuration update of a service node will only take effect on one service node, and other service nodes cannot perceive it. Therefore, in this embodiment, an event update and notification mechanism is started at each service node, which can be implemented by redis publish-subscribe system, for example. Each of the service nodes is configured to send an update notification to other service nodes of the same service type after performing configuration update. And each service node is configured to perform configuration update according to the update notification when receiving update notifications from other service nodes. When the service node performs service configuration update, each service node is updated independently. The view library system is also used to perform update consistency check on service nodes of the same service type when the service node configuration is updated, and determine whether all service nodes of the same service type have completed the update after a service node configuration is updated. If one service node is not successfully updated, it will retry and report an error to ensure the uniformity and accuracy of the configuration of different service nodes.
[0114] The view library configuration method further comprises the following steps:
[0115] The first service node receives the configuration update request, and updates the local corresponding configuration according to the configuration update information in the configuration update request;
[0116] After completing the configuration update, the first service node sends an update notification to the second service node, where the update notification includes configuration update information, and the second service node and the first service node belong to the same service type;
[0117] After receiving the update notification, the second server updates the local corresponding configuration according to the configuration update information;
[0118] An update consistency check is performed on the first server and the second server.
[0119] The distinction between the "first" server and the "second" server here is only to illustrate that one is a server whose configuration is changed by the user, and the other is a server that updates its configuration after receiving an update notification from another server, and is not intended to limit the number and order of specific features. There can be one or more first servers and one or more second servers.
[0120] The present application also provides a computer-readable storage medium for storing a program, which implements the steps of the view library system when executed by a processor. In some possible implementations, various aspects of the present application can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of various exemplary implementations of the present application described in the above view library system section of this specification.
[0121] refer to Figure 5 As shown, a program product 800 for implementing the above method according to an embodiment of the present application is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present application is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0122] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0123] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0124] Program code for performing the operations of the present application may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or cluster. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).
[0125] By adopting the computer-readable storage medium provided by the present application, the program stored therein implements the steps of the view library system when being executed, thereby obtaining the beneficial effects of the above-mentioned view library system.
[0126] The above content is a further detailed description of the present application in combination with specific preferred implementation methods, and it cannot be determined that the specific implementation of the present application is limited to these descriptions. For ordinary technicians in the technical field to which the present application belongs, several simple deductions or substitutions can be made without departing from the concept of the present application, which should be deemed to fall within the scope of protection of the present application.
Claims
1. A view library configuration method, characterized in that: include: Receive a request for adding a new interface, wherein the request for adding a new interface includes an interface type of the new interface; Create a new interface according to the newly added interface request, and establish a proxy relationship between the newly added interface and the module code block according to the interface type of the newly added interface; When receiving a data processing request from an interface, determining whether a proxy instance corresponding to the interface sending the request is stored in the local cache; If yes, calling the proxy instance in the local cache to forward the data processing request to the module code block corresponding to the interface; If not, forwarding the data processing request to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and generating a proxy instance based on the proxy logic and storing it in the local cache; Wherein, the module code block is configured to execute pre-stored data processing logic in response to the data processing request.
2. The view library configuration method according to claim 1, characterized in that: The interface type at least includes a data acquisition interface, and the data processing request at least includes a collection data upload request; After a data collection data upload request of a data collection interface is sent to a corresponding module code block, the module code block is configured to execute the following steps: Parsing the collected data upload request to obtain the data to be uploaded, calling a verification instance pre-stored in a local cache, and performing data verification on the data to be uploaded based on the verification instance, where the verification instance is pre-compiled from a data verification script; After the verification is passed, the data to be uploaded is uploaded to the specified location.
3. The view library configuration method according to claim 1, characterized in that: The interface type at least includes a data acquisition interface, and the data processing request at least includes a collection data upload request; After a data collection data upload request of a data collection interface is sent to a corresponding module code block, the module code block is configured to execute the following steps: Parsing the collected data upload request to obtain the data to be uploaded, and determining whether the data to be uploaded is unstructured data; If the data to be uploaded is unstructured data, storing the data to be uploaded in a cloud storage platform; If the data to be uploaded is structured data, the data to be uploaded is uploaded to the big data stream computing platform through a distributed publish-subscribe message system.
4. The view library configuration method according to claim 1, characterized in that: The interface type at least includes a data query interface, and the data processing request at least includes a data query request; After a data query request of a data query interface is sent to a corresponding module code block, the module code block is configured to execute the following steps: Obtaining a query string and a request body from the data query request; Determine the type of query data according to the data query request, and determine a database corresponding to the type of query data; Based on a pre-stored underlying general translation library, the query string and the request body are translated into standard database query language instructions; Send a query request to the corresponding database based on the database query language instruction.
5. The view library configuration method according to claim 4, characterized in that: Sending a query request to the corresponding database includes the following steps: Determine whether there is a query instance corresponding to the database query language instruction in the local cache; If yes, then executing the query instance and sending a query request to the corresponding database; Wherein, when sending a query request to the corresponding database, determining whether there are multiple query requests of the same type; If yes, the multiple query requests of the same type are merged into one batch query request, and sent to the corresponding database.
6. A view library platform, characterized in that: For implementing the view library configuration method according to any one of claims 1 to 5, the platform comprises: An interface configuration module, for receiving a request for a new interface, the request for a new interface including an interface type of the new interface; and for creating a new interface according to the request for the new interface, and establishing a proxy relationship between the new interface and a module code block according to the interface type of the new interface; A request processing module is used to determine whether a proxy instance corresponding to the interface sending the request is stored in a local cache when a data processing request of an interface is received; if so, the proxy instance in the local cache is called to forward the data processing request to the module code block corresponding to the interface; if not, the data processing request is forwarded to the module code block corresponding to the interface based on the reflection mechanism of the dynamic proxy, and a proxy instance is generated based on the proxy logic and stored in the local cache; wherein the module code block is configured to execute pre-stored data processing logic in response to the data processing request.
7. A view library system, characterized in that: include: The view library platform as described in claim 6; The cloud storage platform is used to provide a data transmission interface and receive the unstructured data uploaded by the view library platform through the data transmission interface; A big data stream computing platform, used for receiving and processing structured data uploaded by the view library platform; The database is used to store the storage address of unstructured data in the cloud storage platform and the data processed by the big data stream computing platform.
8. The view library system according to claim 7, characterized in that: The cloud storage platform is preset with modular storage services corresponding to multiple storage methods. The cloud storage platform is also used to deploy corresponding modular storage services according to the storage method configuration information corresponding to the view library platform, and instantiate the deployed modular storage services to obtain storage service instances; The cloud storage platform is also used to call the storage service instance to store the unstructured data after receiving the unstructured data uploaded by the view library platform through the data transmission interface.
9. The view library system according to claim 7, characterized in that: At least one service in the view library system is implemented by multiple service nodes, and each of the service nodes is configured to send an update notification to other service nodes of the same service type after performing a configuration update, and perform a configuration update according to the update notification when receiving an update notification from other service nodes; The view library system is also used to perform update consistency verification on service nodes of the same service type when the service node configuration is updated.
10. A computer-readable storage medium for storing a program, characterized in that: When the program is executed by a processor, the steps of the configuration method according to any one of claims 1 to 5 are implemented.
