package dune-private-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type version = {
  1. major : int;
  2. minor : int;
}

A version of the communication protocol between Dune and the cache daemon.

type promotion = {
  1. key : Key.t;
  2. files : (Stdune.Path.Build.t * Stdune.Digest.t) list;
  3. metadata : Stdune.Sexp.t list;
  4. repository : int option;
  5. 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.

type initial =
  1. | Initial

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 outgoing =
  1. | Outgoing

Outgoing messages are sent by Dune to the cache daemon.

type incoming =
  1. | Incoming

Incoming messages are sent by the cache daemon to Dune.

type _ message =
  1. | Lang : version list -> initial message
    (*

    Inform the other party about the supported versions of the communication protocol.

    *)
  2. | SetBuildRoot : Stdune.Path.t -> outgoing message
    (*

    Set the absolute path to the build root, to be used when interpreting relative paths in subsequent messages.

    *)
  3. | SetCommonMetadata : Stdune.Sexp.t list -> outgoing message
    (*

    Set the common metadata that should be added to the subsequent Promote messages.

    *)
  4. | Promote : promotion -> outgoing message
    (*

    Promote files produced by a build rule into the cache.

    *)
  5. | Hint : Stdune.Digest.t list -> outgoing message
    (*

    The cache daemon a rule is going to be built

    *)

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
val hint_supported : version -> bool
val hint_min_version : version
val find_newest_common_version : version list -> version list -> (version, string) Stdune.result
OCaml

Innovation. Community. Security.