Library
Module
Module type
Parameter
Class
Class type
File operations.
val create_fd :
read:(offset:int64 -> count:int -> Cstruct.t or_err) ->
write:(offset:int64 -> Cstruct.t -> unit or_err) ->
fd
Create an open file object.
read f ~offset ~count
reads an open file.
val create :
stat:(unit -> metadata or_err) ->
open_:(unit -> fd or_err) ->
remove:(unit -> unit or_err) ->
truncate:(int64 -> unit or_err) ->
chmod:(perm -> unit or_err) ->
t
create
is the file t
such that FIXME.
truncate t len
sets the length of t
to len
. If the new length is shorter, the file is truncated. If longer, it is padded with zeroes.
val rw_of_string : string -> t * (unit -> string)
rw_of_string init
is a mutable file that initially contains init
and a function which can be called to get the current contents.
status f
is the file containing the result of f
. f
is evaluated everytime the file is open. If length
is not set, f
will also be called during stat
queries.
command ?init f
is the file containing the result of f
. f
is evaluated on every write, with the contents of the file as argument. Initially the file contains init
.
val of_kv :
read:(unit -> Cstruct.t option or_err) ->
write:(Cstruct.t -> unit or_err) ->
stat:(unit -> metadata or_err) ->
remove:(unit -> unit or_err) ->
chmod:(perm -> unit or_err) ->
t
of_kv ~read ~write ~remove ~stat
interprets values from a k/v store as files. Handles reading and writing regions of the file.
of_kvro
is similar to of_kv
but for read-only values.
stat_of ~read
makes a stat
function from read
. The function reads the file to get the length, and reports the type as `Normal
.
module Stream : sig ... end
of_stream s
is the file which will be, once opened, similar to the stream s ()
.
val err_no_entry : 'a or_err
val err_read_only : 'a or_err