[rucksack-devel] Indexed classes
Brad Beveridge
brad.beveridge at gmail.com
Wed Jan 16 16:10:13 UTC 2008
On 16/01/2008, Arthur Lemmens <alemmens at xs4all.nl> wrote:
> Brad Beveridge wrote:
>
> > I have defined a class such:
<snip> >
> > I get nothing printed out!
>
> Yes, if there is no current rucksack when the persistent class is
> defined, Rucksack will not update any indices for that class. Rucksack
> should probably signal an error in this case, but it doesn't at the
> moment.
>
> > If I wrap the DEFCLASS in a WITH-RUCKSACK-AND-TRANSACTION, then it
> > works. I am guessing that at defclass time you must have a open
> > rucksack and valid transaction, and that some MOP magic will populate
> > a btree index.
>
> Right. See the file mop.lisp, and in particular the definitions of
> UPDATE-INDEXES and around methods for INITIALIZE-INSTANCE and
> REINITIALIZE-INSTANCE for PERSISTENT-CLASS.
>
>
> > This feels quite strange to me, for example it would be common for an
> > application to startup with no object store & expect to be able to
> > correctly instance indexed objects and have them persist. Otherwise
> > you need to arrange to re-evaluate the defclass form whenever you
> > delete your store.
> >
> > I would expect that when you MAKE-INSTANCE an indexed class Rucksack
> > should test to see if the index exists, and if it doesn't it should
> > create one.
>
> Hmm, interesting idea. I've never been very fond of the WITH-RUCKSACK
> and WITH-TRANSACTION wrappers around DEFCLASS forms, but somehow I
> thought they were necessary. Maybe you're right and we can get rid of
> them. We already have a call to MAYBE-UPDATE-SLOT-INFO at the start
> of the INITIALIZE-INSTANCE around method for PERSISTENT-OBJECT (see
> objects.lisp), so maybe we can just add a MAYBE-UPDATE-INDEXES call at
> that point.
>
> > I'm new to MOP & haven't looked into this yet. Any hints on where I
> > should look to try & fix this.
>
> Yes: the files and functions I just mentioned.
>
> > Or am I misunderstanding a design feature/goal as a bug?
>
> Initially I thought it was a feature, but maybe you're right and it's
> a bug. I need to think a bit more about this.
>
> Thanks for your feedback,
>
Thanks for the great library. Right now I've simply wrapped the
defclasses in a transaction. My immediate goal is to get a test suite
with ~80% coverage (sb-cover to the rescue) finished in the next
couple of weeks. After that I'm not sure what I'll do, probably try &
fix bugs and try to fill in the important bits of the test coverage.
Cheers,
Brad
More information about the rucksack-devel
mailing list