You are not logged in Log in Join
You are here: Home » Members » Phillip J. Eby's Zope Center » My Wikis » ZPatterns Wiki » IndexingAgents » wikipage_view

Log in
Name

Password

 
 
DynamicDataObjects » DataManagers »

IndexingAgents

Indexing Agents are PlugIns for DataManagers that supply object indexing support. They are a subclass of RuleAgents, and so are notified by their data manager of DataManagementEvents for the DataSkins associated with that data manager.

As with RuleAgents, IndexingAgents usually receive deferred notification of DataManagementEvents. This is because indexes by nature are merely shadows of the "real objects" they index, and only need to track those real objects' committed states, not the intermediate states they may go through during the course of a transaction. This approach minimizes index thrashing caused by unnecessary intermediate updates.

Of course, this also means that until a transaction or subtransaction commit takes place, indexes managed by IndexingAgents will not reflect changes made in the current transaction. We anticipate that in most web-based applications, it is unusual to need an index to be up-to-date within the transaction, and in those cases where it is needed, the fact that it is needed is well-known, allowing one to call for a subtransaction commit at that point.

Consider that, in order for an index to be "out of date", it is necessary for an object to be updated, and then, for a search to be performed which requires information involving that updated object. These things must be done in sequence, or must be done by routines called by a higher-level routine which calls them in sequence. Thus, there is always some routine in which a subtransaction commit can be inserted between the write operations and the subsequent search operations.

Of course, a subtransaction commit will also notify any RuleAgents of involved changes, and possibly cause AttributeProviders and SheetProviders to send out data to other databases, etc. So it is potentially possible that some highly complex transactions may need more substantial re-ordering to accomodate updating indexes within the transaction.

In addition to their methods for accepting DataManagementEvents, Indexing Agents will need to have other methods associated with searching and Predicates, but these additional methods have not been designed/defined yet. It is likely that as of ZPatterns 0.4.0, there will be almost no difference between the class for IndexingAgents and the parent class for RuleAgents, as support for Predicates is unlikely to be sufficiently designed before ZPatterns 0.5.0.