Retrieving last modified node path (Was: [augeas-devel] First tests with aug mv)
Raphaël Pinson
raphink at gmail.com
Fri Aug 1 21:19:10 UTC 2008
On Fri, Aug 1, 2008 at 11:10 PM, David Lutterkort <dlutter at redhat.com>wrote:
> On Fri, 2008-08-01 at 21:56 +0200, Raphaël Pinson wrote:
>
>
> > Or to have both last_modified_node and last_created_node.
> > last_modified_node would would refer to the input PATH in the cases of
> > aug_set, aug_mv, aug_rm... last_created_node would refer to the exact
> > PATH of the last created node. Is it possible for a command to create
> > more than one node in a go (I don't see how it would happen)?
> >
> >
> > So there would be something like
> >
> >
> > Previous call m (the modfied path) ; c (the created path)
> > aug_init - NULL; NULL
> > aug_get - no influence on value
> > of /augeas/tree/last_modified; no influence on value
> > of /augeas/tree/last_created
> > aug_set - PATH passed to aug_set, fully qualified ;
> > resulting PATH, only if the path was created
> > aug_insert - fully qualified path to newly created node (or
> > empty - nothing was _modified_ so to say?) ; fully qualified path to
> > newly created node
> > aug_rm - PATH passed to aug_rm ; NULL
> > aug_mv - PATH passed to aug_mv as DST argument ; PATH,
> > only if the path was created
> > aug_match - no influence on value
> > of /augeas/tree/last_modified ; no influence on value
> > of /augeas/tree/last_created
> > aug_save - either leave /augeas/tree/last_modified
> > unchanged or set to NULL ; either leave /augeas/tree/last_created
> > unchanged or set to NULL
> > aug_print - no influence on value
> > of /augeas/tree/last_modified ; no influence on value
> > of /augeas/tree/last_created
> >
> >
> > Perhaps that makes the whole thing a bit too complicated though...
>
> I think so ... I'd much rather stick with a last_created node;
> last_modified doesn't add anything the caller doesn't know already.
>
> The calls that might set something in last_created (aug_set, aug_mv,
> aug_insert) should probably also set last_created to NULL if they didn't
> create anything. Seems like the cleanest solution to me.
>
OK, so I guess what there is to code now is a set_last_created call, and the
functions that will guess the path to send it to the function :)
I was telling you earlier that I thought in tree_insert I could probably use
seg_parent to get the parent node of the PATH given to tree_insert, and then
go through all the children of this parent node until I find the newly
inserted tree. Do you confirm this is how to do it?
How do I get the path after I've done this? Is format_path(found_seg)
correct?
Raphael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/augeas-devel/attachments/20080801/53a9c6dd/attachment.htm>
More information about the augeas-devel
mailing list