package nbd

  1. Overview
  2. Docs


module Primary : Mirage_block_lwt.S
module Secondary : Mirage_block_lwt.S


include Mirage_block_lwt.S
type page_aligned_buffer = Cstruct.t
type error = private [>
  1. | Mirage_device.error
val pp_error : error Fmt.t
type write_error = private [>
  1. | `Disconnected
  2. | `Is_read_only
  3. | `Unimplemented
val pp_write_error : write_error Fmt.t
type 'a io = 'a Lwt.t
type t
val disconnect : t -> unit io
val get_info : t -> io
val read : t -> int64 -> page_aligned_buffer list -> (unit, error) Stdlib.result io
val write : t -> int64 -> page_aligned_buffer list -> (unit, write_error) Stdlib.result io
val connect : ?progress_cb:([ `Percent of int | `Complete ] -> unit) -> Primary.t -> Secondary.t -> t Lwt.t

connect ?progress primary secondary creates a block device which performs I/O against primary, while building a mirror of primary on top of secondary in the background. Existing data in secondary will be destroyed.

If ?progress_cb is provided then it will be called on every percentage change in mirror progress.

It is an error if the block size of either primary or secondary is not an integer multiple of the other.

It is an error if primary and secondary have different lengths.

It is an error if secondary is read-only.

val string_of_error : error -> string

Innovation. Community. Security.