Erwin Abbott
5/31/2007 8:04:00 AM
On 5/30/07, Eric Hodel <drbrain@segment7.net> wrote:
> Having your database be a Rinda::TupleSpace is one way around it.
Hi Eric, I was hoping you would respond (I came across your site and a
few discussions on ruby-talk while researching DRb)! From what I've
read about Rinda::TupleSpace, it seems similar to a Queue. The
difference, as far as I understand, is the idea of a template that
lets us choose to only pop certain kinds of items off the queue
(instead of maintaining several different queues). Maybe you can fill
me in if I overlooked something, I'm not familiar with Linda so the
whole idea is a bit foreign to me.
I'm probably just not developed the mindset for using TupleSpaces yet,
but I've only seen examples where some data is sent off to some
"worker bee" client, and then it's written back to the TupleSpace. I'm
pretty sure I understand those examples but I can't figure out how
this will apply to my application.
I'm hoping to be able to do something like db.search(params) => [a, b,
c, d, ...] where this is an array of records. Then calling methods
that modify the record like a.delete! or a.name = 'Harry' would take
care of locking the record. Calling db.store Record.new(1, 2, 3) would
add a new record to the database. Of course "db" is the object
connected with DRb.
Maybe you can give a brief explanation of how to use Rinda::TupleSpace
in this case? I can maybe see records being stored on the TupleSpace
when they are updated, but I don't really get it yet. Would searches
be done using ts.read using the template to provide search parameters?
I was thinking the "database" object would be more abstract than a big
table of records, so comparing "fields" with == or === might not be
flexible enough (that's how the templates are matched, right?). Maybe
it's an address book, and there's a method to find customers that
haven't payed their bills from last month?
- Erwin