Skip to content

Commit bb6b88e

Browse files
author
sdelano
committed
checksums:
* don't emit doc on _all_docs view * implement bulk view
1 parent a0f21a0 commit bb6b88e

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎chef/lib/chef/checksum.rb‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ class Checksum
3333
attr_reader :original_committed_file_location
3434

3535
DESIGN_DOCUMENT = {
36-
"version" => 1,
36+
"version" => 2,
3737
"language" => "javascript",
3838
"views" => {
3939
"all" => {
4040
"map" => <<-EOJS
4141
function(doc) {
4242
if (doc.chef_type == "checksum") {
43-
emit(doc.checksum, doc);
43+
emit(doc.checksum, null);
4444
}
4545
}
4646
EOJS
@@ -153,6 +153,11 @@ def self.cdb_all_checksums(couchdb = nil)
153153
rs["rows"].inject({}) { |hash_result, r| hash_result[r['key']] = 1; hash_result }
154154
end
155155

156+
def self.cdb_bulk_checksums(keys, couchdb = nil)
157+
rs = (couchdb || Chef::CouchDB.new).bulk_view("checksums", "all", keys)
158+
rs["rows"].inject({}) { |hash_result, r| hash_result[r['key']] = 1; hash_result }
159+
end
160+
156161
def self.cdb_load(checksum, couchdb=nil)
157162
# Probably want to look for a view here at some point
158163
(couchdb || Chef::CouchDB.new).load("checksum", checksum)

0 commit comments

Comments
 (0)