Module B00.Op
Build operations.
This module only provides a type for specifying operations and the result of their execution. No execution or caching logic lives here.
Operations kinds
module Spawn : sig ... end
Tool spawns.
module Read : sig ... end
File reads.
module Write : sig ... end
File writes.
module Mkdir : sig ... end
Directory creation.
type kind
=
|
Spawn of Spawn.t
|
Read of Read.t
|
Write of Write.t
|
Mkdir of Mkdir.t
|
Wait_files
The type for operation kinds.
val kind_name : kind -> string
kind_name k
is a end user name for kindk
.
Operation status
type status
=
|
Waiting
Waiting for execution.
|
Executed
Executed successfully.
|
Cached
Revived from the cache.
|
Failed
Executed unsucessfully.
|
Aborted
A prerequisite operation failed.
The type for operation statuses.
val pp_status : status B0_std.Fmt.t
pp_status
formats execution status.
Operations
val creation_time : t -> B0_std.Time.span
creation_time o
iso
's creation time.
val exec_start_time : t -> B0_std.Time.span
exec_start_time o
iso
's execution start time. This is different fromB0_std.Time.Span.zero
once the operation has been submitted to the OS for execution.
val exec_end_time : t -> B0_std.Time.span
exec_end_time o
iso
's execution end time. This is different fromB0_std.Time.Span.zero
once the operation has been completed by the OS and collected.
val exec_duration : t -> B0_std.Time.span
exec_duration
is the difference betweenexec_end_time
andexec_start_time
.
val reads : t -> B0_std.Fpath.t list
reads o
are the file paths read by the operation.
val writes : t -> B0_std.Fpath.t list
writes o
are the file paths written byo
.
val did_not_write : t -> B0_std.Fpath.t list
did_not_write o
are the file ofwrites
that do not exist or are not readable.
val hash : t -> B0_std.Hash.t
hash o
is the operation's hash. This isHash
.nil before the operation hash has been effectively computed and set viaset_hash
.
Formatters
val pp : t B0_std.Fmt.t
pp
formats a build operation.
val pp_short : t B0_std.Fmt.t
pp_short
formats a build operation on a single line.
val pp_did_not_write : (t * B0_std.Fpath.t list) B0_std.Fmt.t
pp_did_not_write
formats a build operation and the files it failed to write.
val pp_spawn_status_fail : t B0_std.Fmt.t
pp_spawn_status_fail
formats a spawn operation failure due to exit result.
Updating the build operation
val set_exec_start_time : t -> B0_std.Time.span -> unit
exec_start_time o t
setso
's execution start time tot
.
val set_exec_end_time : t -> B0_std.Time.span -> unit
set_exec_end_time o t
setso
's execution end time tos
.
val set_reads : t -> B0_std.Fpath.t list -> unit
set_reads t fs
sets the file paths read byo
tofs
. Note that this resets thehash
.
val set_writes : t -> B0_std.Fpath.t list -> unit
set_writes t fs
sets the file paths written byo
tofs
.
val set_hash : t -> B0_std.Hash.t -> unit
set_hash o h
sets the operation hash toh
.
Operation contructors
val spawn : id:id -> B0_std.Time.span -> reads:B0_std.Fpath.t list -> writes:B0_std.Fpath.t list -> env:B0_std.Os.Env.assignments -> relevant_env:B0_std.Os.Env.assignments -> cwd:B0_std.Fpath.t -> stdin:B0_std.Fpath.t option -> stdout:Spawn.stdo -> stderr:Spawn.stdo -> success_exits:Spawn.success_exits -> B0_std.Cmd.tool -> B0_std.Cmd.t -> t
spawn
declares a spawn build operation, see the corresponding accessors inSpawn
for the semantics of the various fields.
val read : id:id -> B0_std.Time.span -> B0_std.Fpath.t -> t
read
declares a file read operation, see the corresponding accessors inRead
for the semantics of the various fields.
val write : id:id -> B0_std.Time.span -> salt:string -> reads:B0_std.Fpath.t list -> mode:int -> write:B0_std.Fpath.t -> (unit -> (string, string) Stdlib.result) -> t
write
declares a file write operations, see the corresponding accessors inWrite
for the semantics of the various fields.
val mkdir : id:id -> B0_std.Time.span -> B0_std.Fpath.t -> t
mkdir
declares a directory creation operation, see the corresponding accessors for the semantics of the various fields.
val wait_files : id:id -> B0_std.Time.span -> B0_std.Fpath.t list -> t
wait_files
declares a wait files operation, these are stored inreads
.
Operation sets and map
module Set : Stdlib.Set.S with type elt := t
Operation sets
module Map : Stdlib.Map.S with type key := t
Operation maps