package rio
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=4ac883cf9ddbf5b3084fd4372300dd07758acbdf1649df5f8a2794e35a99a5e1
sha512=52043592d567b66398d864f3f5c0a3f923007f0125f69a077a34677c60548d5bfb160074bc1847d1153d2c73eb592e2c2488d34fcde4a745fbe72804ad6fcab1
Description
Rio implements ergonomic, composable, efficient read/write streams that give you a uniform interface for reading from any source and writing to any sync.
README
An actor-model multi-core scheduler for OCaml 5.
Quick Start | Tutorial | Reference
Riot is an actor-model multi-core scheduler for OCaml 5. It brings Erlang-style concurrency to the language, where lightweight processes communicate via message-passing.
open Riot
type Message.t += Hello_world
let () =
Riot.run @@ fun () ->
let pid =
spawn (fun () ->
match receive () with
| Hello_world ->
Logger.info (fun f -> f "hello world from %a!" Pid.pp (self ()));
shutdown ())
in
send pid Hello_worldAt its core Riot aims to offer:
- Automatic multi-core scheduling – when you spawn a new Riot process, it will automatically get allocated on a random scheduler.
- Lightweight processes – spawn 10 or 10,000 processes as you see fit.
- Fast, type-safe message passing
- Selective receive expressions – when receiving messages, you can skim through a process mailbox to consume them in arbitrary order.
- Process links and monitors to keep track of the lifecycle of processes
Riot also includes:
- Supervisors to build process hierarchies
- Logging and Telemetry designed to be multicore friendly
- an Application interface to orchestrate startup/shutdown of systems
- Generic Servers for designing encapsulated services like with Elixir's GenServer
Non-goals
At the same time, there's a few things that Riot is not, and does not aim to be.
Primarily, Riot is not a full port of the Erlang VM and it won't support several of its use-cases, like:
- supporting Erlang or Elixir bytecode
- hot-code reloading in live applications
- function-call level tracing in live applications
- ad-hoc distribution
Quick Start
opam install riotAfter that, you can use any of the examples as a base for your app, and run them:
dune exec ./my_app.exeAcknowledgments
Riot is the continuation of the work I started with Caramel, an Erlang-backend for the OCaml compiler.
It was heavily inspired by eio by the OCaml Multicore team and miou by Calascibetta Romain and the Robur team, as I learned more about Algebraic Effects. In particular the Proc_state is based on the State module in Miou.
And a thousand thanks to Calascibetta Romain and Antonio Monteiro for the discussions and feedback.
Dev Dependencies (1)
-
odoc
with-doc
Optional Dependencies
None
Used by (5)
- bytestring
- gluon
-
riot
>= "0.0.8" -
serde
>= "0.0.2" -
serde_json
>= "0.0.2"
Conflicts
None
Build status
Results of building rio with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.0.8 (this version) | n/a | n/a | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure