[PEAK] ORM with the Trellis

niki niki at vintech.bg
Tue Feb 19 09:25:21 EST 2008


Phillip J. Eby wrote:
> At 11:44 AM 2/19/2008 +0200, niki wrote:
>> Does this mean than one can define rule dependent on some record 
>> source and lazy track changes on that source?
> 
> I'm not sure what you mean.  But here's what I meant: if you have a set 
> of records that offers 'added' and 'removed' event sets (the way a 
> trellis.Set does), then you can certainly have rules that depend on 
> those events.
> 
> How those records get into the record set or the added/removed sets is 
> of course a separate question.

I would like record set and rule to live in external SQL storage and 
lazily reevaluate if 'added' or 'removed' events were fired after last 
calculation. Something like external persistence of dependency graph.

example:
   invoice.total = LazyRule(sum(item.value for item in invoice.item_set))

where invoice and item are SQL persistent records and total is 
calculated on request only if item_set changed after last calculation.
If only item_set can have it's own persistent pulse counter which is 
updated by 'added' and 'removed' events.

Niki Spahiev




More information about the PEAK mailing list