package nbd

  1. Overview
  2. Docs


module Primary : Mirage_block.S
module Secondary : Mirage_block.S


include Mirage_block.S
type nonrec error = private [>
  1. | Mirage_block.error
val pp_error : error Fmt.t
type nonrec write_error = private [>
  1. | Mirage_block.write_error
val pp_write_error : write_error Fmt.t
type t
val disconnect : t -> unit Lwt.t
val get_info : t -> Lwt.t
val read : t -> int64 -> Cstruct.t list -> (unit, error) Stdlib.result Lwt.t
val write : t -> int64 -> Cstruct.t list -> (unit, write_error) Stdlib.result Lwt.t
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.