[Relfs-devel] A first attempt for plugins
Status: Pre-Alpha
Brought to you by:
applejack
|
From: Vincenzo a. N. N. <vin...@ya...> - 2004-08-01 17:46:45
|
When the cvs commit I just made will be available, there will be a file named "PLUGIN_HOWTO.txt" in the top directory. There is an implementation for plugins, with a base class called "Index", defined in "IndexPlugin.h". Each operation of this class takes a "File" as an argument. "File" represents a cache of information we already know about files. Things will change a lot. By now I would like to focus on the plugin interface. Once that is settled, an asynchronous proxy for plugins, a dlopen interface and all the rest can be written (since I realize that by now these are just source-code plugins, and cannot be really "plugged in"). I would like opinions on the interface. The protected method "getParent" has a "watch_OPERATION" for each operation, which takes an "Index" as an argument. This allows for a plugin to add other plugins to the indexing chain (e.g. when it's a proxy). The protected method "getConnection" is given. It can be overloaded, this has been made so that an "asynchronous proxy plugin" can be implemented, which does not allow to directly access the main db connection (libpqxx does not allow concurrent access to a connection), but creates a new connection in the overloaded "getConnection" method. By the use of preprocessor macros (ARGH!) code size is greatly reduced, at the expense of readability if one does not read the "FOR_ALL" macros like the one at the top of "IndexPlugin.h". The next step is to implement some useful plugin (those already present are implemented quick & dirty, and do not work properly, they must be regarded as examples). Bye Vincenzo |