HomePhorge

(#9617) Be smarter about finding parents when eval_generating
7002eff7e369Unpublished

Unpublished Commit ยท Learn More

Repository Importing: This repository is still importing.

Description

(#9617) Be smarter about finding parents when eval_generating

This method generates children and nests them into a hierarchical structure,
effectively representing "the resource" as the sum of itself and its children.

To be properly hierarchical, we cause generated resources to depend on their
*nearest* ancestor, not necessarily the resource that generated them.

The previous method for finding the nearest ancestor used linear search of all
the generated resources, which had O(n^2) performance in the number of
generated resources. Additionally, it used substring comparison to find the
parent, which was not always correct (/tmp/foo1 would depend on /tmp/foo).

Now, we ask the generated resource for its potential ancestors, and look for
the nearest one that we generated. If none is found, we fall back to the
resource that generated the child. This is much faster and more correct.

Paired-With: Josh Cooper <josh@puppetlabs.com>

Details

Provenance
Nick Lewis <nick@puppetlabs.com>Authored on
vanmeeuwenPushed on Jun 2 2015, 2:22 PM
Parents
rPU11fda78b0f9d: maint: Don't File#expand_path when unmunging file paths
Branches
Unknown
Tags
Unknown

Event Timeline

Nick Lewis <nick@puppetlabs.com> committed rPU7002eff7e369: (#9617) Be smarter about finding parents when eval_generating (authored by Nick Lewis <nick@puppetlabs.com>).Nov 11 2011, 11:26 PM