package nbd

  1. Overview
  2. Docs

A Client allows you to list the disks available on a server, connect to a specific disk and then issue read and write requests.

include Mirage_block.S with type error = [ Mirage_block.error | `Protocol_error of Nbd.Protocol.Error.t ] and type write_error = [ Mirage_block.write_error | `Protocol_error of Nbd.Protocol.Error.t ]
type nonrec error = [
  1. | `Disconnected
  2. | `Protocol_error of Protocol.Error.t
]
val pp_error : error Fmt.t
type nonrec write_error = [
  1. | `Disconnected
  2. | `Is_read_only
  3. | `Protocol_error of Protocol.Error.t
]
val pp_write_error : write_error Fmt.t
type t
val disconnect : t -> unit Lwt.t
val get_info : t -> Mirage_block.info 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
type size = int64

The size of a remote disk

val list : Channel.channel -> (string list, [ `Policy | `Unsupported ]) Stdlib.result Lwt.t

list channel returns a list of exports known by the server. `Error `Policy means the server has this function disabled deliberately. `Error `Unsupported means the server is old and does not support the query function.

val negotiate : Channel.channel -> string -> (t * size * Protocol.PerExportFlag.t list) Lwt.t

negotiate channel export takes an already-connected channel, performs the initial protocol negotiation and connects to the named export. Returns disk * remote disk size * flags

OCaml

Innovation. Community. Security.