Configuration API

Lars Hallberg lah at micropp.se
Mon May 3 20:04:53 EEST 2004


Dave Cridland [Home] wrote:

> On Mon May  3 16:56:51 2004, Lars Hallberg wrote:
>
>> I think the API can be prety flexably. If ther is *one* app that uses 
>> som complex structur in ther config files, we might consider 
>> suporting it, but only that bakend need to suport it! Of, corce - 
>> this might more be a problem for the frontends, that have to suport 
>> every feature from every backend.
>
> Argh! No! If we don't have a consistent data model which is supported 
> across all backends, we're doomed. I think this is easily achievable 
> between KConfig and GConf, with only mild alterations to both.

Think this depends a bit of what kind of backend we are talking about.

A general central config store backend (think LDAP, ACAP, LR backend) 
must be able to store all datatypes.

A backend for a given app, say apche, that can read and store apach 
config, possably with some added aplikation logic, and makes it avalible 
thru this API. In that case it is just silly to demand that bakend to 
suport storing types apache don't know about and understand. Likvise, it 
is silly for any user of the API to try to stor such a value in the 
apach namespace! So no usfull functionality is lost!

It's might be ok to ask the bakend to provide those functions, but they 
should att least be aloved to simply return an error.

Actuly, it's even preferably if You can't store types not suported in a 
given namespace even if You use a central store backend. But that check 
is probably better done by the 'middelware' thru the use of cheemas an 
can preferably be optional.

> Which raises an interesting question - is the datatype soft or hard? 
> Meaning, can an application say 'give me the value of this key as an 
> integer'? ACAP does this to some extent, but for our purposes, I'd say no.

Think I say no to. As long every type also coms with a string 
representation, so an app can att least view keys they don't understand. 
But if all keys is implementad as strings, this can be provided thru a 
helper lib regarles of what the API says.

> Moreover, I'd say a backend shouldn't be handling validation - that 
> should always be the job of the application using it. Apart from 
> anything else, type checking is a simple addition to the validation 
> that has to happen anyway.

Not sure about this.... but maybee :-) For a simple central store 
backend I can see Your point. A backend workin direktly with a native 
config format probably want to validate that the resulting config is att 
least corekt in syntax.

/LaH





More information about the xdg mailing list