package dune-private-libs

  1. Overview
  2. Docs
Private libraries of Dune

Install

Dune Dependency

Authors

Maintainers

Sources

dune-2.5.1.tbz
sha256=8f77d3a87f208e0d7cccaa1c48c4bb1bb87d62d07c3f25e9b8ba298e028ce52b
sha512=f209f12ced10c1abf8782bdb0143f4cec77795f7174d2cc75130afb1e01550b01f2f77b9e3ec4888efdad83d2f9878d179b39126f824f4e522f3ef4da34bf27e

doc/dune-private-libs.cache/Cache/Messages/index.html

Module Cache.Messages

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. | 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.

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

    Promote files produced by a build rule into the cache.

    *)
  6. | 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
OCaml

Innovation. Community. Security.