CN111309375B - Method, device, medium and electronic equipment for generating remote procedure call toolkit - Google Patents

Method, device, medium and electronic equipment for generating remote procedure call toolkit Download PDF

Info

Publication number
CN111309375B
CN111309375B CN202010085730.1A CN202010085730A CN111309375B CN 111309375 B CN111309375 B CN 111309375B CN 202010085730 A CN202010085730 A CN 202010085730A CN 111309375 B CN111309375 B CN 111309375B
Authority
CN
China
Prior art keywords
file
remote procedure
procedure call
slave
package
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010085730.1A
Other languages
Chinese (zh)
Other versions
CN111309375A (en
Inventor
邬亮
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010085730.1A priority Critical patent/CN111309375B/en
Publication of CN111309375A publication Critical patent/CN111309375A/en
Application granted granted Critical
Publication of CN111309375B publication Critical patent/CN111309375B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/547Remote procedure calls [RPC]; Web services

Abstract

The present disclosure provides a method, apparatus, medium and electronic device for generating a remote procedure call toolkit. The method comprises the following steps: acquiring and installing a dependency package; acquiring a first master file and a first slave file; generating an engineering file based on the first master file and the first slave file; updating a project configuration file of the engineering file based on the first main file; generating a client code of the first remote procedure call based on the first master file and the first slave file, and mounting the client code in an application context variable of the remote procedure call framework to generate a client file; generating a toolkit of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file, and the client file. The RPC call issuing process is simplified, and the safety, reliability and maintainability of codes are improved.

Description

Method, device, medium and electronic equipment for generating remote procedure call toolkit
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a method, apparatus, medium, and electronic device for generating a remote procedure call toolkit.
Background
Micro-services are an architectural solution for building applications. Unlike traditional monolithic schemes, micro services split applications into multiple core functions. Each function is referred to as a service, and can be individually constructed and deployed so that the services do not interact when operating (and failing). The micro-service architecture has the advantages of easy deployment and expansion.
Remote procedure call (acronym Remote Procedure Call, RPC) is a protocol that requests services from a remote computer program over a network without knowledge of the underlying network technology. An RPC framework is a framework implementing the RPC protocol. Thread and gRPC are the two most popular RPC frameworks. The RPC framework is mainly divided into an RPC server and an RPC client. The RPC server is configured to respond to the RPC request, and the RPC client is configured to initiate the RPC request, both of which must be used in pairs.
The interface description language (english full name Interface Description Language, IDL for short) is the basis for the RPC framework to implement cross-platform and cross-programming language communication. The IDL file is used to generate a library of communications for different programming language versions.
To better address the issues of cross-platform communication and flexible deployment, RPC and microservices are often required to be used in combination. Since the RPC client is applied to other frameworks, the fusion of RPC calls with the framework becomes a cumbersome task. For example, first a dependent package needs to be installed; manually copying the required IDL file from the remote warehouse, and generating a library code according to the IDL file; acquiring relevant micro-service deployment information, performing relevant configuration, and instantiating an RPC client; and finally, generating a remote procedure call toolkit.
The series of operations have complex process and high technical requirements, and are extremely easy to generate errors.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
The present disclosure aims to provide a method, an apparatus, a medium and an electronic device for generating a remote procedure call toolkit, which can solve at least one technical problem mentioned above. The specific scheme is as follows:
according to a first aspect of the present disclosure, there is provided a method of generating a remote procedure call toolkit, comprising:
acquiring package information of the dependent packages associated with the first remote procedure call, and installing corresponding dependent packages in a remote procedure call framework according to the package information of each dependent package;
obtaining a first master file associated with the first remote procedure call; wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in an interface description language;
analyzing the first master file to obtain each first slave file; wherein the first slave document is a document written by an interface description language;
generating an engineering file based on the first master file and the first slave file;
updating a project configuration file of the engineering file based on the first main file;
generating a client code of the first remote procedure call based on the first master file and the first slave file, and mounting the client code in an application context variable of the remote procedure call framework to generate a client file;
generating a toolkit of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file, and the client file.
According to a second aspect of particular embodiments of the present disclosure, there is provided an apparatus for generating a remote procedure call toolkit, comprising:
the remote procedure call framework is used for receiving the packet information of the first remote procedure call and the packet information of the second remote procedure call;
a first master file obtaining unit, configured to obtain a first master file associated with the first remote procedure call; wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in an interface description language;
the method comprises the steps of obtaining first slave file units, wherein the first slave file units are used for analyzing first master files and obtaining each first slave file; wherein the first slave document is a document written by an interface description language;
a generating engineering file unit, configured to generate an engineering file based on the first master file and the first slave file;
an update project configuration file unit, configured to update a project configuration file of the engineering file based on the first master file;
a client file generating unit, configured to generate a client code of the first remote procedure call based on the first master file and the first slave file, and mount the client code in an application context variable of the remote procedure call framework, to generate a client file;
and a generating tool package unit, configured to generate a tool package of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file and the client file.
According to a third aspect of the disclosure, there is provided a computer readable storage medium having stored thereon a computer program which when executed by a processor implements a method of generating a remote procedure call toolkit as in any of the first aspects.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising: one or more processors; storage means for storing one or more programs that when executed by the one or more processors cause the one or more processors to implement the method of generating a remote procedure call toolkit of any one of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure has at least the following beneficial effects:
the present disclosure provides a method, apparatus, medium and electronic device for generating a remote procedure call toolkit. By distinguishing the uninstalled dependent packages from the installed dependent packages, the method and the device avoid repeated installation of the installed dependent packages and improve the efficiency of generating the remote procedure call toolkit. The information for issuing the RPC call is integrated in a tool package and issued in the form of an executable file. Thus completing all the preparation required for RPC calls. The RPC call issuing process is simplified, and the safety, reliability and maintainability of codes are improved.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flowchart of a method of generating a remote procedure call toolkit according to an embodiment of the present disclosure;
FIG. 2 illustrates a block diagram of the elements of an apparatus for generating a remote procedure call toolkit according to an embodiment of the present disclosure;
fig. 3 illustrates a schematic diagram of an electronic device connection structure according to an embodiment of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part 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. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the drawings.
The first embodiment provided for by the present disclosure, an embodiment of a method of generating a remote procedure call toolkit.
Embodiments of the present disclosure are described in detail below with reference to fig. 1, where fig. 1 is a flowchart of a method for generating a remote procedure call toolkit provided by an embodiment of the present disclosure.
Step S101, acquiring the package information of the dependent package associated with the first remote procedure call, and installing the corresponding dependent package in the remote procedure call frame according to the package information of each dependent package.
When using an RPC client, it is necessary to install a dependency package under the RPC framework that supports the normal operation of the RPC client. The dependency packages include CLI type dependency packages and runtime type dependency packages.
The CLI-type dependent package is used to generate static code.
The runtime type dependent packages are used at code runtime, typically for encoding and decoding data.
In addition, there are some third party dependent packages. The third party dependency package is typically an upgrade to the common dependency package and may be better integrated with the usage framework. For example, the RPC client is packaged in the form of a middleware or plug-in.
The obtaining the package information of the dependent packages associated with the first remote procedure call, and installing the corresponding dependent packages in the remote procedure call framework according to the package information of each dependent package, comprising the following steps:
step S101-1, a dependent package information file is acquired.
For JavaScript engineering (JS engineering for short), a node. JS packet manager (english full name Node Package Manager, npm for short) is generally used to manage the dependent packets. npm provides various application program interfaces (English full Application Programming Interface, abbreviated API) for managing dependency packages, such as an API for installing dependency packages, an API for updating dependency packages, and an API for removing dependency packages.
For JS engineering, the package information of the installed dependent package is stored in the dependent package information file. For example, npm maintains a "package. Json" file under the created JS project for recording package information for installed dependent packages.
And step S101-2, acquiring the package information of the installed dependent package according to the dependent package information file.
The package information includes package name and package version information.
An installed dependent package refers to a dependent package that has been installed in the current operating environment.
Step S101-3, obtaining package information of the dependent package associated with the first remote procedure call.
The dependency package associated with the first remote procedure call refers to the dependency package required to support normal operation of the first remote procedure call.
And step S101-4, comparing the package information of the dependent package with the package information of the installed dependent package, and acquiring the package information of the uninstalled dependent package associated with the first remote procedure call.
I.e. find out the dependency packages that have not yet been installed in the current running environment.
Step S101-5, installing the corresponding uninstalled dependent package through the installation application program interface based on the package information of each uninstalled dependent package.
For example, for JS engineering, the install application interface is one of the application interfaces provided by npm that manages the dependency packages.
By distinguishing the uninstalled dependent packages from the installed dependent packages, the embodiment of the disclosure avoids repeated installation of the installed dependent packages and improves the efficiency of generating the remote procedure call toolkit.
Step S102, obtaining a first master file associated with the first remote procedure call.
Wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in the interface description language.
A back-end remote procedure call service (RPC service for short) typically corresponds to a first master file. The functions in one RPC service correspond to the request interfaces of one client.
The obtaining a first master file associated with the first remote procedure call includes the steps of:
and pulling the first main file through a main calling application program interface based on a preset code warehouse identifier and a preset first main path.
Code management software is typically used to manage the first master file in view of security and rights management. For example, the code management software GitLab provides sophisticated API support for code warehouse management; wherein invoking the host calling application program interface may pull the first host file of the preset code repository. When the file is pulled from the GitLab, a code warehouse identifier and a first main path are required to be preset.
For ease of reference and management, all IDL files are typically kept in the same preset code repository. All IDL files include a first master file and a first slave file. Therefore, the default code repository identification may be defaulted when the IDL file is pulled.
Step S103, analyzing the first master files and obtaining each first slave file.
Wherein the first slave document is a document written by an interface description language.
The first slave file does not contain RPC services.
Logic to implement the first remote procedure call is included in the first master file and the first slave file.
The analyzing the first master file and obtaining each first slave file comprises the following steps:
step S103-1, analyzing the first master file to acquire each first slave path.
One first master file may depend on at least one or more first slave files. One first slave file may also depend on other first slave files. The path of an IDL file on which it depends can be known by parsing it. The path of all IDL files associated with the first master file may be obtained by recursively parsing from the first master file.
Step S103-2, pulling corresponding first slave files through the slave calling application program interface based on each first slave path.
That is, the corresponding first slave file may be acquired through all paths of the IDL files associated with the first master file, respectively.
Step S104, generating an engineering file based on the first master file and the first slave file.
The engineering file is a collection of code for an integrated application. The engineering file includes logic to implement a first remote procedure call in a first master file and a first slave file.
Because the first master file and the first slave file are both written in the interface description language, the engineering file can be generated by performing language conversion on the first master file and the first slave file. This embodiment of the conversion process is not described in detail and can be implemented with reference to various implementations in the prior art.
Step S105, updating the project configuration file of the project file based on the first main file.
The project configuration file is the configuration information required by the normal operation of the project recorded in the project file.
The project configuration file updating the project file based on the first main file comprises the following steps:
step S105-1, analyzing the first main file, and obtaining the service name and the corresponding name space of each remote procedure call service.
Wherein the namespace is a registration name corresponding to the remote procedure call service at the micro-service.
The backend RPC services are typically deployed using micro-services. The RPC service is registered with the micro service system, and the registration information at least comprises a registration name and a corresponding IP address. When the RPC service is invoked, a discovery function of the RPC service, that is, acquiring a corresponding IP address by a registration name, may be used.
When the RPC service is deployed by adopting the micro-service mode, because the namespaces of the RPCs have uniqueness, the namespaces of the RPCs are generally used as registration names when the RPC service is registered. When the RPC service is invoked, the IP address of the RPC service needs to be specified. The registration name is typically specified in a configured manner.
Step S105-2, obtaining project configuration files of the project files.
Step S105-3, generating a first abstract syntax tree based on the project configuration files.
The process of generating the first abstract syntax tree based on the project profiles is not described in detail in this embodiment, and may be implemented with reference to various implementations in the prior art.
Step S105-4, generating nodes of a first abstract syntax tree based on the service name, the corresponding name space and the corresponding first main path of each remote procedure call service, and generating a second abstract syntax tree.
When the RPC service is invoked, in addition to configuring the registration name (i.e., namespace), the service name and corresponding first primary path of the RPC service need to be configured. The configuration information is typically recorded in a project configuration file of the project file. The embodiment of the disclosure generates the node of the first abstract syntax tree by the configuration information, and inserts the node into the first abstract syntax tree to generate the second abstract syntax tree.
Step S105-5, updating the project configuration file of the project file based on the second abstract syntax tree.
Embodiments of the present disclosure update project profiles of engineering files by generating a second abstract syntax tree.
And step S106, generating client codes of the first remote procedure call based on the first master file and the first slave file, and mounting the client codes in application context variables of the remote procedure call framework to generate client files.
The application context variable of the remote procedure call framework is a variable that runs through the steps of the request operation, typically with some common parameters and utility APIs installed.
To avoid the hassle of manually introducing an RPC client, instantiated client code is typically mounted into the application context variables of the RPC framework (meaning all content under the running framework).
The client code that generates the first remote procedure call based on the first master file and the first slave file includes the steps of:
step S106-1, generating client TS type declaration code for the first remote procedure call based on the first master file and the first slave file.
When RPC call is adopted, a corresponding TS type declaration code must be included in a project file for TypeScript project (TS project for short). For JS engineering, the TS type declaration code is not necessary, but it is necessary to combine the grammar prompt and auto-completion functions provided by the integrated development environment (english full name Integrated Development Environment, abbreviated as IDE). The TS type declarations associated with RPC calls can be derived from IDL files.
Step S106-2, generating instantiation client code of the first remote procedure call based on the first master file and the first slave file.
Before using the RPC client, instantiation is required. For the manner in which static libraries are used, the command line tools provided by the RPC framework are required to generate static library code. When the RPC client initiates an RPC request, the static library codes are called to complete operations such as serialization.
Step S107, generating a toolkit of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file and the client file.
For JS engineering, npm can be used to share and borrow toolkits. The toolkit is typically shared onto npm. So that the kit can be downloaded, installed and used from npm.
Executable files may also be published at the time of the toolkit. The executable file is installed into a preset path of the environment variable to run the executable file using the command line tool. After the tool pack is installed, the executable file can be executed using a simple command.
By distinguishing the uninstalled dependent packages from the installed dependent packages, the embodiment of the disclosure avoids repeated installation of the installed dependent packages and improves the efficiency of generating the remote procedure call toolkit. The information for issuing the RPC call is integrated in a tool package and issued in the form of an executable file. Thus completing all the preparation required for RPC calls. The RPC call issuing process is simplified, and the safety, reliability and maintainability of codes are improved.
Corresponding to the first embodiment provided by the present disclosure, the present disclosure also provides a second embodiment, namely an apparatus for generating a remote procedure call toolkit. Since the second embodiment is substantially similar to the first embodiment, the description is relatively simple, and the relevant portions will be referred to the corresponding descriptions of the first embodiment. The device embodiments described below are merely illustrative.
Fig. 2 illustrates an embodiment of an apparatus for generating a remote procedure call toolkit provided by the present disclosure. Fig. 2 is a block diagram of a unit of an apparatus for generating a remote procedure call toolkit provided by an embodiment of the present disclosure.
Referring to fig. 2, the present disclosure provides an apparatus for generating a remote procedure call toolkit, including: the installation dependency package unit 201 obtains the first master file unit 202, obtains the first slave file unit 203, generates the project file unit 204, updates the project configuration file unit 205, generates the client file unit 206, and generates the toolkit unit 207.
An install dependent package unit 201, configured to obtain package information of dependent packages associated with the first remote procedure call, and install corresponding dependent packages according to package information of each dependent package in the remote procedure call framework;
a first master file obtaining unit 202, configured to obtain a first master file associated with the first remote procedure call; wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in an interface description language;
a first slave file obtaining unit 203, configured to analyze the first master file, and obtain each first slave file; wherein the first slave document is a document written by an interface description language;
a generate engineering file unit 204, configured to generate an engineering file based on the first master file and the first slave file;
an update project profile unit 205, configured to update a project profile of the project file based on the first master file;
a generating client file unit 206, configured to generate a client code of the first remote procedure call based on the first master file and the first slave file, and mount the client code in an application context variable of the remote procedure call framework, to generate a client file;
a generating toolkit unit 207 for generating a toolkit of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file and the client file.
Optionally, in the acquiring the first main file unit 202, it includes:
and the first main file acquisition subunit is used for pulling the first main file through the main calling application program interface based on the preset code warehouse identifier and the preset first main path.
Optionally, in the acquiring the first slave file unit 203, the method includes:
a first slave path sub-unit for analyzing the first master file and acquiring each first slave path;
and the first slave file sub-unit is used for respectively pulling the corresponding first slave files through the slave calling application program interface based on each first slave path.
Optionally, in the update item configuration file unit 205, it includes:
the remote procedure call service information acquisition subunit is used for analyzing the first main file and acquiring a service name and a corresponding name space of each remote procedure call service; wherein the namespace is a registration name of the remote procedure call service at a microservice;
the project configuration file acquisition subunit is used for acquiring project configuration files of the engineering files;
a first abstract syntax tree generation subunit for generating a first abstract syntax tree based on the project configuration file;
a second abstract syntax tree generation subunit, configured to generate a node of a first abstract syntax tree based on the service name, the corresponding namespace, and the corresponding first main path of each remote procedure call service, respectively, and generate a second abstract syntax tree;
and the project configuration file updating subunit is used for updating the project configuration file of the engineering file based on the second abstract syntax tree.
Optionally, in the generating client file unit 206, it includes:
a client TS type declaration code generation subunit operable to generate a client TS type declaration code for the first remote procedure call based on the first master file and the first slave file;
an instantiation client code subunit is generated for generating instantiation client code of the first remote procedure call based on the first master file and the first slave file.
Optionally, in the installation-dependent package unit 201, it includes:
the dependent packet information file acquisition subunit is used for acquiring a dependent packet information file;
the installed dependent package information acquisition subunit is used for acquiring package information of the installed dependent package according to the dependent package information file;
a get dependent package information subunit for obtaining package information of a dependent package associated with the first remote procedure call;
the method comprises the steps of obtaining an uninstalled dependent package information subunit, wherein the uninstalled dependent package information subunit is used for comparing package information of the dependent package with package information of an installed dependent package and obtaining package information of an uninstalled dependent package associated with the first remote procedure call;
and the installation subunit is used for installing the corresponding uninstalled dependent package through the installation application program interface based on the package information of each uninstalled dependent package.
Optionally, the package information includes package name and package version information.
By distinguishing the uninstalled dependent packages from the installed dependent packages, the embodiment of the disclosure avoids repeated installation of the installed dependent packages and improves the efficiency of generating the remote procedure call toolkit. The information for issuing the RPC call is integrated in a tool package and issued in the form of an executable file. Thus completing all the preparation required for RPC calls. The RPC call issuing process is simplified, and the safety, reliability and maintainability of codes are improved.
The present disclosure provides a third embodiment, namely an electronic device for generating a method of a remote procedure call toolkit, the electronic device comprising: at least one processor; and a memory communicatively coupled to the at least one processor; wherein, the liquid crystal display device comprises a liquid crystal display device,
the memory stores instructions executable by the one processor to enable the at least one processor to perform the method of generating a remote procedure call toolkit as described in the first embodiment.
The present disclosure provides a fourth embodiment, a computer storage medium storing computer executable instructions that are executable to perform the method of generating a remote procedure call toolkit as described in the first embodiment.
Referring now to fig. 3, a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 3 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
As shown in fig. 3, the electronic device may include a processing means (e.g., a central processor, a graphics processor, etc.) 301 that may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
In general, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 308 including, for example, magnetic tape, hard disk, etc.; and communication means 309. The communication means 309 may allow the electronic device to communicate with other devices wirelessly or by wire to exchange data. While fig. 3 shows an electronic device having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via a communication device 309, or installed from a storage device 308, or installed from a ROM 302. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing means 301.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having 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. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Wherein the names of the units do not constitute a limitation of the units themselves in some cases.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a 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.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.

Claims (10)

1. A method of generating a remote procedure call toolkit, comprising:
acquiring package information of the dependent packages associated with the first remote procedure call, and installing corresponding dependent packages in a remote procedure call framework according to the package information of each dependent package;
obtaining a first master file associated with the first remote procedure call; wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in an interface description language;
analyzing the first master file to obtain each first slave file; wherein the first slave document is a document written by an interface description language; the first slave file does not contain a remote procedure call PRC service;
generating an engineering file based on the first master file and the first slave file;
updating a project configuration file of the engineering file based on the first main file;
generating a client code of the first remote procedure call based on the first master file and the first slave file, and mounting the client code in an application context variable of the remote procedure call framework to generate a client file;
generating a toolkit of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file, and the client file.
2. The method of claim 1, wherein the retrieving the first master file associated with the first remote procedure call comprises:
and pulling the first main file through a main calling application program interface based on a preset code warehouse identifier and a preset first main path.
3. The method of claim 2, wherein the analyzing the first master file to obtain each first slave file comprises:
analyzing the first master file to acquire each first slave path;
the corresponding first slave files are respectively pulled through the slave calling application program interface based on each first slave path.
4. The method of claim 2, wherein the updating the project profile of the project file based on the first master file comprises:
analyzing the first main file, and acquiring a service name and a corresponding naming space of each remote procedure call service; wherein the namespace is a registration name of the remote procedure call service at a microservice;
acquiring a project configuration file of the engineering file;
generating a first abstract syntax tree based on the project configuration file;
generating nodes of a first abstract syntax tree based on the service name, the corresponding name space and the corresponding first main path of each remote procedure call service respectively, and generating a second abstract syntax tree;
and updating the project configuration file of the engineering file based on the second abstract syntax tree.
5. The method of claim 1, wherein the generating the client code of the first remote procedure call based on the first master file and the first slave file comprises:
generating client TS type declaration code for the first remote procedure call based on the first master file and the first slave file;
instantiation client code of the first remote procedure call is generated based on the first master file and the first slave file.
6. The method of claim 1, wherein the retrieving the package information of the dependent packages associated with the first remote procedure call and installing the corresponding dependent packages in the remote procedure call framework according to the package information of each dependent package comprises:
acquiring a dependent package information file;
acquiring package information of the installed dependent package according to the dependent package information file;
acquiring package information of a dependent package associated with a first remote procedure call;
comparing the package information of the dependent package with the package information of the installed dependent package, and obtaining package information of an uninstalled dependent package associated with the first remote procedure call;
and installing the corresponding uninstalled dependent package through the installation application program interface based on the package information of each uninstalled dependent package.
7. The method of claim 6, wherein the package information includes package name and package version information.
8. An apparatus for generating a remote procedure call toolkit, comprising:
the remote procedure call framework is used for receiving the packet information of the first remote procedure call and the packet information of the second remote procedure call;
a first master file obtaining unit, configured to obtain a first master file associated with the first remote procedure call; wherein the first master document is a document written in an interface description language and the first master document includes a plurality of remote procedure call services associated with the first remote procedure call written in an interface description language;
the method comprises the steps of obtaining first slave file units, wherein the first slave file units are used for analyzing first master files and obtaining each first slave file; wherein the first slave document is a document written by an interface description language; the first slave file does not contain a remote procedure call PRC service;
a generating engineering file unit, configured to generate an engineering file based on the first master file and the first slave file;
an update project configuration file unit, configured to update a project configuration file of the engineering file based on the first master file;
a client file generating unit, configured to generate a client code of the first remote procedure call based on the first master file and the first slave file, and mount the client code in an application context variable of the remote procedure call framework, to generate a client file;
and a generating tool package unit, configured to generate a tool package of the executable first remote procedure call based on the dependency package, the engineering file, the project configuration file and the client file.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the program, when being executed by a processor, implements the method according to any one of claims 1 to 7.
10. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs which when executed by the one or more processors cause the one or more processors to implement the method of any of claims 1 to 7.
CN202010085730.1A 2020-02-11 2020-02-11 Method, device, medium and electronic equipment for generating remote procedure call toolkit Active CN111309375B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010085730.1A CN111309375B (en) 2020-02-11 2020-02-11 Method, device, medium and electronic equipment for generating remote procedure call toolkit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010085730.1A CN111309375B (en) 2020-02-11 2020-02-11 Method, device, medium and electronic equipment for generating remote procedure call toolkit

Publications (2)

Publication Number Publication Date
CN111309375A CN111309375A (en) 2020-06-19
CN111309375B true CN111309375B (en) 2023-07-04

Family

ID=71158322

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010085730.1A Active CN111309375B (en) 2020-02-11 2020-02-11 Method, device, medium and electronic equipment for generating remote procedure call toolkit

Country Status (1)

Country Link
CN (1) CN111309375B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930363B (en) * 2020-08-07 2023-11-24 抖音视界有限公司 Block interface code generation method and device
CN111949309A (en) * 2020-08-07 2020-11-17 北京字节跳动网络技术有限公司 Method and device for pulling IDL file, computer equipment and storage medium
CN112202746B (en) * 2020-09-24 2023-04-21 北京百度网讯科技有限公司 RPC member information acquisition method, device, electronic equipment and storage medium
CN112596753A (en) * 2020-12-29 2021-04-02 上海瑞家信息技术有限公司 Dependency package installation method and device, electronic equipment and computer readable medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408216A (en) * 2018-11-12 2019-03-01 北京字节跳动网络技术有限公司 Task creating method, device, equipment and storage medium
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100879123B1 (en) * 2007-04-19 2009-01-19 한국전자통신연구원 Fuzzing system and method of distributed computing environment remote procedure call object
US10552240B2 (en) * 2014-09-04 2020-02-04 International Business Machines Corporation Automatically generating efficient remote procedure call (RPC) code for heterogeneous systems

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109408216A (en) * 2018-11-12 2019-03-01 北京字节跳动网络技术有限公司 Task creating method, device, equipment and storage medium
CN109871289A (en) * 2019-02-01 2019-06-11 北京顺丰同城科技有限公司 A kind of remote procedure call service creation method and device
CN110457144A (en) * 2019-08-05 2019-11-15 北京字节跳动网络技术有限公司 A kind of method, apparatus that realizing front end applications, medium and equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
郭建文.IDL在分布式GIS系统中的应用研究.《计算机应用研究》.2007,第24卷(第5期),第220-222页. *

Also Published As

Publication number Publication date
CN111309375A (en) 2020-06-19

Similar Documents

Publication Publication Date Title
CN111309375B (en) Method, device, medium and electronic equipment for generating remote procedure call toolkit
CN112286529A (en) Development method, device and equipment of front-end page and storage medium
CN111367516B (en) Application interface generation method and device and electronic equipment
CN111581555B (en) Document loading method, device, equipment and storage medium
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN110928912A (en) Method and device for generating unique identifier
CN111338944B (en) Remote Procedure Call (RPC) interface testing method, device, medium and equipment
CN111625422B (en) Thread monitoring method, thread monitoring device, electronic equipment and computer readable storage medium
CN110221877B (en) Application program running method and device, electronic equipment and storage medium
CN110377273B (en) Data processing method, device, medium and electronic equipment
CN111324376B (en) Function configuration method, device, electronic equipment and computer readable medium
CN110704050B (en) Module initializing method and device, electronic equipment and computer readable storage medium
CN113761871A (en) Rich text rendering method and device, electronic equipment and storage medium
CN109981546B (en) Method and device for acquiring remote call relation between application modules
WO2022257547A1 (en) Method and apparatus for synchronizing time by means of parsing satellite navigation data
CN113448585B (en) Compiling method and device of thread pool, electronic equipment and storage medium
CN111240738B (en) File processing method, device, equipment and medium
CN113391860B (en) Service request processing method and device, electronic equipment and computer storage medium
CN114398035A (en) Method, apparatus, device and computer readable medium for providing service using component
CN109669720B (en) Chain type asynchronous request processing method and device based on Promise and electronic equipment
CN111414161B (en) Method, device, medium and electronic equipment for generating IDL file
CN113709171A (en) Method and device for cross-component state communication
CN116360802A (en) Middleware processing method, middleware processing device, electronic equipment and storage medium
CN113778566A (en) Native application calling method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant