forked from jsnyder/luarpc
-
Notifications
You must be signed in to change notification settings - Fork 1
Design
edo1 edited this page Feb 2, 2011
·
1 revision
- Be simple
- Be thin for low-end systems
- Primary targeted as IPC (client and server on same host)
require "lua-ipc" local exported = { func1 = function (a) return a*a end func2 = function print("Hi!") end } ipc._addserver('serv1', exported) ipc._loop()
require "lua-ipc" -- send request and wait for reply a = ipc.serv1.func1(3) -- start async call ok, result = a.get() -- wait for results -- send requist, but don't wait ipc.serv1.func2() -- we don't inquire returned values or call successfulness
(Doubts are marked italic)
- All exported functions are stored in table (do not export all global functions)
Exported functions must be explicitly indicated - Only one level of table is exported (no nested tables)
Exported API must be simple -
Only functions call (no variables read/write)
IMHO better is export set/get functions instead of direct variable exporting - Two types of call - function call (returned value is passed to caller) and notification (returned value is ignored)
How make this with sweet syntax?
I think flag must be addeed to request - caller wait result or no.
But with current syntax it is unkown on request time. -
Exported function name cannot start with "_"
("_" is reserved for service methods - look to server example) - Only basic types can be passed as parameters/results (no functions, coroutines, userdata, etc)
Bytecode passing is insecure; it will not work between different Lua versions. - Serialisation of passed values into binary format (like original luarpc or luabins)
- Connectionless (sendto/recvfrom)
- Async
- Coroutines-driven (loke Copas)
-
No RPC support (only calls to processes on same host)
Troubles with RPC:- Byteorder
- Packet loss
- Packet size limit
- Syntax must be changed
- Several servers in one process are allowed