| In: |
lib/drb/drbfire.rb
|
It is assumed that you already know how to use DRb; if you don’t you’ll need to go read up on it and understand the basics of how it works before using DRbFire. DRbFire actually wraps the standard protocols that DRb uses, so generally anything that applies to them applies to DRbFire.
Using DRbFire is quite simple, and can be summed up in four steps:
| On the server: | DRbFire::ROLE => DRbFire::SERVER |
| On the client: | DRbFire::ROLE => DRbFire::CLIENT |
So a simple server would look like:
require 'drb/drbfire'
front = ['a', 'b', 'c']
DRb.start_service('drbfire://some.server.com:5555', front, DRbFire::ROLE => DRbFire::SERVER)
DRb.thread.join
And a simple client:
require 'drb/drbfire'
DRb.start_service('drbfire://some.server.com:5555', nil, DRbFire::ROLE => DRbFire::CLIENT)
DRbObject.new(nil, 'drbfire://some.server.com:5555').each do |e|
p e
end
You can do some more interesting tricks with DRbFire, too:
| Using SSL: | To do this, you have to set the delegate in the configuration (on both the server and the client) using DRbFire::DELEGATE => DRb::DRbSSLSocket. Other DRb protcols may also work as delegates, but only the SSL protocol is tested. |
| VERSION | = | [0, 1, 0] |
| The current version. | ||
| ROLE | = | "#{self}::ROLE" |
| The role configuration key. | ||
| SERVER | = | "#{self}::SERVER" |
| The server role configuration value. | ||
| CLIENT | = | "#{self}::CLIENT" |
| The client role configuration value. | ||
| DELEGATE | = | "#{self}::DELEGATE" |
| The delegate configuration key. | ||