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 |
| 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. |
| Hint : Stdune.Digest.t list -> outgoing message | The cache daemon a rule is going to be built |
| 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 -> Stdlib.out_channel -> 'a message -> unit
Send a message.
val negotiate_version : versions_supported_by_dune:version list -> Unix.file_descr -> Stdlib.in_channel -> Stdlib.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
val hint_supported : version -> bool
val hint_min_version : version
val find_newest_common_version : version list -> version list -> (version, string) Stdune.result