 |
Component
of remote procedure call: user, user-stud, communication package, server-stub,
server |
 |
Procedure
 |
user
places normal local call |
 |
user-stub
does binding and makes packets with procedure call and arguments |
 |
communication
package transfers the packets reliably |
 |
server-stub
unpacks the packets and call server as a local call |
 |
server-stub
packs the result of local call |
 |
communication
package transfers the result packet |
 |
user-stub
unpacks the packet and pass the result to user |
|
 |
All
communication is done in blocking mode |
 |
Absolutely
the same semantics of local call: if user and server are brought to a
single machine and bound together, they will work! |
 |
Distributed
programming in RPC
 |
write
interfaces, like *.h file |
 |
write
the server which implements those interfaces |
 |
write
the client which calls those interfaces |
 |
pass
the interfaces to Lupine, which then generates user-stub and
server-stub |
 |
=>
No network programming at all! |
 |
However
the programmer needs to pass information needed for binding and be
prepared to handle machine or communication error |
|
 |
This
system uses Grapevine distributed database |
 |
Both
of type and instance are represented by RNames of the same registry, i.e.
entries in the single logical database
 |
Type:
group entry whose members are RNames of instance of the type |
 |
Instance:
individual entry which represents a host which exports the interface |
|
 |
Export
& Import
 |
server
calls Export(type, name) -> server-stub calls
ExportInterface(type, instance, ...)
 |
->
update the database: add the instance as a member of type
RName |
 |
->
stash information about export, including a unique id, into a
table inside server-stub |
|
 |
client
calls Import(type, name) -> user-stub calls
ImportInterface(type, instance, ...)
 |
->
do database query to get ip-address of the exporter
 |
Contact
any registry server and get a registry server for RPC
registry |
 |
Get
the member (= the exporter) of the type RName from the
RPC registry |
|
 |
->
contact the exporter -> exporter replies with the
unique id and table index |
 |
->
ip-addr, id, table index are stashed in user-stub |
|
|
 |
->
After binding, all RPC packets from caller to callee have these
information |
 |
->
Server-stub uses the table index to check the id and call the appropriate
function |
 |
Binding
to any server
 |
client
calls Import(type) -> user-stub gets all member of the type
from the database -> tries in turn in the order of ... |
|
 |
Binding
without using Grapevine
 |
client
calls Import(type, ip-addr) -> user-stub contacts server-stub
directly using the ip-addr |
|