package obuilder
Library
Module
Module type
Parameter
Class
Class type
val build :
t ->
?base:id ->
id:id ->
(string -> (unit, 'e) Lwt_result.t) ->
(unit, 'e) Lwt_result.t
build t ~id fn
runs fn tmpdir
to add a new item to the store under key id
. On success, tmpdir
is saved as id
, which can be used as the base
for further builds, until it is expired from the cache. On failure, nothing is recorded and calling build
again will make another attempt at building it. The builder will not request concurrent builds for the same id
(it will handle that itself). It will also not ask for a build that already exists (i.e. for which result
returns a path).
result t id
is the path of the build result for id
, if present.
val state_dir : t -> string
state_dir
is the path of a directory which can be used to store mutable state related to this store (e.g. an sqlite3 database).
val cache :
user:Obuilder_spec.user ->
t ->
string ->
(string * (unit -> unit Lwt.t)) Lwt.t
cache ~user t name
creates a writeable copy of the latest snapshot of the cache name
. It returns the path of this fresh copy and a function which must be called to free it when done. If the cache name
does not exist, it is first created (as an empty directory, and owned by user
). When the copy is released, it is snapshotted to become the new latest version of the cache, unless the cache has already been updated since it was snapshotted, in which case this writeable copy is simply discarded.
val delete_cache : t -> string -> (unit, [> `Busy ]) Lwt_result.t
delete_cache t name
removes the cache name
, if present. If the cache is currently in use, the store may instead return Error `Busy
.
val complete_deletes : t -> unit Lwt.t
complete_deletes t
attempts to wait for previously executed deletes to finish, so that the free space is accurate.