Module Nbd_unix.Client

A client allows you to access remote disks

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 = [
| `Disconnected
| `Protocol_error of Nbd.Protocol.Error.t
]
val pp_error : error Fmt.t
type nonrec write_error = [
| `Disconnected
| `Is_read_only
| `Protocol_error of Nbd.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 : Nbd.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 : Nbd.Channel.channel -> string -> (t * size * Nbd.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