package eio

  1. Overview
  2. Docs
Effect-based direct-style IO API for OCaml

Install

dune-project
 Dependency

Authors

Maintainers

Sources

eio-1.5.tbz
sha256=7d70d1f5fb2b7190bf1ab28fffeb272da51ffe6d6c9c7c94e0485fabdf3b3fda
sha512=4582ac2fb2f8616b3d8ae9670eb7913a78085899b14044408801b30a34fed6c4d32971ba72eedb0cbc3d82c057610cf81c482090e75e2985330fcde96478ac5e

doc/eio/Eio/Stdenv/index.html

Module Eio.StdenvSource

The standard environment of a process.

All access to the outside world comes from running the event loop, which provides an environment (e.g. an Eio_unix.Stdenv.base).

Example:

  let () =
    Eio_main.run @@ fun env ->
    Eio.Path.with_subtree env#fs "/srv/www" @@ fun www ->
    serve_files www
      ~net:env#net

Standard streams

To use these, see Flow.

Sourceval stdin : < stdin : _ Flow.source as 'a.. > -> 'a
Sourceval stdout : < stdout : _ Flow.sink as 'a.. > -> 'a
Sourceval stderr : < stderr : _ Flow.sink as 'a.. > -> 'a

File-system access

To use these, see Path.

Sourceval cwd : < cwd : _ Path.t as 'a.. > -> 'a

cwd t is the current working directory of the process (this may change over time if the process does a "chdir" operation, which is not recommended).

Sourceval fs : < fs : _ Path.t as 'a.. > -> 'a

fs t is the process's full access to the filesystem.

Paths can be absolute or relative (to the current working directory). Using relative paths with this is similar to using them with cwd, except that this will follow ".." and symlinks to other parts of the filesystem.

fs is useful for handling paths passed in by the user.

Network

To use this, see Net.

Sourceval net : < net : _ Net.t as 'a.. > -> 'a

net t gives access to the process's network namespace.

Processes

To use this, see Process.

Sourceval process_mgr : < process_mgr : _ Process.mgr as 'a.. > -> 'a

process_mgr t allows you to manage child processes.

Domains (using multiple CPU cores)

To use this, see Domain_manager.

Sourceval domain_mgr : < domain_mgr : _ Domain_manager.t as 'a.. > -> 'a

domain_mgr t allows running code on other cores.

Time

To use this, see Time.

Sourceval clock : < clock : _ Time.clock as 'a.. > -> 'a

clock t is the system clock (used to get the current time and date).

Sourceval mono_clock : < mono_clock : _ Time.Mono.t as 'a.. > -> 'a

mono_clock t is a monotonic clock (used for measuring intervals).

Randomness

Sourceval secure_random : < secure_random : _ Flow.source as 'a.. > -> 'a

secure_random t is an infinite source of random bytes suitable for cryptographic purposes.

Debugging

Sourceval debug : < debug : < Debug.t.. > as 'a.. > -> 'a

debug t provides privileged controls for debugging.

Sourceval backend_id : < backend_id : string.. > -> string

backend_id t provides the name of the backend being used.

The possible values are the same as the possible values of the "EIO_BACKEND" environment variable used by Eio_main.run.