Retrieving last modified node path (Was: [augeas-devel] First tests with aug mv)

David Lutterkort dlutter at redhat.com
Fri Aug 1 18:01:40 UTC 2008


On Fri, 2008-08-01 at 19:53 +0200, Raphaël Pinson wrote:
> 
> 
> On Fri, Aug 1, 2008 at 7:41 PM, David Lutterkort <dlutter at redhat.com>
> wrote:

>         I like that idea a lot. Just thinking out loud, here's what a
>         call to
>         aug_get(aug, "/augeas/tree/last_modified", &p) after each API
>         call would
>         set teh variable p to:
>         
>           Previous call    p (the modfied path)
>                aug_init     - NULL
>                aug_get      - no influence on value
>                of /augeas/tree/last_modified
>                aug_set      - PATH passed to aug_set, fully qualified
>                aug_insert   - fully qualified path to newly created
>         node
>                aug_rm       - PATH passed to aug_rm
>                aug_mv       - PATH passed to aug_mv as DST argument
>                aug_match    - no influence on value
>         of /augeas/tree/last_modified
>                aug_save     - either leave /augeas/tree/last_modified
>         unchanged or set to NULL
>                aug_print    - no influence on value
>         of /augeas/tree/last_modified
> 
> 
> I was more thinking of using the PATH resulting of the action instead
> of the path passed to the API (in the case of set for example,
> thinking about /files/some/path/to/field[100])...

That's what I meant with 'fully qualified path' - but that only makes
sense when the path passed into the action is guaranteed to reference
exactly one node. What should last_modified be set to if I do
'rm /files/*' ?

>         
>              * Looking at the table above, I don't think a
>         last_modified entry
>                would buy us much over a last_created entry; the
>         last_created
>                entry would only be changed by aug_set, aug_mv and
>         aug_insert
>                and would be guaranteed to always refer to exactly one
>         node
> 
> I don't quite understand what you mean by this.

Basically that I can only come up with a fully qualified path (i.e. a
path that only references a single node) for aug_set, aug_mv and
aug_insert - I don't know how to make that work for aug_rm. Maybe best
to ignore aug_rm for last_modified.

Maybe it's better to break this into two questions: was a node created
during a aug_set/aug_mv/aug_insert ? and what is the path to the node
that aug_set/aug_mv/aug_insert modified/created ?

Whether a node was created is always true for aug_insert, and could be
indicated with the return value from aug_set and aug_mv. What node was
affected could be indicated with /augeas/tree/last_modified as the table
suggests.

Does that make it clearer ?
David




More information about the augeas-devel mailing list