I know your question is/was about DRb but Roxy will do the block.

http://rubyforge.org/projects/roxy ... Full source available ... only
185 lines of code ...

Undumped functionality doesn't exist yet.
And I haven't done anything like Rinda on top of it yet.

j.

On 10/19/05, James Edward Gray II <james / grayproductions.net> wrote:
> I'm finally getting around to playing with DRb and I have some
> general questions.
>
> Let's say I would like to share a Hash with a whole slew of
> computers.  Clients should be able to load objects into the Hash and
> examine the data the Hash contains.
>
> Here's the trivial implementation.  First the server:
>
> #!/usr/local/bin/ruby -w
>
> # hash_server.rb
>
> require "drb"
>
> data = {:server => "data"}
>
> DRb.start_service("druby://localhost:61676", data)
> DRb.thread.join
>
> __END__
>
> Then the client:
>
> #!/usr/local/bin/ruby -w
>
> require "drb"
>
> DRb.start_service
> data = DRbObject.new(nil, "druby://localhost:61676")
>
> ### Whatever operations go here... ###
> data[:client] = "more data"
> data.each { |(from, data)| puts "#{from} => #{data}"}
>
> __END__
>
> Now I'll list some some general questions and hope some guru feels
> like enlightening me:
>
> 1.  This is mostly a curiosity, but how does this work, really?
>
> I guess I half expected that each() call not to work because of the
> block, which can't be marshaled, obviously.  Was the Hash marshaled
> down to the client and each() called there?  How often does this
> transference happen, every method call?  I'm trying to decide how up
> to date my data will be, at any given time, mainly.
>
> Any details you can provide would be helpful.  As you can see, I'm
> still trying to get my head around all of this.
>
> 2.  How does the use of DRbUndumped change the answer(s) to #1.
>
> 3.  I *assume* the above is not very (thread) safe.  Should I wrap
> the Hash in class with modify and read methods, then synchronize
> their work?  Again, I want 40 computers to be able to trade data in
> and out of here all at once.
>
> 4.  How does Rinda::TupleSpace relate to what I'm trying to do here?
>
> 5.  I've poked around in the documents on ruby-doc.org, read the Chad
> Fowler article, and read the short sections in the Pickaxe2.  Any
> good DRb documentation I'm missing?
>
> Thanks much!
>
> James Edward Gray II
>
>
>


--
"http://ruby-lang.org -- do you ruby?"

Jeff Wood