CN111309375A - 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
CN111309375A
CN111309375A CN202010085730.1A CN202010085730A CN111309375A CN 111309375 A CN111309375 A CN 111309375A CN 202010085730 A CN202010085730 A CN 202010085730A CN 111309375 A CN111309375 A CN 111309375A
Authority
CN
China
Prior art keywords
file
remote procedure
procedure call
package
slave
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.)
Granted
Application number
CN202010085730.1A
Other languages
Chinese (zh)
Other versions
CN111309375B (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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Stored Programmes (AREA)

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 a project file based on the first master file and the first slave file; updating a project profile of the project file based on the first master 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 method simplifies the process of issuing the RPC call, and improves the safety, reliability and easy maintainability of the code.

Description

Method, device, medium and electronic equipment for generating remote procedure call toolkit
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a medium, and an electronic device for generating a remote procedure call toolkit.
Background
Microservices are an architectural approach for building applications. Unlike traditional monolithic solutions, microservices split applications into multiple core functions. Each function is referred to as a service and can be built and deployed individually so that the services do not affect each other when working (and failing). The micro-service architecture has the advantages of being easy to deploy and expand and the like.
Remote Procedure Call (RPC) is a protocol for requesting services from a Remote computer program over a network without knowledge of underlying network technology. The RPC framework is a framework that implements the RPC protocol. Thrift and gRPC are the two most prevalent RPC frameworks. The RPC framework is mainly divided into an RPC server and an RPC client. The RPC server is used for responding to the RPC request, and the RPC client is used for initiating the RPC request, and the RPC server and the RPC client are used in pairs.
An Interface Description Language (IDL) is the basis for the RPC framework to implement cross-platform and cross-programming Language communication. The IDL file is used to generate communication libraries of different programming language versions.
To better address the issues of cross-platform communication and flexible deployment, RPC and micro-service are often used in combination. Because the RPC client is applied to other frameworks, the fusion of RPC calls and frameworks becomes a tedious job. For example, the relevant dependency packages need to be installed first; then, manually copying a required IDL file from a remote warehouse, and generating a library code according to the IDL file; acquiring related micro-service deployment information, performing related configuration, and instantiating an RPC client; and finally, a remote procedure call toolkit can be generated.
The series of operations are not only complex in process, but also high in technical requirements and 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.
An object of the present disclosure is 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 of the above-mentioned technical problems. The specific scheme is as follows:
according to a specific embodiment of the present disclosure, in a first aspect, the present disclosure provides a method for generating a remote procedure call toolkit, including:
acquiring the package information of a dependent package associated with the first remote procedure call, and installing a corresponding dependent package in a remote procedure call frame 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 written in an interface description language associated with the first remote procedure call;
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 a project file based on the first master file and the first slave file;
updating a project profile of the project file based on the first master 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, the present disclosure provides an apparatus for generating a remote procedure call toolkit, including:
the installation dependent package unit is used for acquiring the package information of the dependent package associated with the first remote procedure call and installing the corresponding dependent package according to the package information of each dependent package in the remote procedure call framework;
a get first master file unit to get 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 written in an interface description language associated with the first remote procedure call;
the first slave file acquisition unit is used for analyzing the first master file and acquiring each first slave file; wherein the first slave document is a document written by an interface description language;
a project file generation unit for generating a project file based on the first master file and the first slave file;
an update project profile unit for updating the project profile of the project 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, mount the client code in an application context variable of the remote procedure call framework, and generate a client file;
and the generation toolkit unit is used for generating an executable toolkit of the first remote procedure call based on the dependency kit, the engineering file, the project configuration file and the client file.
According to a third aspect, 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 according to any of the first aspects.
According to a fourth aspect thereof, the present disclosure provides 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 a method of generating a remote procedure call toolkit according to any of the first aspects.
Compared with the prior art, the scheme of the embodiment of the disclosure at least has the following beneficial effects:
the present disclosure provides a method, apparatus, medium, and electronic device for generating a remote procedure call toolkit. According to the method and the device, the uninstalled dependency package and the installed dependency package are distinguished, so that repeated installation of the installed dependency package is avoided, and the efficiency of generating the remote procedure call toolkit is improved. The information of issuing the RPC call is integrated into a toolkit and issued in the form of an executable file. Thereby completing all preparation required for the RPC call. The method simplifies the process of issuing the RPC call, and improves the safety, reliability and easy maintainability of the code.
Drawings
The above and other features, advantages and aspects of various embodiments of the present disclosure will become more apparent by referring to the following detailed description when taken in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numbers refer to the same or similar elements. It should be understood that the drawings are schematic and that elements and features are not necessarily drawn to scale. In the drawings:
FIG. 1 illustrates a flow diagram 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 elements of an apparatus that generates a remote procedure call toolkit according to an embodiment of the present disclosure;
fig. 3 shows an electronic device connection structure schematic 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 are shown in the 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 rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the 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. Moreover, 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 "include" and variations thereof as used herein are 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". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing different devices, modules or units, and are not used for limiting the order or interdependence relationship of the functions performed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
Alternative embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
A first embodiment provided by the present disclosure is an embodiment of a method for generating a remote procedure call toolkit.
The embodiment of the present disclosure is 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 according to the 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 according to the package information of each dependent package in the remote procedure call framework.
When using the RPC client, a RPC framework must be installed to support the dependency package that the RPC client normally runs. The dependency packages include a CLI type dependency package and a runtime type dependency package.
The CLI type dependent package is used to generate static code.
The runtime type dependent package is used at code runtime, typically for encoding and decoding data.
In addition, there are also some third party dependent packages. The third party dependency packages are typically upgrades to commonly used dependency packages that may be better integrated with the use of the framework. For example, the RPC client is packaged in the form of a middleware or plug-in.
The method for acquiring the package information of the dependency package associated with the first remote procedure call and installing the corresponding dependency package according to the package information of each dependency package in the remote procedure call framework comprises the following steps:
and step S101-1, acquiring a dependency package information file.
For JavaScript (JS project for short), a node.js package Manager (node package Manager for short npm) is generally used to manage the dependent package. npm provides various Application Programming Interfaces (APIs) for managing dependent packages, such as an API for installing dependent packages, an API for updating dependent packages, and an API for removing dependent packages.
For the JS project, the package information of the installed dependency package is saved in the dependency 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 S101-2, acquiring the package information of the installed dependency package according to the dependency package information file.
The package information includes a package name and package version information.
An installed dependency package refers to a dependency package that has been installed in the current runtime environment.
Step S101-3, package information of a dependency package associated with the first remote procedure call is obtained.
The dependency package associated with the first remote procedure call refers to the dependency package required to support the normal operation of the first remote procedure call.
And S101-4, comparing the package information of the dependency package with the package information of the installed dependency package, and acquiring the package information of the uninstalled dependency package associated with the first remote procedure call.
I.e., to find out the dependent packages that are not yet installed in the current runtime environment.
And 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 the JS project, the install application interface is one of the application interfaces provided by npm that manages dependency packages.
According to the embodiment of the disclosure, the uninstalled dependency package and the installed dependency package are distinguished, so that repeated installation of the installed dependency package is avoided, and the efficiency of generating the remote procedure call toolkit is improved.
Step S102, a first master file associated with the first remote procedure call is obtained.
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 written in an interface description language associated with the first remote procedure call.
A remote procedure call service (RPC service for short) at the back end typically corresponds to a first master file. A function in an RPC service corresponds to a request interface of a client.
The obtaining a 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 the preset code warehouse identification and the preset first main path.
In consideration of security and rights management, code management software is usually used to manage the first master file. For example, the code management software GitLab provides a well-established API to support code repository management; wherein invoking the primary calling application program interface pulls a first primary file of the default code repository. When a file is pulled from the GitLab, a code repository identifier needs to be preset and a first main path needs to be preset.
For ease of reference and management, all IDL files are typically saved in the same pre-defined code repository. All IDL files include a first master file and a first slave file. Therefore, when pulling the IDL file, the default code repository identifier may be set as a default.
Step S103, analyzing the first master file 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 files to obtain each first slave file comprises the following steps:
step S103-1, analyzing the first master file and obtaining each first slave path.
A 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 the IDL file which depends on the IDL file can be known by analyzing the IDL file. And starting recursive analysis from the first main file, so that all paths of the IDL file associated with the first main file can be obtained.
And step S103-2, respectively pulling the corresponding first slave files through the slave calling application program interface on the basis of each first slave path.
That is, the corresponding first slave files may be respectively obtained through the paths of all the IDL files associated with the first master file.
And step S104, generating a project file based on the first master file and the first slave file.
The project file is a collection of code for the 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 by the interface description language, the first master file and the first slave file are subjected to language conversion, and the project file can be generated. The present embodiment does not describe the conversion process in detail, and can be implemented by referring 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 recorded project in the project file.
The updating the project profile of the project file based on the first master file includes the following steps:
step S105-1, analyzing the first main file, and acquiring a service name and a corresponding name space of each remote procedure call service.
And the name space is a registered name of the remote procedure call service in the micro service.
The RPC service at the back end is usually deployed in a way of micro-service. Firstly, registering RPC service to a micro-service system, wherein the registration information at least comprises a registration name and a corresponding IP address. When the RPC service is called, the discovery function of the RPC service, that is, the corresponding IP address is acquired by registering a name, may be used.
When the RPC service is deployed in a micro-service mode, because the name space of the RPC has uniqueness, the name space of the RPC is usually used as a registration name when the RPC service is registered. When the RPC service is called, the IP address of the RPC service needs to be specified. The registration name is typically specified in a configured manner.
And step S105-2, acquiring a project configuration file of the project file.
Step S105-3, generating a first abstract syntax tree based on the project configuration file.
This embodiment is not detailed in relation to the process of generating the first abstract syntax tree based on the project configuration file, and can be implemented by referring to various implementations in the prior art.
Step S105-4, respectively 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 called, in addition to configuring the registration name (i.e., namespace), the service name of the RPC service and the corresponding first main path need to be configured. This configuration information is typically recorded in the project configuration file of the project file. The configuration information is used for generating a node of a first abstract syntax tree, and the node is inserted into the first abstract syntax tree to generate a second abstract syntax tree.
And step S105-5, updating the project configuration file of the project file based on the second abstract syntax tree.
The project configuration file of the project file is updated by generating the second abstract syntax tree.
Step S106, 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.
The application context variable of the remote procedure call framework is a variable that runs through the steps of the request operation, typically mounting some common parameters and utility APIs.
To avoid the trouble of manually introducing an RPC client, the instantiated client code is typically mounted into the application context variables of the RPC framework (meaning all the content under the running framework).
The generating client code for the first remote procedure call based on the first master file and the first slave file comprises the steps of:
step S106-1, generating a client TS type declaration code of the first remote procedure call based on the first master file and the first slave file.
When the RPC is used, a corresponding TS type declaration code must be included in a project file of a TypeScript project (TS project for short). For JS engineering, TS type declaration code is not necessary, but needs to combine syntax prompt and auto-completion function provided by Integrated Development Environment (IDE). The TS type declaration associated with the RPC call may be obtained from the IDL file.
Step S106-2, generating an instantiated 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 approach using static libraries, the static library code needs to be generated using the command line tool provided by the RPC framework. When the RPC client side initiates the RPC request, the static library codes are called to complete operations such as serialization and the like.
Step S107, generating an executable toolkit of the first remote procedure call based on the dependency package, the project file, the project configuration file and the client file.
For JS projects, npm may be used to share and borrow toolkits. The toolkit is typically shared to npm. So that the kit may be downloaded, installed and used from npm.
An executable file may also be published at the time of the toolkit. The executable file is installed into a predetermined path of the environment variable in order to run the executable file using a command line tool. After the toolkit is installed, the executable file can be executed using a simple command.
According to the embodiment of the disclosure, the uninstalled dependency package and the installed dependency package are distinguished, so that repeated installation of the installed dependency package is avoided, and the efficiency of generating the remote procedure call toolkit is improved. The information of issuing the RPC call is integrated into a toolkit and issued in the form of an executable file. Thereby completing all preparation required for the RPC call. The method simplifies the process of issuing the RPC call, and improves the safety, reliability and easy maintainability of the code.
Corresponding to the first embodiment provided by the disclosure, the disclosure also provides a second embodiment, namely an apparatus for generating a remote procedure call toolkit. Since the second embodiment is basically similar to the first embodiment, the description is simple, and the relevant portions should be referred to the corresponding description 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 elements of an apparatus for generating a remote procedure call toolkit according to 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 acquires a first master file unit 202, acquires a first slave file unit 203, generates a project file unit 204, updates a project configuration file unit 205, generates a client file unit 206, and generates a toolkit unit 207.
An install dependent package unit 201, configured to obtain package information of a dependent package associated with the first remote procedure call, and install a corresponding dependent package according to the package information of each dependent package in the remote procedure call framework;
an acquire first master file unit 202, configured to acquire 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 written in an interface description language associated with the first remote procedure call;
a first slave file acquiring unit 203, configured to analyze the first master file and acquire each first slave file; wherein the first slave document is a document written by an interface description language;
a generate project file unit 204, configured to generate a project file based on the first master file and the first slave file;
an update project profile unit 205 for updating the project profile of the project file based on the first master file;
a generate 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, mount the client code in an application context variable of the remote procedure call framework, and generate a client file;
a generating toolkit unit 207, configured to generate 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, the obtaining the first master file unit 202 includes:
and acquiring a first main file subunit, which is used for 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.
Optionally, the obtaining the first slave file unit 203 includes:
the first slave path acquiring subunit is used for analyzing the first master file and acquiring each first slave path;
and the first slave file sub-unit is used for pulling the corresponding first slave files respectively through the slave calling application program interface based on each first slave path.
Optionally, the update item configuration file unit 205 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 name space is a registered name of the remote procedure call service in the micro service;
the project configuration file acquisition subunit is used for acquiring a project configuration file of the project file;
generating a first abstract syntax tree subunit for generating a first abstract syntax tree based on the project configuration file;
generating a second abstract syntax tree subunit, configured to generate a node of the 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 project file based on the second abstract syntax tree.
Optionally, the generating the client file unit 206 includes:
a generate client TS type declaration code subunit, configured to generate a client TS type declaration code of the first remote procedure call based on the first master file and the first slave file;
an instantiate client code sub-unit is generated for generating instantiate client code for the first remote procedure call based on the first master file and the first slave file.
Optionally, the installation dependency package unit 201 includes:
the dependent package information file acquisition subunit is used for acquiring the dependent package information file;
the installed dependent package information acquiring subunit is used for acquiring the package information of the installed dependent package according to the dependent package information file;
an obtain dependent package information subunit operable to obtain package information of a dependent package associated with the first remote procedure call;
an install dependency package information obtaining subunit, configured to compare package information of the dependency package with package information of an installed dependency package, and obtain package information of an install dependency 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 a package name and package version information.
According to the embodiment of the disclosure, the uninstalled dependency package and the installed dependency package are distinguished, so that repeated installation of the installed dependency package is avoided, and the efficiency of generating the remote procedure call toolkit is improved. The information of issuing the RPC call is integrated into a toolkit and issued in the form of an executable file. Thereby completing all preparation required for the RPC call. The method simplifies the process of issuing the RPC call, and improves the safety, reliability and easy maintainability of the code.
An embodiment of the present disclosure provides a third embodiment, that is, an electronic device, where the electronic device is used in a method for generating a remote procedure call toolkit, and the electronic device includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the one processor to cause the at least one processor to perform the method of generating a remote procedure call toolkit according to the first embodiment.
A fourth embodiment of the present disclosure provides a computer storage medium for generating a remote procedure call toolkit, where the computer storage medium stores computer-executable instructions that can execute the method for generating the remote procedure call toolkit as described in the first embodiment.
Referring now to FIG. 3, shown is a schematic diagram of an electronic device suitable for use in implementing embodiments of the present disclosure. The terminal device in the embodiments of the present disclosure may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (tablet computer), a PMP (portable multimedia player), a vehicle terminal (e.g., a car navigation terminal), and the like, and a stationary terminal such as a digital TV, a desktop computer, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 3, the electronic device may include a processing device (e.g., a central processing unit, 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 device 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 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.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, 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 devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination 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 present 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 contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. 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, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, 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 communications 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 network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
Computer program code for carrying out operations for the present disclosure may be written in any combination of 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 type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart 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 described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of an element does not in some cases constitute a limitation on the element itself.
The functions described herein above 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: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), 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. A 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 exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while 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. Under 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 limitations on the scope of the 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 disclosed as example forms of implementing the claims.

Claims (10)

1. A method of generating a remote procedure call toolkit, comprising:
acquiring the package information of a dependent package associated with the first remote procedure call, and installing a corresponding dependent package in a remote procedure call frame 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 written in an interface description language associated with the first remote procedure call;
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 a project file based on the first master file and the first slave file;
updating a project profile of the project file based on the first master 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 obtaining 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 the preset code warehouse identification and the preset first main path.
3. The method of claim 2, wherein analyzing the first master file to obtain each first slave file comprises:
analyzing the first master file to obtain each first slave path;
and respectively pulling the corresponding first slave files through the slave calling application program interface based on each first slave path.
4. The method of claim 2, wherein 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 name space of each remote procedure call service; wherein the name space is a registered name of the remote procedure call service in the micro service;
acquiring a project configuration file of the project file;
generating a first abstract syntax tree based on the project profile;
generating a node 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;
and updating the project configuration file of the project file based on the second abstract syntax tree.
5. The method of claim 1, wherein generating client code for the first remote procedure call based on the first master file and the first slave file comprises:
generating a client TS type declaration code for the first remote procedure call based on the first master file and the first slave file;
generating instantiated client code for the first remote procedure call based on the first master file and the first slave file.
6. The method of claim 1, wherein obtaining package information of a dependency package associated with the first remote procedure call and installing a corresponding dependency package according to the package information of each dependency package in a remote procedure call framework comprises:
acquiring a dependency package information file;
acquiring the package information of the installed dependency package according to the dependency package information file;
obtaining package information of a dependency 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 to obtain the package information of the 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 comprises a package name and package version information.
8. An apparatus for generating a remote procedure call toolkit, comprising:
the installation dependent package unit is used for acquiring the package information of the dependent package associated with the first remote procedure call and installing the corresponding dependent package according to the package information of each dependent package in the remote procedure call framework;
a get first master file unit to get 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 written in an interface description language associated with the first remote procedure call;
the first slave file acquisition unit is used for analyzing the first master file and acquiring each first slave file; wherein the first slave document is a document written by an interface description language;
a project file generation unit for generating a project file based on the first master file and the first slave file;
an update project profile unit for updating the project profile of the project 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, mount the client code in an application context variable of the remote procedure call framework, and generate a client file;
and the generation toolkit unit is used for generating an executable toolkit of the first remote procedure call based on the dependency kit, the engineering file, the project configuration file and the client file.
9. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out 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 carry out the method of any one 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 true CN111309375A (en) 2020-06-19
CN111309375B 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)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930363A (en) * 2020-08-07 2020-11-13 北京字节跳动网络技术有限公司 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
CN112596753A (en) * 2020-12-29 2021-04-02 上海瑞家信息技术有限公司 Dependency package installation method and device, electronic equipment and computer readable medium
JP2021108139A (en) * 2020-09-24 2021-07-29 北京百度網訊科技有限公司 Rpc member information acquisition method, device, electronic apparatus, storage medium, and computer program product
RU2814437C1 (en) * 2023-09-18 2024-02-28 Общество с ограниченной ответственностью "Облачные технологии" (ООО "Облачные технологии") Method and device for generating remote calls

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080263572A1 (en) * 2007-04-19 2008-10-23 Yang Jin Seok Fuzzing system and method of distributed computing environment (dce) remote procedure call (rpc)
US20160070609A1 (en) * 2014-09-04 2016-03-10 International Business Machines Corporation Automatically generating efficient remote procedure call (rpc) code for heterogeneous systems
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080263572A1 (en) * 2007-04-19 2008-10-23 Yang Jin Seok Fuzzing system and method of distributed computing environment (dce) remote procedure call (rpc)
US20160070609A1 (en) * 2014-09-04 2016-03-10 International Business Machines Corporation Automatically generating efficient remote procedure call (rpc) code for heterogeneous systems
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系统中的应用研究" *

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111930363A (en) * 2020-08-07 2020-11-13 北京字节跳动网络技术有限公司 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
CN111930363B (en) * 2020-08-07 2023-11-24 抖音视界有限公司 Block interface code generation method and device
JP2021108139A (en) * 2020-09-24 2021-07-29 北京百度網訊科技有限公司 Rpc member information acquisition method, device, electronic apparatus, storage medium, and computer program product
JP7083416B2 (en) 2020-09-24 2022-06-10 ベイジン バイドゥ ネットコム サイエンス テクノロジー カンパニー リミテッド RPC member information acquisition method, equipment, electronic devices, storage media and computer program products
CN112596753A (en) * 2020-12-29 2021-04-02 上海瑞家信息技术有限公司 Dependency package installation method and device, electronic equipment and computer readable medium
RU2814437C1 (en) * 2023-09-18 2024-02-28 Общество с ограниченной ответственностью "Облачные технологии" (ООО "Облачные технологии") Method and device for generating remote calls

