Mercurial Hosting > luan
view core/src/luan/modules/Rpc.luan @ 618:5e495e4e560b
add lucene indexed_only_fields
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 01 Jan 2016 01:24:10 -0700 |
parents | b4f3dbe1c6e3 |
children | ca169567ce07 |
line wrap: on
line source
java() local RpcLuan = require "java:luan.modules.RpcLuan" local Luan = require "luan:Luan" local error = Luan.error local set_metatable = Luan.set_metatable or error() local Io = require "luan:Io" local Thread = require "luan:Thread" local M = {} M.call = RpcLuan.call -- Rpc.call(socket,fn_name,...) M.respond = RpcLuan.respond -- Rpc.respond(socket,fns) function M.remote(socket_uri) local mt = {} function mt.__index(_,key) return function(...) local socket = Io.uri(socket_uri) return M.call(socket,key,...) end end local t = {} set_metatable(t,mt) return t end --[[ function M.serve(port,fns) local server = Io.socket_server(port) while true do local socket = server() Thread.fork(function() M.respond(socket,fns) end) end end ]] return M