package mirage-flow

  1. Overview
  2. Docs

Utility functions over flows

module Fun : module type of Fflow

Flows from functions

module CopyStats : sig ... end
val copy : (module V1.CLOCK) -> (module V1_LWT.FLOW with type flow = 'a) -> 'a -> (module V1_LWT.FLOW with type flow = 'b) -> 'b -> unit -> [ `Ok of CopyStats.t | `Error of [ `Msg of string ] ] Lwt.t

copy (module Clock) (module Source) source (module Destination) destination copies data from source to destination using the clock to compute a transfer rate. On successful completion, some statistics are returned. On failure we return a printable error.

val proxy : (module V1.CLOCK) -> (module Mirage_flow_s.SHUTDOWNABLE with type flow = 'a) -> 'a -> (module Mirage_flow_s.SHUTDOWNABLE with type flow = 'b) -> 'b -> unit -> [ `Ok of CopyStats.t * CopyStats.t | `Error of [ `Msg of string ] ] Lwt.t

proxy (module Clock) (module A) a (module B) b () proxies data between a and b until both sides close. If either direction encounters an error then so will proxy. If both directions succeed, then return I/O statistics.