package protocol-9p

  1. Overview
  2. Docs

Module Client.MakeSource

Given a transport (a Mirage FLOW), construct a 9P client on top.

Parameters

module Log : sig ... end

Signature

include S
Sourcetype t

An established connection to a 9P server

Sourceval after_disconnect : t -> unit Lwt.t

A thread which wakes up when the connection to the server has been broken

Sourceval disconnect : t -> unit Lwt.t

Disconnect from the 9P server, but leave the underlying FLOW connected.

Sourceval create : t -> string list -> string -> Protocol_9p__.Protocol_9p_types.FileMode.t -> (unit, [ `Msg of string ]) result Lwt.t

create t path name perm creates a new empty file name inside path with * the given permissions.

Sourceval write : t -> string list -> int64 -> Cstruct.t -> (unit, [ `Msg of string ]) result Lwt.t

write t path offset buf writes buf to the file at path at offset offset

Sourceval read : t -> string list -> int64 -> int32 -> (Cstruct.t list, [ `Msg of string ]) result Lwt.t

read t path offset count returns a list of buffers containing count bytes from offset offset in the file given by path

Sourceval mkdir : t -> string list -> string -> Protocol_9p__.Protocol_9p_types.FileMode.t -> (unit, [ `Msg of string ]) result Lwt.t

mkdir t path name perm creates a new directory name inside path with * the given permissions.

Sourceval remove : t -> string list -> (unit, [ `Msg of string ]) result Lwt.t

remove t path removes a file or directory from the filesystem.

Sourceval readdir : t -> string list -> (Protocol_9p__.Protocol_9p_types.Stat.t list, [ `Msg of string ]) result Lwt.t

Return the contents of a named directory.

Sourceval stat : t -> string list -> (Protocol_9p__.Protocol_9p_types.Stat.t, [ `Msg of string ]) result Lwt.t

Return information about a named directory or named file.

Sourcemodule LowLevel : sig ... end

The functions in this module are mapped directly onto individual 9P RPCs. The client must carefully respect the rules on managing fids and stay within the message size limits.

Sourceval walk_from_root : t -> Protocol_9p__.Protocol_9p_types.Fid.t -> string list -> (Protocol_9p__.Protocol_9p_response.Walk.t, [ `Msg of string ]) result Lwt.t

walk_from_root t is LowLevel.walk t root, where root is the internal Fid representing the root directory (which is not exposed by the API).

Sourceval with_fid : t -> (Protocol_9p__.Protocol_9p_types.Fid.t -> ('a, [ `Msg of string ]) result Lwt.t) -> ('a, [ `Msg of string ]) result Lwt.t

with_fid t fn is the result of running fn x with a fresh Fid x, which is returned to the free pool when the thread finishes.

Sourceval connect : FLOW.flow -> ?msize:int32 -> ?username:string -> ?max_fids:int32 -> ?aname:string -> unit -> (t, [ `Msg of string ]) result Lwt.t

Establish a fresh connection to a 9P server. msize gives the maximum message size we support: the server may choose a lower value. username is the username to present to the remote server. max_fids is the default number of maximum openened fids: by default it is set to 100. aname is the name of the exported filesystem.

OCaml

Innovation. Community. Security.