Up

module Manifest

: sig

Generating the .manifest files

#
type alg = string
#
type digest = string * string
#
val parse_digest : string -> digest
#
val parse_digest_loose : string -> digest
#
val format_digest : digest -> string
#
val algorithm_names : string list
#
val generate_manifest : Support.Common.system -> alg -> Support.Common.filepath -> string

generate_manifest system alg dir scans dir and return the contents of the generated manifest. If the directory contains a .manifest file at the top level, it is ignored.

#
val hash_manifest : alg -> string -> string

Generate the final overall hash value of the manifest.

#
val add_manifest_file : Support.Common.system -> alg -> Support.Common.filepath -> string

Writes a .manifest file into 'dir', and returns the digest. You should call Stores.fixup_permissions before this to ensure that the permissions are correct. On exit, dir itself has mode 555. Subdirectories are not changed.

Returns the value part of the digest of the manifest.
#
val verify : Support.Common.system -> digest:digest -> Support.Common.filepath -> unit

Ensure that directory 'dir' generates the given digest.

digest the required digest (usually this is just Filename.basename dir) For a non-error return:
  • The calculated digest of the contents must match digest.
  • If there is a .manifest file, then its digest must also match.
#
val copy_tree_with_verify : Support.Common.system -> Support.Common.filepath -> Support.Common.filepath -> string -> digest -> unit

Copy directory source to be a subdirectory of target if it matches the required_digest. manifest_data is normally source/.manifest. source and manifest_data are not trusted (will typically be under the control of another user). The copy is first done to a temporary directory in target, then renamed to the final name only if correct. Therefore, an invalid 'target/required_digest' will never exist. A successful return means than target/required_digest now exists (whether we created it or not).

#
type hash = string
#
type mtime = float
#
type size = Int64.t
#
type manifest_dir = (Support.Common.filepath * tree_node) list
#
type tree_node = [
| `dir of manifest_dir
| `symlink of hash * size
| `file of bool * hash * mtime * size
]
#
val parse_manifest : string -> manifest_dir
end