Fabio M. Di Nitto napsal(a):
> On 08/25/2011 06:31 AM, Angus Salkeld wrote:
>> On Thu, Aug 25, 2011 at 05:16:20AM +0200, Fabio M. Di Nitto wrote:
>>> On 08/25/2011 04:56 AM, Angus Salkeld wrote:
>>>
>>>> Possible Solutions
>>>> ==================
>>>>
>>>> 1] API
>>>> We really just want to get/set values do we really need a tree?
>>> as you already mentioned before, tree make it easy to load a config file
>>> and map it in the objdb following the same structure (object, key etc..).
>>>
>>> I know Steven wants xml loader too (that matches perfectly with objdb 1:1).
>>>
>>> Whatever API you want to put in place, please keep it simple to retain
>>> the same view even if internally is a map or whatever else you decide.
>>>
>>> Also consider formats for export. For example dumping the objdb into an
>>> xml file is dead simple. The new API should allow something similar IMHO.
>> Yikes, well converting a map's contents to and from xml is going to be
>> interesting.
>>
>> If we added an xpath-like api to objdb we could improve the API
>> enormously and still keep it a tree.
>>
>> ver = objdb_get_int32("/service/@name=cpg/ver");
>>
>> objdb_cd("/logging/@subsys=main");
>> if (objdb_get_bool("to_syslog")) {
>>   //...
>> }
> 
> Possibly, "real" xpath is complex. A subset of xpath is already
> implemented in libccsconfdb (that does a reduced set of xpath<->objdb).
> 
> The current "full xpath" implementation in libccsconfdb, involves
> dumping objdb into xml and use libxml for real xpath queries.. "easy way
> out" without re-implementing the world.
> 
> Fabio

So just to clarify some things.

- It will be hash table (map/rb tree/what ever) but no tree structure.
- corosync.conf format will change, so no tree structure. As example 
current:
totem {
iterface {
ringnumber: 0
bindnetaddr: 123.123.123.1
}
}

will become

totem.interface.0.bindnetaddr internally and externally may/can/maybe 
should be something like
totem {
interface {
0 {
bindnetaddr:123.123.123.1

to prevent 10000 same prefixes.

- corosync.xml will reflect changes described above

so instead of
<totem>
<interface ringnumber="0" bindnetaddr="123.123.123.1" />
</totem>

it will be

<totem>
<interface>
<0 bindnetaddr="123.123.123.1"/></interface></totem>

Please note that XML will be there *only* for automatic generators/editors.

- hash table will be used to store struct with following format:

item {
   type
   union {
     uint16_t u16
     unit32_t u32
     ...
     char *blob
   }
}

- cht_get_int32("key") is nice but not working because there is no 
possibility to get error codes (C don't support multiple return values 
what should be nice feature to have, but C is not Go, Lisp, ...). So API 
will be error = cht_get_int32("key", &u32);, or probably better, 
reversed int32_value = cht_get_int32("key", &error) where error may be NULL.
_______________________________________________
Openais mailing list
Openais@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/openais

Reply via email to