Class | Chef::Checksum
In: | lib/chef/checksum.rb
Parent: | Object

## Chef::Checksum

Checksum for an individual file; e.g., used for sandbox/cookbook uploading to track which files the system already manages.

### Methods

cdb_all_checksums cdb_destroy cdb_list cdb_load cdb_save checksum_repo_directory commit_sandbox_file create_design_document file_location json_create new purge revert_sandbox_file_commit to_json

### Constants

DESIGN_DOCUMENT | = | { "version" => 1, "language" => "javascript", "views" => { "all" => { "map" => <<-EOJS function(doc) { if (doc.chef_type == "checksum") { emit(doc.checksum, doc); } } EOJS

### Attributes

checksum | [RW] |
couchdb_id | [RW] |
couchdb_rev | [RW] |
create_time | [RW] |
original_committed_file_location | [R] | When a Checksum commits a sandboxed file to its final home in the checksum repo, this attribute will have the original on-disk path where the file was stored; it will be used if the commit is reverted to restore the sandbox to the pre-commit state.

### Public Class methods

cdb_all_checksums(couchdb = nil)
cdb_list(inflate=false, couchdb=nil)
cdb_load(checksum, couchdb=nil)
create_design_document(couchdb=nil)

Couchdb

json_create(o)
new(checksum=nil, couchdb=nil)

Creates a new Chef::Checksum object.

### Arguments

checksum:: | the MD5 content hash of the file
couchdb:: | An instance of Chef::CouchDB

### Returns

object<Chef::Checksum>: | Duh. :)

### Public Instance methods

cdb_destroy(couchdb=nil)
cdb_save(couchdb=nil)
checksum_repo_directory()
commit_sandbox_file(sandbox_file)

Moves the given `sandbox_file` into the checksum repo using the path given by `file_location` and saves the Checksum to the database

file_location()

On-Disk Checksum File Repo (Chef Server API)

purge()

Removes the on-disk file backing this checksum object, then removes it from the database

revert_sandbox_file_commit()

Moves the checksum file back to its pre-commit location and deletes the checksum object from the database, effectively undoing `commit_sandbox_file`. Raises Chef::Exceptions::IllegalChecksumRevert if the original file location is unknown, which is will be the case if commit_sandbox_file was not previously called

to_json(*a)

[Validate]