Skip to content

Commit

Permalink
Merge edaae2d into d0ccbfe
Browse files Browse the repository at this point in the history
  • Loading branch information
talex5 committed Nov 3, 2015
2 parents d0ccbfe + edaae2d commit 62001f8
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/client.ml
Expand Up @@ -41,6 +41,9 @@ module type S = sig
val clunk: t -> Types.Fid.t -> Response.Clunk.t Error.t Lwt.t
val remove: t -> Types.Fid.t -> Response.Remove.t Error.t Lwt.t
end

val walk_from_root: t -> Types.Fid.t -> string list -> Response.Walk.t Error.t Lwt.t
val with_fid: t -> (Types.Fid.t -> 'a Lwt.t) -> 'a Lwt.t
end

module Make(Log: S.LOG)(FLOW: V1_LWT.FLOW) = struct
Expand Down Expand Up @@ -254,6 +257,8 @@ module Make(Log: S.LOG)(FLOW: V1_LWT.FLOW) = struct
| { Response.payload = p } -> return_error p
end

let walk_from_root t = LowLevel.walk t t.root

let rec allocate_fid t =
let open Lwt in
if t.free_fids = Types.Fid.Set.empty
Expand Down
8 changes: 8 additions & 0 deletions lib/client.mli
Expand Up @@ -79,6 +79,14 @@ module type S = sig
server. The server will "clunk" the fid whether the call succeeds or
fails. *)
end

val walk_from_root: t -> Types.Fid.t -> string list -> Response.Walk.t Error.t 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). *)

val with_fid: t -> (Types.Fid.t -> 'a Lwt.t) -> 'a 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. *)
end

(** Given a transport (a Mirage FLOW), construct a 9P client on top. *)
Expand Down
3 changes: 3 additions & 0 deletions unix/client9p_unix.ml
Expand Up @@ -106,4 +106,7 @@ module Inet(Log: S.LOG) = struct

let remove { client } = LowLevel.remove client
end

let walk_from_root { client } = Client.walk_from_root client
let with_fid { client } = Client.with_fid client
end

0 comments on commit 62001f8

Please sign in to comment.