Seki san @ RubyKaigi (06 - 11) 2006 dRuby as a session storage 2007 Rinda: Distributed TupleSpace 2008 RIP ERB 2009 dRuby and BigTable 2010 dRuby and Object Database 2011 Drip: A stream based database
Not so cool because... Converting Ruby way into Web way HTTP restricts how to exchange objects Server - Client relationship Functional APIʢRPCʣ Cool URL No REST at that time
class DRbObject ... def method_missing(msg_id, *a) succ, result = DRbConn.new(@uri).send_message(self, msg_id, *a) raise result if ! succ result end ... end
module DRbProtocol ... def dump(obj, soc) begin str = Marshal::dump(obj) rescue ro = DRbObject.new(obj) str = Marshal::dump(ro) end soc.write(str) if soc str end ... end
module DRbProtocol ... def dump(obj, soc) begin str = Marshal::dump(obj) rescue ro = DRbObject.new(obj) str = Marshal::dump(ro) end soc.write(str) if soc str end ... end
class DRbUnknown def initialize(err, buf) case err.to_s when /uninitialized constant (\S+)/ @name = $1 when /undefined class\/module (\S+)/ @name = $1 else @name = nil end @buf = buf end
class DRbUnknown ... def self._load(s) begin Marshal::load(s) rescue NameError, ArgumentError DRbUnknown.new($!, s) end end def reload self.class._load(@buf) end end
ro, msg, argv, block = recv_request(s) obj = ro_to_obj(ro) if block result = obj.__send__(msg.intern, *argv) do |*x| block.call(*x) end else result = obj.__send__(msg.intern, *argv) end
break? kvs.each do |k,v| break if k == "foo" p v end LocalJumpError: break from proc-closure ! from (druby://eleven.local:61018) ..... ! from (druby://eleven.local:61018) ..... ! from (druby://eleven.local:61018) .....
def perform_with_block @obj.__send__(@msg_id, *@argv) do |*x| jump_error = nil begin block_value = block_yield(x) rescue LocalJumpError jump_error = $! end if jump_error case jump_error.reason when :break break(jump_error.exit_value) else raise jump_error end end block_value end endɹ