Library
Module
Module type
Parameter
Class
Class type
Writable directories.
module Store : S
val v : Store.Repo.t -> Store.tree -> t
v t tree
is the directory initially containing the contents of tree
in the store t
.
val root : t -> Store.tree
root t
is the tree corresponding to the current directory.
val update :
t ->
Path.t ->
string ->
(Blob.t * [ Metadata.t | `Keep ]) ->
(unit, [ `Is_a_directory | `Not_a_directory ]) Pervasives.result Lwt.t
update t dir leaf data
makes dir/leaf
be the file data
. Missing directories may be created. If dir/leaf
is a file then it is overwritten. Fails if dir/leaf
is a directory, or any component of dir
is not a directory.
val remove :
t ->
Path.t ->
string ->
(unit, [ `Not_a_directory ]) Pervasives.result Lwt.t
remove t dir leaf
ensures that dir/leaf
does not exist. Fails if any component of dir
is not a directory.
val chmod :
t ->
Path.t ->
string ->
Vfs.perm ->
(unit, [ `Is_a_directory | `Not_a_directory | `No_such_item ])
Pervasives.result
Lwt.t
chmod t dir leaf perm
changes the type of dir/leaf
to perm
. Fails if any component of dir
is not a directory, or perm
is incompatible with the type of the item being changed.
update_force t path leaf value
ensures that path/leaf
is a file containing value
. Any existing files and directories that are in the way are destroyed.
remove_force t path leaf
ensures that path/leaf
does not exist. This will delete the entire subtree if path/leaf
is a directory. It does nothing if path/leaf
does not exist.
val rename :
t ->
path ->
old_name:string ->
new_name:string ->
(unit, [ `Is_a_directory | `Not_a_directory | `No_such_item ])
Pervasives.result
Lwt.t
rename t path ~old_name ~new_name
ensures that path/new_name
points to whatever path/old_name
previously did, and that path/old_name
no longer exists (atomically). It is an error if path/old_name
does not exist or if path/new_name
already exists as a directory.