From d77d6d4f9ec20c830c4e9ed34c8e2f1197386f4c Mon Sep 17 00:00:00 2001 From: luke Date: Wed, 18 Oct 2006 03:43:48 +0000 Subject: Adding prefetch of providers to transactions. Nothing is using it yet. I wrote it for cron jobs, but it is too much work to fix this for cron jobs right now. git-svn-id: https://reductivelabs.com/svn/puppet/trunk@1806 980ebf18-57e1-0310-9a29-db15c13687c0 --- lib/puppet/transaction.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib') diff --git a/lib/puppet/transaction.rb b/lib/puppet/transaction.rb index d19ef59ac..05fbe6914 100644 --- a/lib/puppet/transaction.rb +++ b/lib/puppet/transaction.rb @@ -162,6 +162,8 @@ class Transaction # Start logging. Puppet::Log.newdestination(@report) + prefetch() + begin allevents = @objects.collect { |child| events = [] @@ -250,6 +252,22 @@ class Transaction @report = Report.new end + # Prefetch any providers that support it. We don't support prefetching + # types, just providers. + def prefetch + @objects.collect { |obj| + if pro = obj.provider + pro.class + else + nil + end + }.reject { |o| o.nil? }.uniq.each do |klass| + if klass.respond_to?(:prefetch) + klass.prefetch + end + end + end + # Generate a transaction report. def report @resourcemetrics[:failed] = @failures.find_all do |name, num| -- cgit