[augeas-devel] [PATCH] add match construct to lens language

Dominique Dumont domi.dumont at free.fr
Sun Feb 22 17:09:39 UTC 2009


David Lutterkort <lutter at redhat.com> writes:

>> Any reason why the default branch is associated with '_' ?
>
> It's just following ML syntax very closely.

ok. I rest my case.

>> IMHO, the switch-case statement would be more easy to grasp without
>> reading the whole lens doc...
>
> I don't understand what you mean by that.

I just meant that, not knowing ML, a '*' notation would be more
intuitive than '_'. OTOH, following ML syntax makes sense. So please
forget my comment.

> The warping is an interesting idea, since it lets you postprocess
> the tree - do you allow modifications of the warped objects ?

Yes. Warping leaves is a way to better guide the user when he enter
configuration values by changing the constraints of the leaf. For
instance if you need to specify a maximun length in a configuration
file, the authorised length must change depending on the unit used (cm
or inches). 

Warped objects can also be tree node. So the warping mechanism is able
to alter the structure of the tree, not just the leaves properties.

> And if so, how do you turn that into changes in the original tree ?

In fact, when warping tree nodes, the warping mechanism does not alter
the hidden tree structure. Warping use a "dispatcher" object hidden
from user's view in the tree. This dispatcher will forward method
calls to the correct node depending on the warp conditions. So the
various read/write backends (like Augeas) will not be bothered by the
warped tree.

Warping a leaf is more simple as only the leaf value check properties
are changed. There's no "object switching" done behind the scene.

Node warp mechanism is heavily used in Xorg model. When user changes
the driver (e.g ati -> fglrx), the config class that contain ati
options is replaced by another class that contain fglrx options.

The model that handle keyboard configuration is even more complex as
some options will change depending on keyboard layout and keyboard
rules.

I hope this explanation was clear... Feel free to ask more questions.

> I would really like to add a way to write tree -> tree lenses for
> Augeas to enable that kind of postprocessing.

I hope you'll find a way...

All the best.




More information about the augeas-devel mailing list