Also Published As

Publication number Publication date
CN111309375B (en) 2023-07-04

Similar Documents

Publication Publication Date Title
CN111309375B (en) Method, device, medium and electronic equipment for generating remote procedure call toolkit
CN112286529B (en) Front-end page development method, device, equipment and storage medium
CN111930534A (en) Data calling method and device and electronic equipment
CN111367516B (en) Application interface generation method and device and electronic equipment
CN111309304B (en) Method, device, medium and electronic equipment for generating IDL file
CN111338944B (en) Remote Procedure Call (RPC) interface testing method, device, medium and equipment
CN112748962A (en) Application loading method and device, electronic equipment and computer readable medium
CN113900721A (en) Operating system starting method and device and electronic equipment
CN110221857A (en) The problem of application program restorative procedure, device, electronic equipment and storage medium
CN112631590A (en) Component library generation method and device, electronic equipment and computer readable medium
CN109981546B (en) Method and device for acquiring remote call relation between application modules
CN110704050B (en) Module initializing method and device, electronic equipment and computer readable storage medium
CN114398035A (en) Method, apparatus, device and computer readable medium for providing service using component
CN114860213A (en) Application package generation method, device, equipment and medium
CN116360802A (en) Middleware processing method, middleware processing device, electronic equipment and storage medium
CN109669679B (en) Service detection and processing method and device and electronic equipment
CN111381898B (en) Interface calling method and device, mobile terminal and storage medium
CN113434124B (en) Method, device, equipment and medium for constructing multilingual project engineering
CN111309367A (en) Method, device, medium and electronic equipment for managing service discovery
CN115630352B (en) CA integrated authentication method, device, electronic equipment and computer readable medium
CN111221513B (en) Method, device, medium and electronic equipment for adjusting cascading style sheet
CN114047922B (en) Transcoding method, device, medium and equipment for precompiled device
CN111796802B (en) Function package generation method and device and electronic equipment
CN118012470B (en) Updating method and device for power information management application, electronic equipment and medium
CN112905167B (en) Application operation method and device and electronic equipment

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