package dune-private-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=8f77d3a87f208e0d7cccaa1c48c4bb1bb87d62d07c3f25e9b8ba298e028ce52b
sha512=f209f12ced10c1abf8782bdb0143f4cec77795f7174d2cc75130afb1e01550b01f2f77b9e3ec4888efdad83d2f9878d179b39126f824f4e522f3ef4da34bf27e
doc/dune-private-libs.cache/Cache/Messages/index.html
Module Cache.Messages
A version of the communication protocol between Dune and the cache daemon.
type promotion = {
key : Key.t;
files : (Stdune.Path.Build.t * Stdune.Digest.t) list;
metadata : Stdune.Sexp.t list;
repository : int option;
duplication : Cache__.Cache_intf.Duplication_mode.t option;
}
When Dune successfully executes a build rule, it sends a "promotion" message to the cache daemon, listing the produced files
along with some metadata
and a few other fields relevant for caching.
There is one initial message Lang
, which is sent by Dune and the cache daemon to each other during the initial negotiation of the version of the communication protocol.
type _ message =
| Lang : version list -> initial message
(*Inform the other party about the supported versions of the communication protocol.
*)| SetBuildRoot : Stdune.Path.t -> outgoing message
(*Set the absolute path to the build root, to be used when interpreting relative paths in subsequent messages.
*)| SetCommonMetadata : Stdune.Sexp.t list -> outgoing message
(*Set the common metadata that should be added to the subsequent
*)Promote
messages.| SetRepos : Cache__.Cache_intf.repository list -> outgoing message
(*Set the paths to all the version controlled repositories in the workspace along with the associated commit identifiers.
*)| Promote : promotion -> outgoing message
(*Promote files produced by a build rule into the cache.
*)| Dedup : Cache__.Cache_intf.File.t -> incoming message
(*Inform Dune that a file that was previously promoted can now be replaced by a hardlink to the corresponding file stored in cache.
*)
Messages of the communication protocol between Dune and the cache daemon.
val incoming_message_of_sexp :
version ->
Stdune.Sexp.t ->
(incoming message, string) Stdune.Result.t
Decode an incoming
message.
val initial_message_of_sexp :
Stdune.Sexp.t ->
(initial message, string) Stdune.Result.t
Decode an initial
message.
val outgoing_message_of_sexp :
version ->
Stdune.Sexp.t ->
(outgoing message, string) Stdune.Result.t
Decode an outgoing
message.
val sexp_of_message : version -> 'a message -> Stdune.Sexp.t
Encode a message.
val send : version -> out_channel -> 'a message -> unit
Send a message.
val negotiate_version :
versions_supported_by_dune:version list ->
Unix.file_descr ->
in_channel ->
out_channel ->
(version, string) Stdune.result
Find the newest version
of the communication protocol supported both by Dune and the cache daemon. To do that, we send versions_supported_by_dune
to the cache daemon via the out_channel
, receive the supported versions of the cache daemon via the in_channel
, and pick the newest one that matches both lists.
val string_of_version : version -> string