On 16/04/18 17:38, Trevor Vaughan wrote:
> How difficult would it be to create a third type of resource which is an
> 'ephemeral resource' whose only purpose is data collection on a host to
> be used by some other collector?
>
> These items would not be part of the catalog or added to the graph but
> would instead just hang around for reference during compilation.
>
> This would fix the catalog explosion issue when you start doing exported
> resources based on large numbers of things and/or things like firewall
> rules and copious file_line resources.
>
> Basically, a 'data' -> 'collector' pattern where you can
> optimize...well...everything into a MUCH smaller catalog that is sent to
> the client for processing.
>
Sounds a bit like the existing virtual resources, but with a better
collection mechanism. Would not be too difficult to write a function
that takes a data type predicate to match against virtual resources
data type predicate) and then calling a lambda with each.
Virtual resources do not end up in the catalog unless they are realized.
With the function I imagined, you would select virtual resources and
then do whatever you want in the lambda.
The function should probably return an Iterator over the resources. That
can then be iterated with each, map, or reduce.
The issue then is when to call that function - you want it at the very
end which we do not have a mechanism for.
The virtual collector could be modified to accept a lambda - since
collection runs late it would be at the right time. This is a much
bigger change naturally as it changes the language.
- henrik
--
Visit my Blog "Puppet on the Edge"
http://puppet-on-the-edge.blogspot.se/