i’ve been workng on ONI (Object Network Interface) this evening. i had
started by trying to change over to HTTP using WEBrick, instead of
straight TCP. but had problems there and went back to TCP.
but an interesting development has arisen in the course this evenings
work and i’m wondering what others might think of it.
while initially the intention of ONI was to put together an RPC system
like SOAP and XML-RPC, but using YAML instead of XML, it has now become
something a little different and i’m not sure what to make of it really.
i’ve done what appears to be some very unique things. (i’m acutally half
surprised that it even works) here’s a list of the “unique” things that
i have done:
i converted ONI into a Peer-to-Peer-like system instead of a just a
pat Client-Server system. (like DRb?)
you can request any new class of object that the remote eviornment
has, simply by saying ObjClass.oni_new. in otherwords, unlike DRb,
you’re not limited to serving just a single object. i achieve this by
dynamically defining an “empty shell” class for every class the remote
machine has, but the local (client) machine does not.
instead of serializing an object and passing it through the network,
i’ve created an object pool to store the real object and in its place
pass a remote-reference-object which points to it.
this remote reference object is a “bare object”. i literally use
#undef_method on every method possible. then missing_method is used to
call to the remote machine and pick up the real object in the pool on
which the method is then called. the return of a remote method call is
the only thing ever serialized and passed back.
i’ve attached the examples of the “server” and “client” for you to take
a look at, and i’ll have the code up on my site in a while. let you know
like i said, ONI’s turned into a very strange beast, and i’m not sure
yet what to make of it. have i achived anything new really? or is all
this already done in variant ways?
oniserver.rb (1.13 KB)
oniclient.rb (1.18 KB)
tom sawyer, aka transami