package mirage-flow

  1. Overview
  2. Docs

This module define flow devices and combinators for MirageOS.

Release v1.5.0

type write_error = [
  1. | `Closed
]

The type for generic write errors on flows.

val pp_write_error : write_error Fmt.t

pp_write_error is the pretty-printer for write errors.

type 'a or_eof = [
  1. | `Data of 'a
  2. | `Eof
]

The type for read results on flows.

val pp_or_eof : 'a Fmt.t -> 'a or_eof Fmt.t

pp_or_eof is the pretty-printer for or_eof values.

module type ABSTRACT = sig ... end

Abstract flow signature.

module type S = ABSTRACT with type write_error = private [> write_error ]

The main FLOW signature, where write_errors is a private row type. Note: ideally error should be the empty row, but not easy way to express this in OCaml.

module type CONCRETE = ABSTRACT with type error = [ `Msg of string ] and type write_error = [ write_error | `Msg of string ]

CONCRETE expose the private row as `Msg str errors, using pp_error and pp_write_error.

module Concrete (S : S) (IO : sig ... end) : CONCRETE with type 'a io = 'a S.io and type buffer = S.buffer and type flow = S.flow

Functor to transform a flow signature using private rows for errors into concrete error types.

module type SHUTDOWNABLE = sig ... end

Copy stats

type stats = {
  1. read_bytes : int64;
  2. read_ops : int64;
  3. write_bytes : int64;
  4. write_ops : int64;
  5. duration : int64;
}

The type for I/O statistics from a copy operation.

val pp_stats : stats Fmt.t

pp_stats is the pretty-printer for flow stats.

OCaml

Innovation. Community. Security.