Module B0.Outcome.Op

module Op: sig .. end
Build operations


type id = int 
The type for build operation identifiers.
type t 
The type for build operations.
val id : t -> id
id o is the identifier of operation o.
val unit_id : t ->
unit_id o is the identifier of the unit in which the operation was submitted. Warning This should be used to look up units defined in the current program run. But only matched against unit metadata present in the build outcome itself, see B0.Outcome.unit_id_name_map.
val aim : t -> B0.Env.build_aim
aim o is the build target for which the operation was submitted.
val reads : t -> B0.Fpath.set
reads o are the file paths read by operation.
val writes : t -> B0.Fpath.set
writes o writes are the file paths written by o.
val creation_time : t -> B0.Time.span
creation_time o is o's monotonic creation time.
val exec_start_time : t -> B0.Time.span
exec_start_time o is o's monotonic operating system starting execution time. This is different from once the operation has been submitted to the OS for execution.
val exec_end_time : t -> B0.Time.span
exec_end_time o is o's monotonic time when the operation's has been processed by the operating system. This is different from once the operation has been completed by the OS and collected and processed into Executed status by the build program.
val cached : t -> bool
cached o is true if the result of the operation was looked up in the cache.
type status = 
| Guarded
| Ready
| Executed
| Finished
The type for operation statuses.
val status : t -> status
status o is o's status.
val pp_status : status B0.Fmt.t
pp_status is a formatter for statuses.
val stamp : t -> B0.Stamp.t
stamp o is o's stamp.

Process spawns

type spawn_pid = int 
The type for OS specific process identifiers.
type spawn_stdo = [ `File of B0.Fpath.t | `Tee of B0.Fpath.t | `Ui ] 
The type for spawn standard output redirections.
type spawn_stdo_ui = [ `None | `Stdo of string B0.result | `Tmp_file of B0.Fpath.t ] 
The type for spawn standard output `Ui redirection result. When submitted this becomes `Tmp_file, once read back this is `Stdo.
type spawn_env = string array 
The type for spawn process environments.
type spawn_success_codes = int list option 
The list of exit codes that indicates success. If this is None only zero is success. If the list is empty this any exit code.
type spawn 
The type for process spawn operations.
val spawn_cmd : spawn -> B0.Cmd.t
spawn_cmd s is s's invocation.
val spawn_env : spawn -> spawn_env
spawn_env s is the environment in which s was run.
val spawn_cwd : spawn -> B0.Fpath.t
spawn_cwd s is the current working directory in which s was run.
val spawn_stdin : spawn -> B0.Fpath.t option
spawn_stdin s is file where stdin was read from for s (if any).
val spawn_stdout : spawn -> spawn_stdo
spawn_stdout s is destination to which stdout was written for s.
val spawn_stderr : spawn -> spawn_stdo
spawn_stderr s is destination to which stderr was written for s.
val spawn_success_codes : spawn -> int list option
spawn_success_codes s is the list of exit codes denoting success for the oparation.
val spawn_stdo_ui : spawn -> spawn_stdo_ui
spawn_stdo_ui s is the `Ui redirection result of s.
val set_spawn_stdo_ui : spawn -> spawn_stdo_ui -> unit
set_spawn_stdo_ui s st sets the `Ui redirection result to st.
val spawn_result : spawn -> (spawn_pid * B0.OS.Cmd.status) B0.result
spawn_result s is s's OS completion result or an error.

File reads

type read 
The type for file read operations.
val read_file : read -> B0.Fpath.t
read_file r is r's read file.
val read_result : read -> string B0.result
read_result r is r's result. Either the read data or an error.

File writes

type write 
The type for (atomic) file write operations.
val write : B0.Unit.t ->
B0.Env.build_aim ->
B0.Time.span -> reads:B0.Fpath.set -> B0.Fpath.t -> t
write u f, when submitted, starts to atomically set the contents of f to write_data w.
val write_file : write -> B0.Fpath.t
write_file w is w's written file.
val write_data : write -> string
write_data w is w's written data.
val set_write_data : write -> string -> unit
write_data w sets w's written data to w.
val write_result : write -> unit B0.result
write_result w is w's result. Either unit or an error.

File copies

type copy_file 
The type for file copies.
val copy_file_src : copy_file -> B0.Fpath.t
copy_file_src c is c's source file.
val copy_file_dst : copy_file -> B0.Fpath.t
copy_file_dst c is c's destination file.
val copy_file_linenum : copy_file -> int option
copy_file_linenum c is c's line number directive value (if any).
val copy_file_result : copy_file -> unit B0.result
copy_file_result c is c's result. Either the unit or an error.

File deletions

type delete 
The type for file deletions.
val delete_file : delete -> B0.Fpath.t
delete_file d is d's deleted file.
val delete_result : delete -> unit B0.result
delete_result d is d's result.

Directory creation

type mkdir 
The type for directory creation operations.
val mkdir_dir : mkdir -> B0.Fpath.t
mkdir_dir mk is mk's created directory.
val mkdir_result : mkdir -> unit B0.result
mkdir_result mk is mk's result.

Unit sychronisation

type sync 
The type for unit synchronisation.
val sync_units : sync -> B0.Unit.Idset.t
sync_units s is the units on which s synchronizes.

Operation kinds

type kind = 
| Spawn of spawn
| Read of read
| Write of write
| Copy_file of copy_file
| Delete of delete
| Mkdir of mkdir
| Sync of sync
The type for asynchronous operation kinds.
val kind : t -> kind
kind o is o's kind.


val cycle : t -> t -> (B0.Fpath.t * B0.Fpath.t) option
cycle o0 o1 is Some (r0, r1) with r0 a file read by o0 and written by o1 and r1 a file read by o1 and written by o0 or None if there no such two files.
val equal : t -> t -> bool
equal o0 o1 is true iff o0 and o1 are the same operation.
val compare : t -> t -> int
compare o0 o1 is a total order on operation compatible with B0.Outcome.Op.equal.
val compare_exec_start_time : t -> t -> int
compare o0 o1 is a total order on operations according to their B0.Outcome.Op.exec_start_time.

Pretty printing

val pp : t B0.Fmt.t
val dump : t B0.Fmt.t
val pp_spawn_fail : t B0.Fmt.t
val pp_log_line : t B0.Fmt.t
val pp_long : t B0.Fmt.t

Sets and maps

type set 
The type for sets of operations.
module Set: sig .. end
Sets of operations.
type +'a map 
The type for operation maps.
module Map: sig .. end
Operation maps.