Skip to content

Allow implementing OCaml 5.0 multicore functionalities in resto

Bikal Gurung requested to merge bikallem/resto:no-lwt into master

The purpose of this PR is to allow implementing/supporting OCaml 5.0 multicore/parallelism features. It does this by refactoring lwt usage in resto while still maintaining (mostly) API backwards compatibility.

The mechanism employed to factor out lwt is OCaml functors. First we factor out lwt types and functions into an abstract OCaml module type aptly named IO and LOGGING. This is done in the existing resto opam package. A new package resto-lwt implements this abstraction to provide backwards compatibility to resto.

Existing packages resto-cohttp-client, resto-cohttp-server, and resto-cohttp-self-serving-client remain backwards compatible with no change in their respective interfaces - OCaml signatures.

resto-directory is the only user visible opam package that is not backwards compatible with this PR. This is so because we require an additional parameter Resto.IO in the Resto_directory.Make() functor. To ensure the transition to the new version of resto is smooth, Io module from resto-lwt package can be used to fulfill the functor parameter requirement.

Summary of additions/changes:

  • Allow for ev All of the existing tests pass.
  • Four new opam packages: resto-client, resto-server, resto-lwt, resto-self-serving-client.
  • Dune has been upgrade to 2.9.1
  • Ocaml version supported remains at 4.08 for now. (No change with this PR) However, the PR has also been tested and developed against 4.12+domains.
  • opam packages have been updated with correct/full dependencies. This resolves issues when attempting pin packages locally via opam pin . command.
Edited by Bikal Gurung

Merge request reports