summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsdelano <stephen@opscode.com>2011-04-25 14:32:01 -0700
committersdelano <stephen@opscode.com>2011-04-25 14:32:01 -0700
commit64832e7e139802a756c2597901cee7a63583c304 (patch)
treea48bfd638e1f41fe963f4549c50d055ef9928130
parent8abc9d70a85a3e48fc2b4f507b6331c4cb70769c (diff)
downloadchef-fast-cookbook-uploads.tar.gz
* don't emit doc on _all_docs view * implement bulk view
-rw-r--r--chef/lib/chef/checksum.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/chef/lib/chef/checksum.rb b/chef/lib/chef/checksum.rb
index 5a45e76007..c6138ec970 100644
--- a/chef/lib/chef/checksum.rb
+++ b/chef/lib/chef/checksum.rb
@@ -33,14 +33,14 @@ class Chef
attr_reader :original_committed_file_location
DESIGN_DOCUMENT = {
- "version" => 1,
+ "version" => 2,
"language" => "javascript",
"views" => {
"all" => {
"map" => <<-EOJS
function(doc) {
if (doc.chef_type == "checksum") {
- emit(doc.checksum, doc);
+ emit(doc.checksum, null);
}
}
EOJS
@@ -153,6 +153,11 @@ class Chef
rs["rows"].inject({}) { |hash_result, r| hash_result[r['key']] = 1; hash_result }
end
+ def self.cdb_bulk_checksums(keys, couchdb = nil)
+ rs = (couchdb || Chef::CouchDB.new).bulk_view("checksums", "all", keys)
+ rs["rows"].inject({}) { |hash_result, r| hash_result[r['key']] = 1; hash_result }
+ end
+
def self.cdb_load(checksum, couchdb=nil)
# Probably want to look for a view here at some point
(couchdb || Chef::CouchDB.new).load("checksum", checksum)