package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.b00/B000/Reviver/index.html
Module B000.Reviver
Build operation revivers.
An operation reviver combines a file cache and a hash function to record and revive the effect of build operations.
Note. Hashes performed on files by this module are cached.
Operation reviver
val create :
B0_std.Os.Mtime.counter ->
(module B0_std.Hash.T) ->
File_cache.t ->
tval clock : t -> B0_std.Os.Mtime.counterclock r is r's clock.
val hash_fun : t -> (module B0_std.Hash.T)hash_fun r is r's hash function.
val file_cache : t -> File_cache.tfile_cache r is r's file cache.
Hashing
val hash_string : t -> string -> B0_std.Hash.thash_string r s hashes s using r's hash_fun.
val hash_file : t -> B0_std.Fpath.t -> (B0_std.Hash.t, string) resultval hash_op : t -> Op.t -> (B0_std.Hash.t, string) resulthash_op r o hashes the operation o. Errors if an input file of the build operation can't be hashed, this is most likely because an input file does not exist.
val file_hashes : t -> B0_std.Hash.t B0_std.Fpath.Map.tfile_hashes r is a map of the files that were hashed.
val file_hash_dur : t -> B0_std.Mtime.spanfile_hash_dur r is the time spent hashing files.
Recording and reviving operations
record r o records operation o in the reviver r. This associates the Op.writes o of o to the key Op.hash o (i.e. this function assume o has gone through B000.Op.set_hash before) and stores operation output information of o in the key's metadata hunk. The semantics of the result is like File_cache.add; in particular in case of Ok false it means some file in the set of writes do not exist and is likely an error.
revive r o tries to revive operation o from r using the key Op.hash o (i.e. this function assume o has gone through B000.Op.set_hash before). In particular:
- Recreates the files
Op.writes o - Sets
o's execution information using the metadata hunk of the key. For example for spawn operations this also recovers the exit status code and standard output redirection contents intoo.
If Ok true is returned the operation was revived. If Ok false is returned then nothing was revived and the file system is kept unchanged. Nothing is guaranteed in case of Error _.
Warning. The fields Op.time_started, Op.time_ended of o get set regardless of the result. This may be overwritten later by Exec.