Library
Module
Module type
Parameter
Class
Class type
Loopback implementation of the FS signature.
include V1.FS
with type +'a io = 'a Lwt.t
and type page_aligned_buffer = Cstruct.t
type error = [
| `Not_a_directory of string
Cannot create a directory entry in a file
*)| `Is_a_directory of string
Cannot read or write the contents of a directory
*)| `Directory_not_empty of string
Cannot remove a non-empty directory
*)| `No_directory_entry of string * string
Cannot find a directory entry
*)| `File_already_exists of string
Cannot create a file with a duplicate name
*)| `No_space
No space left on the block device
*)| `Format_not_recognised of string
The block device appears to not be formatted
*)| `Unknown_error of string
| `Block_device of block_device_error
]
The type for filesystem errors.
type page_aligned_buffer = Cstruct.t
The type for memory buffers.
val read :
t ->
string ->
int ->
int ->
[ `Ok of page_aligned_buffer list | `Error of error ] io
read t key offset length
reads up to length
bytes from the value associated with key
. If less data is returned than requested, this indicates the end of the value.
type stat = {
filename : string;
Filename within the enclosing directory
*)read_only : bool;
True means the contents are read-only
*)directory : bool;
True means the entity is a directory; false means a file
*)size : int64;
Size of the entity in bytes
*)}
The type for Per-file/directory statistics.
format t size
erases the contents of t
and creates an empty filesystem of size size
bytes.
create t path
creates an empty file at path
. If path
contains directories that do not yet exist, create
will attempt to create them.
mkdir t path
creates an empty directory at path
. If path
contains intermediate directories that do not yet exist, mkdir
will create them. If a directory already exists at path
, mkdir
returns `Ok ()
and takes no action.
destroy t path
removes a path
(which may be a file or an empty directory) on filesystem t
.
stat t path
returns information about file or directory at path
.
listdir t path
returns the names of files and subdirectories within the directory path
.
val write :
t ->
string ->
int ->
page_aligned_buffer ->
[ `Ok of unit | `Error of error ] io
write t path offset data
writes data
at offset
in file path
on filesystem t
.
If path
contains directories that do not exist, write
will attempt to create them. If path
already exists, write
will overwrite existing information starting at off
.
val string_of_error : error -> string
Pretty print errors.