Library
Module
Module type
Parameter
Class
Class type
Builder
The type for builder values. A builder generates values from inputs (keys). A builder is typically used with a cache.
module Key : sig ... end
Input describing what is to be built.
For passing context parameters to the builder which aren't part of the key (e.g. timeouts or resource pools).
val name : t -> string
A unique name for this builder. This is used for metric reporting.
title t key
is a one-line summary of the operation that is performed by generate
. It is used as the reason string for the pending state and as the title of the log.
val generate :
t ->
switch:Lwt_switch.t ->
log:Live_log.t ->
DK.Transaction.t ->
context ->
Key.t ->
(value, [ `Failure of string ]) Pervasives.result Lwt.t
generate t ~log trans ctx key
generates the value for key
and stores it in trans
under the "value" directory. It is called when the value is not in the cache, or when a rebuild has been requested. The value returned must be the same as the value that would be loaded by load
. If the build is cancelled, switch
will be turned off. If generate
throws an exception then it is caught and treated as an error result.
load t tr key
is the value v
previously saved by generate
.