[go: up one dir, main page]

CN110096381A - Implementation method, device, equipment and the medium of remote procedure call - Google Patents

Implementation method, device, equipment and the medium of remote procedure call Download PDF

Info

Publication number
CN110096381A
CN110096381A CN201910389697.9A CN201910389697A CN110096381A CN 110096381 A CN110096381 A CN 110096381A CN 201910389697 A CN201910389697 A CN 201910389697A CN 110096381 A CN110096381 A CN 110096381A
Authority
CN
China
Prior art keywords
message
remote procedure
procedure call
functional module
demand
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
CN201910389697.9A
Other languages
Chinese (zh)
Other versions
CN110096381B (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.)
Baidu Online Network Technology Beijing Co Ltd
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910389697.9A priority Critical patent/CN110096381B/en
Publication of CN110096381A publication Critical patent/CN110096381A/en
Application granted granted Critical
Publication of CN110096381B publication Critical patent/CN110096381B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Telephonic Communication Services (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The embodiment of the invention discloses a kind of implementation method of remote procedure call, device, equipment and media.This method is applied to block chain node, the block chain node local disposition has message center and at least one functional module, this method comprises: the remote procedure call request that the message center is initiated according to the functional module, demand is subscribed to for the functional module registration message, and using the functional module as subscriber, wherein, the remote procedure call request is that other nodes are sent to one or more of block chain network;When the message center receives feedback message of other nodes for the remote procedure call request, according to the corresponding message subscribing demand, the corresponding call result of the feedback message is fed back into the subscriber.The scheme of the embodiment of the present invention is to play the decentralization multinode advantage of block catenary system when realizing remote procedure call function.

Description

Implementation method, device, equipment and the medium of remote procedure call
Technical field
The present embodiments relate in block catenary system data transmission technology more particularly to a kind of remote procedure call Implementation method, device, equipment and medium.
Background technique
In the prior art, certain demands are based on, equipment may need to carry out remote procedure call (Remote Procedure Call, abbreviation RPC).For example, the application program on some mobile terminal needs to send RPC request to corresponding service server, To obtain the result of feedback.As it can be seen that RPC technology is normally based on server-side/client mode to realize funcall.
Block catenary system is typical decentralization network system, generally includes multiple block chain nodes, can between node Interaction data realizes the function that block chain is supported.Block catenary system is generally based on peer-to-peer network (Peer-to-peer Networking, abbreviation p2p network) Lai Shixian inter-node communication, that is, node can be laid with network module, and node is respective Communication interaction is carried out based on p2p agreement between network module.
Therefore, when the program in block chain node needs to realize RPC function, just and in going based on p2p network implementations Heart block chain network mismatches, and cannot achieve the invocation pattern of client-side/server-side, can not also play block catenary system Decentralization multinode advantage.
Summary of the invention
The embodiment of the present invention provides implementation method, device, equipment and the medium of a kind of remote procedure call, to realize far When journey invocation of procedure function, the decentralization multinode advantage of block catenary system is played.
In a first aspect, being applied to block chain link the embodiment of the invention provides a kind of implementation method of remote procedure call Point, the block chain node local disposition have message center and at least one functional module, this method comprises:
The remote procedure call request that the message center is initiated according to the functional module is registered for the functional module Message subscribing demand, and using the functional module as subscriber, wherein the remote procedure call request is to block link network What other nodes of one or more of network were sent;
When the message center receives feedback message of other nodes for the remote procedure call request, according to right The corresponding call result of the feedback message is fed back to the subscriber by the message subscribing demand answered.
Second aspect, the embodiment of the invention also provides a kind of implementation methods of remote procedure call, are applied to block chain Node, the block chain node local disposition have message center and at least one functional module, this method comprises:
The remote procedure call request that the message center is initiated according to the functional module is registered for the functional module Message subscribing demand, and using the functional module as subscriber, wherein the remote procedure call request is to block link network What other nodes of one or more of network were sent;
When the message center receives feedback message of other nodes for the remote procedure call request, according to right The corresponding call result of the feedback message is fed back to the subscriber by the message subscribing demand answered.
The third aspect, the embodiment of the invention also provides a kind of realization devices of remote procedure call, are configured at block chain The message center of node, the block chain node local disposition have message center and at least one functional module, which includes:
Subscription demand registration module, the remote procedure call request for being initiated according to the functional module are the function Can Module registers message subscribing demand, and using the functional module as subscriber, wherein the remote procedure call request is It is sent to other nodes of one or more of block chain network;
Call result feedback module, the feedback message for being directed to the remote procedure call request for receiving other nodes When, according to the corresponding message subscribing demand, the corresponding call result of the feedback message is fed back into the subscriber.
Fourth aspect, the embodiment of the invention also provides a kind of realization devices of remote procedure call, are configured at block chain The functional module of node, the block chain node local disposition have message center and at least one functional module, described device packet It includes:
Request generates sending module, requests for generating remote procedure call request, and by the far call to block Other nodes of one or more of chain network are sent;
Registration request module, for requesting the message using the remote procedure call request as message subscribing demand Center registration message subscribes to demand;
Call result obtains module, for being directed to the remote procedure call request to the message center in other nodes When feedback message is provided, the call result of the remote procedure call of the message center feedback is obtained.
5th aspect, the embodiment of the invention also provides a kind of equipment, which includes:
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing Device realizes the implementation method of the remote procedure call as described in any embodiment of that present invention.
6th aspect, the embodiment of the invention also provides a kind of computer readable storage mediums, are stored thereon with computer Program realizes the implementation method of the remote procedure call as described in any embodiment of that present invention when the program is executed by processor.
The technical solution of the embodiment of the present invention, in block chain node local disposition message center and at least one function mould Block, the remote procedure call request that the message center is initiated according to the functional module are the functional module registration message Subscription demand, and using the functional module as subscriber, wherein the remote procedure call request is into block chain network Other one or more nodes send;The message center receives other nodes for the remote procedure call request Feedback message when, according to the corresponding message subscribing demand, the corresponding call result of the feedback message is fed back into institute State subscriber.The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould The remote procedure call request that block generates can carry out the registration of subscription demand by the heart in the message.When other nodes are provided to the node When feedback message, message center finds remote procedure call corresponding to the feedback message and asks according to the registration of the demand of subscription The promoter asked, to be fed back.Thus it solves in p2p network, is communicated between node, but can not be in recognition node Initiate the problem of specific functional modules of remote procedure call request in portion.So as to realize RPC technology in block chain network, Also the multinode advantage of decentralization network has been played, functional module need not fix to some specific node and initiate long-range mistake Journey call request.
Detailed description of the invention
Fig. 1 is the local structure deployment schematic diagram of block chain node provided in an embodiment of the present invention;
Fig. 2 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention one provides;
Fig. 3 is a kind of flow chart of the implementation method of remote procedure call provided by Embodiment 2 of the present invention;
Fig. 4 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention three provides;
Fig. 5 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention four provides;
Fig. 6 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention five provides;
Fig. 7 is a kind of structural block diagram of the realization device for remote procedure call that the embodiment of the present invention six provides;
Fig. 8 is a kind of structural block diagram of the realization device for remote procedure call that the embodiment of the present invention seven provides;
Fig. 9 is a kind of structural schematic diagram for equipment that the embodiment of the present invention eight provides.
Specific embodiment
The present invention is described in further detail with reference to the accompanying drawings and examples.It is understood that this place is retouched The specific embodiment stated is used only for explaining the present invention rather than limiting the invention.It also should be noted that in order to just Only the parts related to the present invention are shown in description, attached drawing rather than entire infrastructure.
Before introducing the embodiment of the present invention, first to the deployment scenario of the block chain node local in the embodiment of the present invention into Row explanation, specifically, Fig. 1 is the local structure deployment schematic diagram of block chain node provided in an embodiment of the present invention.Such as Fig. 1 institute Show, the block chain node local disposition of the embodiment of the present invention has message center 10 and at least one functional module 11, wherein message Center 10 can be a treatment progress for being previously deployed at intra-node, which may be implemented registration message subscription Demand and reception simultaneously feed back the functions such as call result 12 to functional module 11.Except special circumstances such as localized nodes equipment closings Outside, message center 10 is usually to be constantly in starting state.Functional module 11 is to be previously deployed at intra-node for realizing certain The module of a little functions, which can be (can be system-Level software, is also possible to apply with hardware and/or software Grade software, or be also possible to realize the subprogram of certain functions) form be deployed in intra-node, functional module 11 can be real Existing function has very much, such as can be and realize function of transferring accounts, authentication function, the write-in of data and deletion function etc., to this Embodiment is without limiting.The functional module 11 of the embodiment of the present invention is after generating remote procedure call request, to block link network One or more nodes in network are sent;Also, the subscription demand registration of remote procedure call request is carried out to message center 10; Message center obtains and handles the feedback message of other nodes offer, call result required for feeding back it to functional module 11 12.Specifically, how the block chain node of deployment of the embodiment of the present invention realizes that the detailed implementation of remote procedure call will be Following embodiments describe in detail.
Embodiment one
Fig. 2 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention one provides, the present embodiment It is applicable in block chain network, come the case where realizing remote procedure call by the way of decentralization.This method can be with It is executed by block chain node, can preferentially be executed by the message center in block chain node, it should be noted that the present invention is real The block chain node local disposition for applying example has message center and at least one functional module.This method can be by configuring in block chain link The realization device of remote procedure call in point is realized, for example, it may be configuration is in the message center in block chain node The realization device of remote procedure call realize.The device can be realized by the way of software and/or hardware, and can integrate In the electronic equipment of carrying block chain link point, this method specifically comprises the following steps:
S201, the remote procedure call request that message center is initiated according to functional module are ordered for functional module registration message Demand is read, and using functional module as subscriber.
Wherein, the remote procedure call request is that other nodes are sent to one or more of block chain network.
Remote procedure call (RPC) request can be one kind requests service by network from remote computer program, and It is not required to the request it is to be understood that underlying network technology agreement.The remote procedure call request is that have remote process tune in functional module When with demand, the request for being used to request other equipment feedback call result of generation.Optionally.The remote procedure call demand can To be functional module during running its hardware or software corresponding program code, need remotely to call number from other equipment According to when generate.For example, if localized nodes equipment is the lightweight node device of not memory block chain data, if the machine section at this time When money transfer transactions functional module in point device needs to call the balance data of account A, the remaining sum number for calling account A will be generated According to remote procedure call request.
It in embodiments of the present invention, can be into block chain network after functional module initiates a remote procedure call request Other one or more nodes send.Preferably through peer-to-peer network, other node broadcasts into block chain network are sent 's.Alternatively, being also possible in the form of unicast or multicast, sent to other one or more nodes.
Since functional module is the internal processes of node, so working as message of other nodes to the node feeding back call result When, this can not be navigated to by feedback message, which functional module be supplied to.So in embodiments of the present invention, functional module is initiated When remote procedure call request, demand also is subscribed to message center registration message.
Optionally, in the embodiment of the present invention, message center obtains the remote procedure call request that functional module is initiated, then Execute message subscribing.The mode of acquisition has very much, to this embodiment of the present invention without limiting.It such as can be functional module sending out After playing remote procedure call request, the related program code at initiation message center can be triggered, and the remote procedure call of generation The input parameter as the program code is requested, message center will receive the remote procedure call of functional module initiation at this time Request.It can also be that message center is shut off by the remote procedure call request generated to functional module each in localized nodes Mode carry out the remote procedure call request of receiving module initiation, for example, message center is provided with monitor process, the monitoring Process can monitor each functional module disposed in localized nodes in real time, generate remote procedure call when listening to a certain functional module When request, message center will shut off the message request, obtain the remote procedure call request.
Message subscribing demand can refer to that data call corresponding to the remote procedure call request of functional module initiation needs It asks, for example, the message subscribing demand may is that at this time if remote procedure call request is request call current block data Subscribe to the feedback message of current block data;If remote procedure call request is request call money transfer transactions intelligence contract, this When the message subscribing demand may is that subscribe to money transfer transactions intelligence contract feedback message.
It in embodiments of the present invention, can be by the remote process tune after message center receives remote procedure call request It uses request as a message subscribing demand, and registers the message subscribing demand for functional module, in order to which message center is subsequent When getting the feedback message of other each nodes in block chain network, promptly and accurately the corresponding calling of feedback message can be tied Fruit feeds back to each subscriber.For example, after having registered the message subscribing request for subscribing to current block data for the first functional module, when After message center obtains the current block data of each server node feedback, it will be able to, will by the message subscribing demand of registration Current block data feedback is to the first functional module.Optionally, subscribing to demand for functional module registration message can be the function Energy Module registers are subscriber, and register the call result for needing to feed back for the subscriber.Subscriber, which can refer to have, to disappear A side of subscription demand is ceased, subscriber can be the functional module for initiating remote procedure call request in the embodiment of the present invention.Tool Body, message center is that the mode that functional module registration message subscribes to demand has much according to remote procedure call request.For example, It can be the corresponding message team called type of message, be functional module registration is directed to the type of message of analysis far call request The message subscribing demand of column;It can also be and the corresponding readjustment of the remote procedure call request is determined according to remote procedure call request The result that call back function generates is registered as the feedback result of message subscribing demand by function;Other modes can also be used for function Energy Module registers message subscribing demand, to this embodiment of the present invention without limiting.Optionally, how for functional module register needle Message subscribing demand to the message queue of the type of message and how call back function determined according to remote procedure call request, And call back function is registered as to the specific method of the feedback result of message subscribing demand, it will be situated between in detail in subsequent embodiment It continues.
Further, in block chain node different function module there may be simultaneously or whithin a period of time needed for call The identical situation of data.Message center is executed in the remote procedure call request for receiving functional module initiation as functional module When registration message subscribes to demand, it can be message center and identify whether remote procedure call request has existed message subscribing and need It asks;If it is not, then message center is functional module registration message subscription demand, and using functional module as subscriber;If so, disappearing Functional module is added to the subscriber of already existing message subscribing demand by breath center.When other nodes are directed to remotely in network When procedure call request feeds back multiple identical message, message center can be rejected subsequent within the effective time of setting Repetition message.
Specifically, message center obtains the remote procedure call at this and asks if being directed to a certain remote procedure call request Before asking, the corresponding message subscribing demand of the remote procedure call request, and the message are had registered for a certain functional module Subscription demand is not canceled (under normal conditions, for a message subscribing demand, when having fed back call result to subscriber Afterwards, message center can nullify the message subscribing demand), then this remote process tune for receiving of description messages center Message subscribing demand is had existed in the request in the message process of the heart, is no longer needed at this time to send the functional module of the request New message subscribing demand is registered, can be added in the corresponding subscriber of already present message subscribing demand and send this far The functional module of journey procedure call request.If, in the process at description messages center there is no there are this receive it is long-range The corresponding message subscribing demand of procedure call request can execute at this time according to the remote procedure call request received as hair The functional module registration message of the request is given to subscribe to demand, and using the functional module as the operation of subscriber.
S202, when message center receives feedback message of other nodes for the remote procedure call request, according to The corresponding call result of feedback message is fed back to subscriber by corresponding message subscribing demand.
Wherein, feedback message can be other nodes in block chain network according to the remote procedure call request received The message of feedback, for example, the feedback message of other nodes can at this time if long-range call request excessively is to obtain current block data To be the data of current block.If long-range call request excessively is to obtain money transfer transactions intelligence contract, other nodes is anti-at this time Feedback message can be the data for being stored with the block of money transfer transactions intelligence contract, be also possible to money transfer transactions intelligence contract.It adjusts It can be functional module with result and send the data that remote procedure call request wants calling, may be exactly that message center connects The feedback message received, it is also possible to the data obtained after needing to be further processed feedback message.For example, it is assumed that functional module Sending the data called needed for remote procedure call request is money transfer transactions intelligence contract, at this point, if feedback message is to be stored with The data of the block of money transfer transactions intelligence contract, then need that feedback message is further processed, from being stored with money transfer transactions Money transfer transactions intelligence contract is found out in the block data of intelligent contract as the corresponding call result of feedback message;If feedback disappears Breath is exactly money transfer transactions intelligence contract, then feedback message is exactly its corresponding call result at this time.
Optionally, in each node that localized nodes receive the remote procedure call request, it is ready called data When feedback message transmitted by node, message center can listen to feedback message, according to the corresponding message subscribing need of the message It asks, determines each subscriber for registering the message subscribing demand, and the corresponding call result of feedback message fed back to corresponding each Subscriber.It should be noted that message center is being executed according to corresponding message subscribing demand in embodiments of the present invention, it will be anti- When the corresponding call result of feedback message feeds back to subscriber, used mode depends on the mode that registration message subscribes to demand. Specifically, how the mode of demand subscribed to according to different registration message execute the operation of this step will subsequent embodiment into Row is discussed in detail.
Optionally, when multiple nodes into block chain network send remote procedure call request, it is possible to can receive Multiple feedback messages of multiple node feeding backs.When message center receives multiple nodes for the multiple of remote procedure call request When feedback message, multiple feedback messages are formed into message array;Message center is according to corresponding message subscribing demand, by message count Group feeds back to the subscriber, obtains call result so that subscriber screens from the message array.Specifically, when in message When the heart receives multiple feedback messages, Screening Treatment can not be carried out to multiple feedback messages, but it is directly more by what is received A feedback message constitutes message array, and according to the corresponding message subscribing demand of the message array, determination has registered the message subscribing The subscriber of demand, and the message array is fed back to each subscriber for registering with the message subscribing demand, certainly by each subscriber Body carries out Analysis and Screening to the data in message array, determines final call result.Optionally, as the function of subscriber The process that module carries out Analysis and Screening to the data in message array can be, and the highest number of repetitive rate is selected from message array According to as final call result;It can also be the data for selecting its trusted node to feed back from message array as final tune With result;It is also possible to be greater than in message array data that the node of preset ratio (such as 80%) is all fed back as finally Call result.
It should be noted that in embodiments of the present invention, for the message subscribing demand of registration, being fed back when to subscriber After the corresponding call result of message subscribing demand, message center can nullify the message subscribing demand, and release storage is empty Between.Optionally, call result can be quickly found when there are the message subscribing demand for the ease of follow-up function module, The embodiment of the present invention can also be after having fed back the corresponding call result of message subscribing demand to subscriber, and not removing at once should Message subscribing demand (such as can be retain preset time then remove), but the subscriber of call result will be taken from the message It is deleted in the subscriber of subscription demand, guarantees no longer to repeat to send to the subscriber to subscribe to message reading notice.
The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould The remote procedure call request that block generates can carry out the registration of subscription demand by the heart in the message.When other nodes are provided to the node When feedback message, message center finds remote procedure call corresponding to the feedback message and asks according to the registration of the demand of subscription The promoter asked, to be fed back.Thus it solves in p2p network, is communicated between node, but can not be in recognition node Initiate the problem of specific functional modules of remote procedure call request in portion.So as to realize RPC technology in block chain network, Also the multinode advantage of decentralization network has been played, functional module need not fix to some specific node and initiate long-range mistake Journey call request.
Embodiment two
Fig. 3 is a kind of flow chart of the implementation method of remote procedure call provided by Embodiment 2 of the present invention, the present embodiment On the basis of the above embodiments, further optimization has been carried out, has shown in particular and uses the mode of message queue for function mould Block registration message subscribes to demand, and then realizes the concrete condition introduction of remote procedure call, and this method specifically includes:
S301, for message center according to remote procedure call request, whether determination need to call type of message belonging to message Through being at least one there are the quantity of the message queue of corresponding types, the message queue.
Wherein, type of message, which can be, divides the content of the message data of calling required for remote procedure call request It is obtained after class.Type of message may include it is following at least one: block data query messages, Transaction Information query messages, with And intelligent contract calls message.Optionally, since block chain data query message is relative to Transaction Information query messages and intelligence For contract message, granularity of division is thicker, so, fine-grained stroke further can also be carried out to block chain data query message Point, it is divided into current block data query message and history block data query messages etc..It should be noted that the present embodiment is not The type of message of division is defined, the division of type of message can be carried out according to the actual situation.
In embodiments of the present invention, one or more message queues can be registered in the process of message center, for depositing The feedback message of other node feeding backs in the block chain network received is stored up, each type of message in the present embodiment is all disappearing The message queue of storage the type feedback message is provided in the process at breath center.Optionally, in message center process Message queue can be pre-set (as each type of message presets at least one corresponding message queue);It can also Being created in real time when generating a new type of message.It optionally, can be corresponding by the type of message for calling frequency high Message queue be set as long term message queue;The corresponding message queue of the type of message for calling frequency low is set as disappearing in short term Cease queue.Long term message queue can be in message center process fixed existing message queue, and for short-term message queue, When can not have data in message queue, or subscribe to without subscriber the data of the message queue, which is nullified, Memory space is discharged, in order to which the corresponding message queue of other type of messages is arranged.
Optionally, message center can determine that functional module initiates the request and needs to adjust first according to remote procedure call request Type of message belonging to message data, then judge in the process of message center with the presence or absence of at least one type of message pair The message queue answered.For example, if it is request call current block data that message center, which recognizes remote procedure call request, it can To be first to analyze far call request, determine that functional module initiates the current block data category that the request is wanted to transfer In block data type of query message, then judge again in the process of message center with the presence or absence of block data type of query message Corresponding message queue.Alternatively, it is clear to the specified type of message for needing to subscribe to of message center to be also possible to functional module.
S302, if having existed corresponding message queue, message center is functional module registration for corresponding types The message subscribing demand of message queue, and using functional module as subscriber.
In embodiments of the present invention, if in the presence of the message that need to call type of message belonging to message in the process of message center Queue then can directly initiate the functional module registration of this remote procedure call request needed for obtaining in the message queue The message subscribing demand of data is called, and using the functional module as the subscriber of the message queue.For example, if message center There are the corresponding message queues of block data type of query message in process, then at this time can directly for the functional module registration from The message subscribing demand of current block data is called in the message queue of block data type of query message, and it is remote to initiate this The functional module of journey procedure call request is as subscriber.
Optionally, if the message queue that need to call type of message belonging to message is not present in the process of message center, After at least one new message queue first being created in the message for the type of message in the process of the heart, then execute above-mentioned for function Energy Module registers are directed to the message subscribing demand of the message queue of corresponding types, and using functional module as the operation of subscriber.
It should be noted that in the embodiment of the present invention, for a message queue, more message subscribing demands can be corresponding with With multiple subscribers.
S303, when message center receives feedback message of other nodes for remote procedure call request, Recognition feedback Type of message belonging to message.
Optionally, in embodiments of the present invention, after message center receives the message of other node feeding backs, due to will be anti- Feedback message is added in message queue to be called for subscriber, so wanting the first affiliated type of Recognition feedback message.Specifically, identification is anti- When presenting the affiliated type of message of message, if in feedback message including type of message relevant information (such as message belonging to feedback message Type identification), then it can be identified directly from type of message relevant information and determine type of message belonging to feedback message.If feedback Do not include type of message relevant information in message, then can be and the content of feedback message is analyzed, and then determines that this is anti- Present type of message belonging to message.For example, if the feedback message that message center receives other nodes is current block data, Obtaining the feedback data after analyzing the current block data content in the feedback message is exactly block data, at this time should The affiliated type of feedback message is determined as block data type of query message.
Feedback message is added in the message queue of corresponding types by S304, message center according to affiliated type of message.
Optionally, message center, can be directly each by what is received after type of message belonging to feedback message has been determined The feedback message of node feeding back is all added to the feedback message and corresponds in the message queue of type of message.For example, if having received The current block data of 3 node feeding backs of block chain network then can all add the current block data of this 3 node feeding backs It is added in the message queue of corresponding block data type of query message.
Optionally, the feedback message being added in message queue obeys the principle of first in first out, wherein the data packet stored Include the feedback message of this newly added feedback message and history addition.For the data stored in message queue, due to not true Whether fixed all subscribers have all read required data from message queue, also do not know whether there are also other subscription Side also needs to call the data in message queue;So the data stored in message queue can not be held after subscriber reads Row data-cleaning operation, but only carry out and add feedback message into message queue, when the data in message queue reach storage When the upper limit, the data being added in the message queue at first can be overflowed automatically according to the principle of first in first out, default will overflow at this time Data out are deleted from message queue.Optionally, can previously according to each message queue storing data characteristic (as shared by data The size of memory) it is that different size of queue storage space is arranged in each message queue.
S305, message center notify at least one subscription according at least one corresponding message subscribing demand of message queue Side reads the newly-increased message in message queue, as call result.
Optionally, it is needed for each subscriber for its message subscribing for having registered the message queue of corresponding type of message It asks, so at least one message subscribing demand is all corresponding with for each message queue, and for each message subscribing All there is at least one subscriber in demand, can notify registration should according to the corresponding each message subscribing demand of message queue at this time All subscribers of message demand read newly-increased data from the message queue.
For example, it is assumed that being had registered for subscriber 1 when subscribing to demand for subscriber's registration message and calling current block data Message subscribing demand, for subscriber 2 have registered call the 101st block block data message subscribing demand, be subscriber 3 The message subscribing demand for calling the block data of the 10th -20 block is had registered, the message subscribing demand of three subscribers is all Corresponding block data type of query message.When the feedback message received is added to block data query messages class by message center After in the message queue of type, the corresponding message subscribing demand of the message queue includes that the message subscribing of current block data is called to need It seeks, call the message subscribing demand of the block data of the 101st block and call the block data of the 10th -20 block Message subscribing demand, so calling the corresponding subscriber 1 of demand, subscriber 2 and subscriber 3 to read the message team by these three Newly-increased message in column, as call result.
It should be noted that calling knot corresponding to newly-increased message not necessarily message subscribing demand in message queue Fruit, so in the embodiment of the present invention, it, can when message center notifies at least one subscriber to read the newly-increased message in message queue Can there are some subscribers that call result needed for it is not read in message queue, if such as newly-increased in message queue disappearing Breath is that current block data, at this time subscriber 2 and subscriber 3 can not just find from the newly-increased message of the message queue and need to adjust Block data.But since the process of remote procedure call is usually real-time perfoming, so functional module is initiated remotely The feedback message aiming at the request received under normal conditions after procedure call request, so in actual mechanical process In, occur subscriber do not read in message queue call result required for it probability it is relatively low.
The technical solution of the embodiment of the present invention is adopted as functional module registration when subscribing to demand for functional module registration message The mode of the corresponding message queue of type of message, a message queue can correspond to multiple subscribers, considerably reduce message and order The registration amount for readding demand, improving message center is the efficiency that functional module registration message subscribes to demand, and then is improved long-range The efficiency of the invocation of procedure.
Embodiment three
Fig. 4 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention three provides, the present embodiment On the basis of the various embodiments described above, further optimization has been carried out, has shown in particular and uses the mode of call back function for function Module registers message subscribing demand, and then realize the concrete condition introduction of remote procedure call, this method specifically includes:
S401, message center are that functional module registration message subscribes to demand, and determines remote according to remote procedure call request Call back function, is registered as the feedback result of message subscribing demand by the corresponding call back function of journey procedure call request, and by function Module is as subscriber.
Wherein, call back function can be the function with certain function, can be used for one from block chain network Or data required for message subscribing demand are determined in the feedback message of multiple node feeding backs.Optionally, call back function has Function can include but is not limited to index function and decryption function etc..For example, can be used for the call back function of index function To inquire transaction data of A account, or a certain intelligent contract of inquiry etc. from a large amount of block data;For returning for decryption function Letter of transfer number can be used to that operation is decrypted to the feedback data of encryption, the feedback data after being decrypted.
Optionally, functional module is when initiating remote procedure call request, contains disappearing of need to calling in the request Call back function needed for ceasing data and calling the message data etc..Message center is being according to remote procedure call request at this time When functional module registration message subscribes to demand, the message data that can be called according to the need for including in request, for the functional module The corresponding message subscribing demand of message data that need to be called is registered, and corresponding call back function will be requested to be determined as remote process tune With requesting corresponding call back function, will by the call back function treated result as the feedback result of message subscribing demand, The call result for feeding back to subscriber will initiate the functional module of the remote procedure call request as the message subscribing demand Subscriber.Call back function generally can be the shared routine that the system level program of block chain node provides.
For example, if the remote procedure call request that functional module is initiated is the transaction note for calling account A from current block Record, required call back function are the call back functions with index transaction record function, at this point, message center can be long-range according to this The subscription demand for calling the transaction record of user A is registered in call request for the functional module, and determines that the remote procedure call is asked Seeking corresponding call back function is the call back function with index transaction record function, will pass through the call back function treated result Be registered as the feedback result of message subscribing demand, and subscription demand of the functional module as the transaction record that calls user A Subscriber.
S402, when message center receives feedback message of other nodes for remote procedure call request, according to correspondence Message subscribing demand determine call back function and subscriber.
Optionally, message center is needed when receiving feedback message of other nodes for remote procedure call request According to the corresponding message subscribing demand of remote procedure call request, first determine that the feedback result by the message subscribing demand is infused Subscriber corresponding to the call back function of volume and the message subscribing demand.
For example, if calling the remote process tune of the transaction record of account A in the slave current block initiated for functional module With request, other node feeding back message in block chain are current block data, and message center can be according to functional module at this time The remote procedure call request of initiation can determine that message subscribing demand is that the transaction note of account A is called from current block Record, since in S402, the call back function for the feedback result registration of the message subscribing demand is that have index transaction record function The call back function of energy, so at this point it is possible to determining that call back function is that have index transaction record function according to the message subscribing demand The call back function of energy, subscriber is the corresponding functional module of message subscribing demand.
S403, message center call the content in call back function processing feedback message, call result are formed, by call result Feed back to subscriber.
Optionally, after call back function and subscriber has been determined, message center can call determining call back function to handle Other nodes received are directed to the feedback message of remote procedure call request, form call result.Specifically, message center can Using the input parameter by the feedback information received as call back function, the related program code of call back function is run, is returned at this time The result of letter of transfer number output is call result, and the call result is then fed back to subscriber.For example, message center is determined Call back function is with the call back function of index transaction record function, and subscriber is functional module, can be called with rope at this time The call back function for drawing transaction record function, to other nodes received for the long-range current block number for crossing call request feedback According to being handled, the transaction record of account A wherein included is found out as call result, and by the friendship of the account A found Easily record feeds back to functional module.
Optionally, in embodiments of the present invention, message center has much to the mode that subscriber feeds back call result, example Such as, it can be and call result be directly pushed to subscriber.Result will be pushed by, which being also possible to, is added in a certain message queue, and It sends to subscribe to subscriber and reads notice, to notify subscriber to go in the message queue to read call result.It can also be used His mode feeds back call result to subscriber, to this present embodiment without limiting.
The technical solution of the embodiment of the present invention is adopted as functional module registration when subscribing to demand for functional module registration message Call back function is registered as the feedback result of message subscribing demand by message subscribing demand.It can accurately be ordered by call back function The call result that the side's of readding feedback needs, searching from all feedback messages without subscriber oneself can be quick and precisely Call result is obtained, the power consumption of subscriber is reduced, improves the efficiency of remote procedure call.
Example IV
Fig. 5 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention four provides, the present embodiment It is applicable to in block chain network, come the case where realizing remote procedure call by the way of decentralization.This method can To be executed by block chain node, can preferably be executed by the functional module in block chain node.Block chain in the present embodiment Node is similar with the various embodiments described above, and block chain node is locally deployed with message center and at least one functional module.The party Method can be realized by configuring the realization device of the remote procedure call in block chain node, for example, it may be configuration is in block The realization device of the remote procedure call in functional module in chain node is realized.The device can be using software and/or hard The mode of part is realized, and can be integrated in the electronic equipment of carrying block chain link point.
It should be noted that the remote procedure call request that the message center of above-described embodiment is based on is the present embodiment What functional module was initiated, and message center is in the feedback message for receiving other nodes in above-described embodiment, according to corresponding The call result of feedback message is fed back to the functional module of the present embodiment by message subscribing demand.In the message of above-described embodiment The functional module of the heart and the present embodiment interacts, and may be implemented to complete by the way of decentralization in block chain network Remote procedure call operation.
As shown in figure 5, this method specifically comprises the following steps:
S501, functional module generates remote procedure call request, and far call is requested one into block chain network Other a or multiple nodes are sent.
Optionally, it when the functional module in block chain node has remote procedure call demand, generates for requesting it The remote procedure call request of his node feeding back call result.For example, if localized nodes equipment is not memory block chain data Lightweight node device, if the money transfer transactions functional module in localized nodes equipment needs to call the balance data of account A at this time When, the remote procedure call request for calling the balance data of account A will be generated.
Functional module sends remote procedure call preferably through multiple node broadcasts of the p2p network into block chain network Request plays the advantage of decentralization multinode sufficiently to obtain the feedback result of multinode.Preferably, it is also possible to list Broadcast or the form of multicast to other nodes send remote procedure call request.
S502, functional module is using remote procedure call request as message subscribing demand, request message center registration message Subscription demand.
It in embodiments of the present invention, can be by the long-range mistake of initiation after functional module initiates a remote procedure call request Journey call request is supplied to message center as its message subscribing demand.
Specifically, it is functional module registration message that the operation of message center, which may include: according to remote procedure call request, Subscription demand, and using functional module as subscriber;Receive the feedback message that other nodes are directed to remote procedure call request When, according to corresponding message subscribing demand, the corresponding call result of feedback message is fed back into subscriber.Above-mentioned specific execution Detailed description has been carried out in previous embodiment in method, is no longer repeated herein.
Optionally, in embodiments of the present invention, functional module is using the remote procedure call request as message subscribing Demand after requesting the message center registration message subscription demand, can star subscription monitor process, monitoring information center hair The subscription message sent reads notice, and after notice is read in the subscription for listening to message center transmission, description messages center has been obtained The data for having taken functional module to need to call obtain the calling of the remote procedure call of message center feedback at this point, executing S503 As a result.
S503, when other nodes provide feedback message to message center for remote procedure call request, functional module Obtain the call result of the remote procedure call of message center feedback.
Optionally, message center depends on message center to the mode of functional module feedback call result as functional module note The mode of volume message subscribing demand, for example, if it is for need to call the affiliated message of message that message center, which is functional module registration, The message subscribing demand of the message queue of type, then message center receives other nodes for the anti-of remote procedure call request When presenting message, type of message belonging to Recognition feedback message;Feedback message is added to corresponding class according to affiliated type of message In the message queue of type;According at least one corresponding message subscribing demand of message queue, at least one subscriber is notified to read Newly-increased message in message queue, as call result.For the situation, functional module can be used as subscriber from message center Call result required for obtaining is searched in the message queue for notifying it to read.Optionally, the data in message queue have very much, It but is all not that data are called required for functional module, so the data that functional module can successively traverse in message queue obtain The data called required for its are got, if not getting the data for needing to call, can be and receive subscription in next time and disappear It when breath reads notice, then is searched from message queue and increases whether data are the data of required calling newly, need to adjust if getting Data, functional module can call success message to message center feedback message, and message center receives calling success After message, the message subscribing demand that will default the subscriber has been completed, and nullifies the message subscribing demand.
If message center is that functional module registration message subscribes to demand, and determines the corresponding readjustment of remote procedure call request Call back function is registered as the feedback result of the message subscribing demand by function, then message center receives other nodes and is directed to When the feedback message of remote procedure call request, call back function and subscriber are determined according to corresponding message subscribing demand;It calls The call back function handles feedback message, forms call result, call result is fed back to subscriber.For the situation, if message Call result is directly pushed to subscriber by center, then functional module can directly acquire message center feedback as subscriber The call result of remote procedure call;If message center is will to push result to be added in a certain message queue, and send subscription Message reads notice to inform that subscriber goes in a certain message queue to read call result, and functional module is as subscription root at this time It reads and notifies according to message, the call result of remote procedure call is read from the message queue of notice.
Optionally, when multiple nodes into block chain network send remote procedure call request, it is possible to can receive Multiple feedback messages of multiple node feeding backs.When message center receives multiple nodes for the multiple of remote procedure call request When feedback message, multiple feedback messages are formed into message array;Message center is according to corresponding message subscribing demand, by message count Group feeds back to the subscriber.Functional module obtains the call result of remote procedure call of message center feedback and includes: at this time If the call result of the remote procedure call of the message center feedback got is message array, functional module is according to message The repetition ratio of multiple feedback message contents in array, or the node situation of multiple feedback messages is provided, screening, which obtains, calls knot Fruit.
Specifically, Screening Treatment is not carried out to multiple feedback messages when message center receives multiple feedback messages, and It is that the multiple feedback messages received are directly constituted into message array, according to the corresponding message subscribing demand of the message array, really Surely the subscriber of the message subscribing demand is had registered, and the message array is fed back to and registers with respectively ordering for the message subscribing demand The side of readding carries out Analysis and Screening to the data in message array by each subscriber itself, determines final call result.Specifically , the process that the functional module as subscriber carries out Analysis and Screening to the data in message array can be, from message array It is middle to select to repeat the highest data of ratio as final call result;It can also be and select its trusted node from message array The data of feedback are as final call result;It is also possible to be greater than the node of preset ratio (such as 80%) in message array The data all fed back are as final call result.
It should be noted that although the embodiment of the present invention is the functional module and message center to dispose in block chain Interaction realizes what remote procedure call was introduced, but be not restricted to that message center can only once be carried out with a functional module Interaction executes the implementation method of the remote procedure call of the embodiment of the present invention, for the message center affixed one's name in the middle part of block chain node, Its remote procedure call that can execute the embodiment of the present invention parallel for multiple functional modules in the block chain node simultaneously Implementation method.
The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould After block generates remote procedure call request, the subscription registration of feedback message is carried out to message center.Calling is determined by message center As a result functional module is fed back to afterwards, to realize remote procedure call.Thus it solves in p2p network, node receives instead Can not identify it is the problem of which functional module initiates remote procedure call request after feedback message, without being each functional module Fixed server-side is set, allows to request remote procedure call service to multiple nodes in a network, is realizing remote process tune When with function, the decentralization multinode advantage of block catenary system is played.
Embodiment five
Fig. 6 is a kind of flow chart of the implementation method for remote procedure call that the embodiment of the present invention five provides.The present embodiment On the basis of foregoing embodiments, a kind of preferred embodiment is provided, the preferred embodiment is in the process for realizing remote procedure call In, it needs the message center in block chain node and cooperates between functional module to realize.
As shown in fig. 6, this method comprises:
S601, functional module generates remote procedure call request, and other are saved to one or more of block chain network Point is sent.
S602, functional module is using remote procedure call request as message subscribing demand, request message center registration message Subscription demand.
S603, message center obtain registration message and subscribe to demand.
S604, message center according to remote procedure call request are that functional module registration message subscribes to demand, and by function Module is as subscriber.
S605, when message center receives feedback message of other nodes for remote procedure call request, according to correspondence Message subscribing demand, the corresponding call result of feedback message is fed back into subscriber.
S606, functional module obtain the call result of the remote procedure call of the message center feedback.
The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould The remote procedure call request that block generates can carry out the registration of subscription demand by the heart in the message.When other nodes are provided to the node When feedback message, message center finds remote procedure call corresponding to the feedback message and asks according to the registration of the demand of subscription The promoter asked, to be fed back.Thus it solves in p2p network, is communicated between node, but can not be in recognition node Initiate the problem of specific functional modules of remote procedure call request in portion.So as to realize RPC technology in block chain network, Also the multinode advantage of decentralization network has been played, functional module need not fix to some specific node and initiate long-range mistake Journey call request.
Embodiment six
Fig. 7 is a kind of structural block diagram of the realization device for remote procedure call that the embodiment of the present invention six provides, the device The message center with block chain node can be configured.The block chain node local disposition of the present embodiment has message center and at least one A functional module.Long-range mistake provided by the above embodiment of the present invention one to embodiment three and embodiment five can be performed in the device The implementation method that journey is called is specific to execute the corresponding functional module of method and beneficial effect.As shown in fig. 7, the device includes:
Subscription demand registration module 701, the remote procedure call request for being initiated according to the functional module, is described Functional module registration message subscribes to demand, and using the functional module as subscriber, wherein the remote procedure call request It is that other nodes are sent to one or more of block chain network;
Call result feedback module 702, the feedback for being directed to the remote procedure call request for receiving other nodes When message, according to the corresponding message subscribing demand, the corresponding call result of the feedback message is fed back into the subscription Side.
The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould The remote procedure call request that block generates can carry out the registration of subscription demand by the heart in the message.When other nodes are provided to the node When feedback message, message center finds remote procedure call corresponding to the feedback message and asks according to the registration of the demand of subscription The promoter asked, to be fed back.Thus it solves in p2p network, is communicated between node, but can not be in recognition node Initiate the problem of specific functional modules of remote procedure call request in portion.So as to realize RPC technology in block chain network, Also the multinode advantage of decentralization network has been played, functional module need not fix to some specific node and initiate long-range mistake Journey call request.
Further, above-mentioned remote procedure call request is other nodes by peer-to-peer network, into block chain network Broadcast transmission.
Further, above-mentioned subscription demand registration module 701 is specifically used for:
According to the remote procedure call request, determination need to call whether type of message belonging to message has existed correspondence The message queue of type, the quantity of the message queue are at least one;
If having existed corresponding message queue, the message team of the corresponding types is directed to for functional module registration The message subscribing demand of column.
Further, above-mentioned type of message include it is following at least one: block data query messages, Transaction Information inquiry disappears Breath and intelligent contract call message.
Further, above-mentioned call result feedback module 702 is specifically used for:
When receiving feedback message of other nodes for the remote procedure call request, the feedback message institute is identified The type of message of category;
The feedback message is added in the message queue of corresponding types according to affiliated type of message;
According at least one corresponding message subscribing demand of the message queue, at least one described subscriber is notified to read Newly-increased message in the message queue, as call result.
Further, above-mentioned subscription demand registration module 701 also particularly useful for:
It is that the functional module registration message subscribes to demand, and determines described long-range according to the remote procedure call request The call back function is registered as the feedback result of the message subscribing demand by the corresponding call back function of procedure call request;
Correspondingly, above-mentioned call result feedback module 702 also particularly useful for:
When receiving feedback message of other nodes for the remote procedure call request, according to the corresponding message Subscription demand determines call back function and subscriber;
It calls the call back function to handle the content in the feedback message, call result is formed, by the call result Feed back to the subscriber.
Further, above-mentioned subscription demand registration module 701 also has and is used for:
Identify whether the remote procedure call request has existed message subscribing demand;
If it is not, then subscribing to demand for the functional module registration message, and using the functional module as subscriber;
If so, the functional module to be added to the subscriber of already existing message subscribing demand.
Further, above-mentioned call result feedback module 702 also particularly useful for:
When receiving multiple feedback message of multiple nodes for the remote procedure call request, by the multiple feedback Message forms message array;
According to the corresponding message subscribing demand, the message array is fed back into the subscriber, is ordered for described It is screened from the message array and obtains call result in the side of readding.
Embodiment seven
Fig. 8 is a kind of structural block diagram of the realization device for remote procedure call that the embodiment of the present invention seven provides, the device Can configure in the functional module of block chain node.The block chain node local disposition of the present embodiment has message center and at least One functional module.The reality of remote procedure call provided by the above embodiment of the present invention four to embodiment five can be performed in the device Existing method is specific to execute the corresponding functional module of method and beneficial effect.As shown in figure 8, the device includes:
Request generates sending module 801, requests for generating remote procedure call request, and by the far call to area Other nodes of one or more of block chain network are sent;
Registration request module 802, for disappearing described in request using the remote procedure call request as message subscribing demand Breath center registration message subscribes to demand;
Call result obtains module 803, for being directed to the remote procedure call request to the message in other nodes When center provides feedback message, the call result of the remote procedure call of the message center feedback is obtained.
The technical solution of the embodiment of the present invention, by block chain node local disposition message center, local function mould The remote procedure call request that block generates can carry out the registration of subscription demand by the heart in the message.When other nodes are provided to the node When feedback message, message center finds remote procedure call corresponding to the feedback message and asks according to the registration of the demand of subscription The promoter asked, to be fed back.Thus it solves in p2p network, is communicated between node, but can not be in recognition node Initiate the problem of specific functional modules of remote procedure call request in portion.So as to realize RPC technology in block chain network, Also the multinode advantage of decentralization network has been played, functional module need not fix to some specific node and initiate long-range mistake Journey call request.
Further, above-mentioned apparatus further include:
Message monitors module, needs for registration request module 802 using the remote procedure call request as message subscribing It asks, after requesting the message center registration message subscription demand, monitor process is subscribed in starting, is monitored the message center and is sent Subscription message read notice.
Further, above-mentioned call result obtains module 803 and is specifically used for:
If the call result of the remote procedure call of the message center feedback got is message array, According to the repetition ratio of feedback message contents multiple in the message array, or the node situation of multiple feedback messages is provided, sieve Choosing obtains call result.
Embodiment eight
Fig. 9 is a kind of structural schematic diagram for equipment that the embodiment of the present invention eight provides, and Fig. 9, which is shown, to be suitable for being used to realizing this The block diagram of the example devices of inventive embodiments embodiment.The equipment that Fig. 9 is shown is only an example, should not be to the present invention The function and use scope of embodiment bring any restrictions.Equipment typical case can be the equipment configured with block chain node.
As shown in figure 9, equipment 900 is showed in the form of universal computing device.The component of equipment 900 may include but unlimited In one or more processor or processing unit 916, memory 928, different system components (including memory 928 is connected With processing unit 916) bus 918.
Bus 918 indicates one of a few class bus structures or a variety of, including memory bus or Memory Controller, Peripheral bus, graphics acceleration port, processor or the local bus using any bus structures in a variety of bus structures.It lifts For example, these architectures include but is not limited to industry standard architecture (ISA) bus, microchannel architecture (MAC) Bus, enhanced isa bus, Video Electronics Standards Association (VESA) local bus and peripheral component interconnection (PCI) bus.
Equipment 900 typically comprises a variety of computer system readable media.These media can be it is any can be by equipment The usable medium of 900 access, including volatile and non-volatile media, moveable and immovable medium.
Memory 928 may include the computer system readable media of form of volatile memory, such as arbitrary access is deposited Reservoir (RAM) 930 and/or cache memory 932.Equipment 900 may further include other removable/nonremovable , volatile/non-volatile computer system storage medium.Only as an example, storage system 934 can be used for reading and writing not removable Dynamic, non-volatile magnetic media (Fig. 9 do not show, commonly referred to as " hard disk drive ").Although being not shown in Fig. 9, can provide Disc driver for being read and write to removable non-volatile magnetic disk (such as " floppy disk "), and to removable anonvolatile optical disk The CD drive of (such as CD-ROM, DVD-ROM or other optical mediums) read-write.In these cases, each driver can To be connected by one or more data media interfaces with bus 918.Memory 928 may include that at least one program produces Product, the program product have one group of (for example, at least one) program module, these program modules are configured to perform of the invention real Apply the function of each embodiment of example.
Program/utility 940 with one group of (at least one) program module 942, can store in such as memory In 928, such program module 942 includes but is not limited to operating system, one or more application program, other program modules And program data, it may include the realization of network environment in each of these examples or certain combination.Program module 942 Usually execute the function and/or method in described embodiment of the embodiment of the present invention.
Equipment 900 can also be logical with one or more external equipments 914 (such as keyboard, sensing equipment, display 924 etc.) Letter, can also be enabled a user to one or more equipment interact with the equipment 900 communicate, and/or with make the equipment 900 Any equipment (such as network interface card, modem etc.) that can be communicated with one or more of the other calculating equipment communicates.This Kind communication can be carried out by input/output (I/O) interface 922.Also, equipment 900 can also by network adapter 920 with One or more network (such as local area network (LAN), wide area network (WAN) and/or public network, such as internet) communication.Such as Shown in Fig. 9, network adapter 920 is communicated by bus 918 with other modules of equipment 900.Although should be understood that in Fig. 9 not Show, can with bonding apparatus 900 use other hardware and/or software module, including but not limited to: microcode, device driver, Redundant processing unit, external disk drive array, RAID system, tape drive and data backup storage system etc..
The program that processing unit 916 is stored in memory 928 by operation, thereby executing various function application and number According to processing, the equipment of the embodiment of the present invention be can be only fitted in the message center of block chain node device, or configuration is in block chain , it can be achieved that the implementation method of remote procedure call provided by any embodiment of the present invention in the functional module of node device.
Embodiment nine
The embodiment of the present invention nine also provides a kind of computer readable storage medium, be stored thereon with computer program (or For computer executable instructions), the processor which is configured in the message center of block chain node can be used for when executing A kind of implementation method of remote procedure call is executed, this method comprises:
The remote procedure call request that the message center is initiated according to the functional module is registered for the functional module Message subscribing demand, and using the functional module as subscriber, wherein the remote procedure call request is to block link network What other nodes of one or more of network were sent;
When the message center receives feedback message of other nodes for the remote procedure call request, according to right The corresponding call result of the feedback message is fed back to the subscriber by the message subscribing demand answered.
The processor that the program is configured in the functional module of block chain node can be used for executing a kind of long-range when executing The implementation method of the invocation of procedure, this method comprises:
The functional module generates remote procedure call request, and the far call is requested into block chain network Other one or more nodes are sent;
The functional module requests the message center to be infused using the remote procedure call request as message subscribing demand Volume message subscribing demand;
When other nodes provide feedback message to the message center for the remote procedure call request, the function Energy module obtains the call result of the remote procedure call of the message center feedback.
The computer storage medium of the embodiment of the present invention, can be using any of one or more computer-readable media Combination.Computer-readable medium can be computer-readable signal media or computer readable storage medium.It is computer-readable Storage medium for example may be-but not limited to-the system of electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor, device or Device, or any above combination.The more specific example (non exhaustive list) of computer readable storage medium includes: tool There are electrical connection, the portable computer diskette, hard disk, random access memory (RAM), read-only memory of one or more conducting wires (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD- ROM), light storage device, magnetic memory device or above-mentioned any appropriate combination.In this document, computer-readable storage Medium can be any tangible medium for including or store program, which can be commanded execution system, device or device Using or it is in connection.
Computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.
The program code for including on computer-readable medium can transmit with any suitable medium, including --- but it is unlimited In wireless, electric wire, optical cable, RF etc. or above-mentioned any appropriate combination.
Can with one or more programming languages or combinations thereof come write for execute the embodiment of the present invention operation Computer program code, described program design language include object oriented program language-such as Java, Smalltalk, C++, further include conventional procedural programming language-such as " C " language or similar program design language Speech.Program code can be executed fully on the user computer, partly be executed on the user computer, as an independence Software package execute, part on the user computer part execute on the remote computer or completely in remote computer or It is executed on server.In situations involving remote computers, remote computer can pass through the network of any kind --- packet It includes local area network (LAN) or wide area network (WAN)-is connected to subscriber computer, or, it may be connected to outer computer (such as benefit It is connected with ISP by internet).
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being implemented by above embodiments to the present invention Example is described in further detail, but the embodiment of the present invention is not limited only to above embodiments, is not departing from structure of the present invention It can also include more other equivalent embodiments in the case where think of, and the scope of the present invention is determined by scope of the appended claims It is fixed.

Claims (15)

1. a kind of implementation method of remote procedure call, which is characterized in that be applied to block chain node, the block chain node sheet Ground is deployed with message center and at least one functional module, which comprises
The remote procedure call request that the message center is initiated according to the functional module is the functional module registration message Subscription demand, and using the functional module as subscriber, wherein the remote procedure call request is into block chain network Other one or more nodes send;
When the message center receives feedback message of other nodes for the remote procedure call request, according to corresponding The corresponding call result of the feedback message is fed back to the subscriber by the message subscribing demand.
2. according to the method described in claim 1, it is characterized by: the remote procedure call request be by peer-to-peer network, What other node broadcasts into block chain network were sent.
3. the method according to claim 1, wherein the institute that the message center is initiated according to the functional module Remote procedure call request is stated, subscribing to demand for the functional module registration message includes:
For the message center according to the remote procedure call request, whether determination need to call type of message belonging to message There are the message queue of corresponding types, the quantity of the message queue is at least one;
If having existed corresponding message queue, the message center is that functional module registration is directed to the corresponding types Message queue message subscribing demand.
4. according to the method described in claim 3, it is characterized in that, the type of message include it is following at least one: block counts Message is called according to query messages, Transaction Information query messages and intelligent contract.
5. according to the method described in claim 3, it is characterized in that, the message center receives other nodes for described remote When the feedback message of journey procedure call request, according to the corresponding message subscribing demand, by the corresponding tune of the feedback message Feeding back to the subscriber with result includes:
When the message center receives feedback message of other nodes for the remote procedure call request, identify described anti- Present type of message belonging to message;
The feedback message is added in the message queue of corresponding types by the message center according to affiliated type of message;
The message center notifies to order described at least one according at least one corresponding message subscribing demand of the message queue The side of readding reads the newly-increased message in the message queue, as call result.
6. the method according to claim 1, wherein the institute that the message center is initiated according to the functional module Remote procedure call request is stated, subscribing to demand for the functional module registration message includes:
The message center is that the functional module registration message subscribes to demand, and determines according to the remote procedure call request The call back function, is registered as the feedback of the message subscribing demand by the corresponding call back function of the remote procedure call request As a result;
Correspondingly, when the message center receives feedback message of other nodes for the remote procedure call request, root According to the corresponding message subscribing demand, the corresponding call result of the feedback message, which is fed back to the subscriber, includes:
When the message center receives feedback message of other nodes for the remote procedure call request, according to corresponding The message subscribing demand determines call back function and subscriber;
The message center calls the call back function to handle the content in the feedback message, forms call result, will be described Call result feeds back to the subscriber.
7. the method according to claim 1, wherein the institute that the message center is initiated according to the functional module Remote procedure call request is stated, subscribes to demand for the functional module registration message, and using the functional module as subscriber Include:
The message center identifies whether the remote procedure call request has existed message subscribing demand;
If it is not, then the message center is that the functional module registration message subscribes to demand, and using the functional module as ordering The side of readding;
If so, the functional module is added to the subscriber of already existing message subscribing demand by the message center.
8. the method according to claim 1, wherein the message center receives other nodes for described remote When the feedback message of journey procedure call request, according to the corresponding message subscribing demand, by the corresponding tune of the feedback message Feeding back to the subscriber with result includes:
It, will be described when the message center receives multiple feedback message of multiple nodes for the remote procedure call request Multiple feedback messages form message array;
The message center feeds back to the subscriber according to the corresponding message subscribing demand, by the message array, with It is screened from the message array for the subscriber and obtains call result.
9. a kind of implementation method of remote procedure call, which is characterized in that be applied to block chain node, the block chain node sheet Ground is deployed with message center and at least one functional module, which comprises
The functional module generates remote procedure call request, and the far call is requested to one into block chain network Or other multiple nodes are sent;
The functional module requests the message center registration to disappear using the remote procedure call request as message subscribing demand Cease subscription demand;
When other nodes provide feedback message to the message center for the remote procedure call request, the function mould Block obtains the call result of the remote procedure call of the message center feedback.
10. according to the method described in claim 9, it is characterized in that, the functional module is by the remote procedure call request As message subscribing demand, after requesting the message center registration message subscription demand, further includes:
Monitor process is subscribed in the functional module starting, is monitored the subscription message that the message center is sent and is read notice.
11. according to the method described in claim 9, it is characterized in that, the functional module obtains the message center feedback The call result of the remote procedure call includes:
If the call result of the remote procedure call of the message center feedback got is message array, described Functional module is according to the repetition ratios of feedback message contents multiple in the message array, or provides the node of multiple feedback messages Situation, screening obtain call result.
12. a kind of realization device of remote procedure call, which is characterized in that it is configured at the message center of block chain node, it is described Block chain node local disposition has message center and at least one functional module, and described device includes:
Subscription demand registration module, the remote procedure call request for being initiated according to the functional module are the function mould Block registration message subscribes to demand, and using the functional module as subscriber, wherein the remote procedure call request is to area What other nodes of one or more of block chain network were sent;
Call result feedback module, when being directed to the feedback message of the remote procedure call request for receiving other nodes, According to the corresponding message subscribing demand, the corresponding call result of the feedback message is fed back into the subscriber.
13. a kind of realization device of remote procedure call, which is characterized in that it is configured at the functional module of block chain node, it is described Block chain node local disposition has message center and at least one functional module, and described device includes:
Request generates sending module, requests for generating remote procedure call request, and by the far call to block link network Other nodes of one or more of network are sent;
Registration request module, for requesting the message center using the remote procedure call request as message subscribing demand Registration message subscribes to demand;
Call result obtains module, for providing for the remote procedure call request to the message center in other nodes When feedback message, the call result of the remote procedure call of the message center feedback is obtained.
14. a kind of equipment, which is characterized in that the equipment includes:
One or more processors;
Memory, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now implementation method of the remote procedure call as described in any in claim 1-8 or 9-11.
15. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is by processor The implementation method of the remote procedure call as described in any in claim 1-8 or 9-11 is realized when execution.
CN201910389697.9A 2019-05-10 2019-05-10 Method, device, equipment and medium for realizing remote procedure call Active CN110096381B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910389697.9A CN110096381B (en) 2019-05-10 2019-05-10 Method, device, equipment and medium for realizing remote procedure call

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910389697.9A CN110096381B (en) 2019-05-10 2019-05-10 Method, device, equipment and medium for realizing remote procedure call

Publications (2)

Publication Number Publication Date
CN110096381A true CN110096381A (en) 2019-08-06
CN110096381B CN110096381B (en) 2021-05-07

Family

ID=67447683

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910389697.9A Active CN110096381B (en) 2019-05-10 2019-05-10 Method, device, equipment and medium for realizing remote procedure call

Country Status (1)

Country Link
CN (1) CN110096381B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111526047A (en) * 2020-04-15 2020-08-11 杭州溪塔科技有限公司 Block chain-based message queue design method and device
CN111614761A (en) * 2020-05-21 2020-09-01 腾讯科技(深圳)有限公司 Block chain message transmission method, device, computer and readable storage medium
WO2022042517A1 (en) * 2020-08-28 2022-03-03 京东方科技集团股份有限公司 Data management method, data management device, blockchain network and system
CN114968422A (en) * 2022-05-30 2022-08-30 蚂蚁区块链科技(上海)有限公司 Method and apparatus for automatically executing contracts based on variable states

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106789095A (en) * 2017-03-30 2017-05-31 腾讯科技(深圳)有限公司 Distributed system and message processing method
TW201810148A (en) * 2016-09-02 2018-03-16 現代財富控股有限公司 Load balancing system for blockchain and method thereof
CN107886329A (en) * 2017-11-28 2018-04-06 无锡井通网络科技有限公司 The clocked flip call method of system contract based on block chain technology
CN108023893A (en) * 2017-12-18 2018-05-11 王松山 A kind of method of block chain data recognizing system
CN108509523A (en) * 2018-03-13 2018-09-07 深圳前海微众银行股份有限公司 Structuring processing method, equipment and the readable storage medium storing program for executing of block chain data
CN108765159A (en) * 2018-06-04 2018-11-06 杭州秘猿科技有限公司 A kind of cochain based on block chain and condition processing method, device and interacted system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TW201810148A (en) * 2016-09-02 2018-03-16 現代財富控股有限公司 Load balancing system for blockchain and method thereof
CN106789095A (en) * 2017-03-30 2017-05-31 腾讯科技(深圳)有限公司 Distributed system and message processing method
CN107886329A (en) * 2017-11-28 2018-04-06 无锡井通网络科技有限公司 The clocked flip call method of system contract based on block chain technology
CN108023893A (en) * 2017-12-18 2018-05-11 王松山 A kind of method of block chain data recognizing system
CN108509523A (en) * 2018-03-13 2018-09-07 深圳前海微众银行股份有限公司 Structuring processing method, equipment and the readable storage medium storing program for executing of block chain data
CN108765159A (en) * 2018-06-04 2018-11-06 杭州秘猿科技有限公司 A kind of cochain based on block chain and condition processing method, device and interacted system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111526047A (en) * 2020-04-15 2020-08-11 杭州溪塔科技有限公司 Block chain-based message queue design method and device
CN111526047B (en) * 2020-04-15 2022-11-08 杭州溪塔科技有限公司 Block chain-based message queue design method and device
CN111614761A (en) * 2020-05-21 2020-09-01 腾讯科技(深圳)有限公司 Block chain message transmission method, device, computer and readable storage medium
WO2022042517A1 (en) * 2020-08-28 2022-03-03 京东方科技集团股份有限公司 Data management method, data management device, blockchain network and system
CN114968422A (en) * 2022-05-30 2022-08-30 蚂蚁区块链科技(上海)有限公司 Method and apparatus for automatically executing contracts based on variable states

Also Published As

Publication number Publication date
CN110096381B (en) 2021-05-07

Similar Documents

Publication Publication Date Title
CN110096381A (en) Implementation method, device, equipment and the medium of remote procedure call
US20220335214A1 (en) Device Identifier Dependent Operation Processing of Packet Based Data Communication
US10957326B2 (en) Device identifier dependent operation processing of packet based data communication
EP1897337B1 (en) Multidevice session establishment for multimodal browsing
JP2022003772A (en) Wireless connection establishment method, apparatus, device, and storage medium
CN109936587B (en) Control method, control device, electronic apparatus, and storage medium
US9854032B2 (en) Context-aware task offloading among multiple devices
US7831734B2 (en) Method and system for remote configuration of network devices
US20110161961A1 (en) Method and apparatus for optimized information transmission using dedicated threads
US20130091502A1 (en) System and method of providing virtual machine using device cloud
JP6335978B2 (en) System and method for providing a virtual communication session for some participants on a communication session
CN106921754A (en) Load balancing method, device, medium and electronic equipment for cluster system
CN110365796A (en) Service request processing method, device
CN106533932A (en) Method and device for pushing instant message
CN107800901A (en) User's call processing method, device, computer equipment and storage medium
CN102404367A (en) Asynchronous communication method and system
CN104935499A (en) Message format conversion method and equipment
CN110677475A (en) Micro-service processing method, device, equipment and storage medium
CN112069353A (en) Music playing control method and device, storage medium and electronic equipment
EP2262166A1 (en) Method, system and apparatus for realizing combined charging service
CN110336681A (en) A kind of matching process, device, electronic equipment and storage medium
CN104919863B (en) Subchannel for wireless data communication detects
CN113893528B (en) Game team processing method, device, medium and electronic equipment
CN109150981B (en) Block chain network networking method, device, equipment and computer readable storage medium
CN103348655A (en) Audio compression algorithm selection method, device and communication system in a virtual desktop scene

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