[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: overlays and config parsing

Howard Chu wrote:

Pierangelo Masarati wrote:

In some cases, it may be useful that overlays see configuration directives
__before__ the database, to allow intercepting and overriding them. Directives ignored by the overlays would get to the database anyway; the
specific overlay may allow the directive to eventually get to the
database, maybe changed as appropriate.

Seems safe for now, but this behavior won't translate into back-config since database and overlay configuration is segregated to their own entries.

In this case, the configuration should belong to the overlay, because in my design the overlay parses the directives and, after its judgement, may propagate it to the database's parsing routine directly, e.g. by calling something like

char *save_argv0 = argv[ 0 ];
if ( strncasecmp( argv[ 0 ], "overlay-", STRLENOF( "overlay-" ) ) == 0 ) {
argv[ 0 ] += STRLENOF( "overlay-" );
rc = on->on_info->oi_orig->bi_db_config( be, fname, lineno, argc, argv );
argv[ 0 ] = save_argv0;


   char *save_argv0 = argv[ 0 ];
   argv[ 0 ] += STRLENOF( "overlay-" );
   rc = be->bd_info->bi_db_config( be, fname, lineno, argc, argv );
   argv[ 0 ] = save_argv0;

where the overlay is supposed to know if it's more appropriate to go straight to the original function or to re-call the entire stack after stripping the overlay's prefix "overlay-". The former, of ocurse, is necessary if the statement was entered without the "overlay-" prefix, otherwise and endless loop would occur :)

Also, overlays are meant to be generic; overriding as you suggest means the overlay recognizes the specific database it's used with and only works with specific types. Not a problem, but something to be documented.

Yes; in this case, I'm considering overlays that are database specific, because they implement features that are database specific and are implemented in overlays because they're not of general use or are intended to keep the database clean when the feature is not required.


   SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497