T
Tim Bates
My application is using DRb extensively in support of its client-server
model. Ideally I would like to have the remote objects in the client
scripts appear exactly as they would if they were local. All my data
objects include DRb:
RbUndumped so that only references are passed
across the network, as the objects' code needs to run on the server
(database access etc). Unfortunately, DRb:
RbObject defines a bunch of
methods which it doesn't really use, such as ==, ===, <=> etc; but
because it defines them, calls to them don't get proxied to the server.
The Criteria module has in it a neat little bit of code that looks like
this:
mask = ["__send__", "__id__", "inspect", "class", "is_a?", "dup",
"instance_eval"];
methods = instance_methods(true)
methods = methods - mask
methods.each do |m|
undef_method(m)
end
This removes all methods from the class except those in mask.
Something like this in DRb:
RBObject, with an appropriate mask list,
would be really useful, because at the moment, if I have two DRbObjects
which represent the same object on the remote side, the == method still
returns false because of the way DRbObject defines == (the default way,
if it's not exactly the same object they're not equal).
Therefore I have three questions:
1) Is this a reasonable change to make?
2) What is an appropriate mask list to use for DRb:
RbObject?
3) Can I get this change into the core library?
model. Ideally I would like to have the remote objects in the client
scripts appear exactly as they would if they were local. All my data
objects include DRb:
across the network, as the objects' code needs to run on the server
(database access etc). Unfortunately, DRb:
methods which it doesn't really use, such as ==, ===, <=> etc; but
because it defines them, calls to them don't get proxied to the server.
The Criteria module has in it a neat little bit of code that looks like
this:
mask = ["__send__", "__id__", "inspect", "class", "is_a?", "dup",
"instance_eval"];
methods = instance_methods(true)
methods = methods - mask
methods.each do |m|
undef_method(m)
end
This removes all methods from the class except those in mask.
Something like this in DRb:
would be really useful, because at the moment, if I have two DRbObjects
which represent the same object on the remote side, the == method still
returns false because of the way DRbObject defines == (the default way,
if it's not exactly the same object they're not equal).
Therefore I have three questions:
1) Is this a reasonable change to make?
2) What is an appropriate mask list to use for DRb:
3) Can I get this change into the core library?