package irmin-pack
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=535254ca443858bfc9e540535977fed63e9206d4b78c5cac0239d1e6657b5c78
sha512=fa18557fcf808121a0495de707c6f7bff4a69197b310480816648adafd4a659b5673a1f5bbf4574f517b7d93253735ef7798b0c365d87afac60675007ef19b54
doc/irmin-pack.unix/Irmin_pack_unix/Io/Unix/index.html
Module Io.Unix
Source
Low level IO abstraction. A typical implementation is unix. This abstraction is meant to be dead simple. Not a lot of documentation is required.
It is not resistant to race condictions. There should not be concurrent modifications of the files.
Errors
An abstract error type that contains the IO-backend specific errors. (e.g. Unix.error
)
type read_error = [
| `Io_misc of misc_error
| `Read_out_of_bounds
| `Read_on_closed
| `Invalid_argument
]
type mkdir_error = [
| `Io_misc of misc_error
| `File_exists of string
| `No_such_file_or_directory
| `Invalid_parent_directory
]
Safe Functions
None of the functions in this section raise exceptions. They may however perform effects that are always continued.
Life Cycle
Write Functions
write_string t ~off s
writes s
at offset
in t
.
fsync t
persists to the file system the effects of previous create
or write.
Read Functions
read_to_string t ~off ~len
are the len
bytes of t
at off
.
read_size t
is the number of bytes of the file handled by t
.
This function is expensive in the unix implementation because it performs syscalls.
MISC.
Unsafe Functions
These functions are equivalents to exising safe ones, but using exceptions instead of the result monad for performances reasons.
read_exn t ~off ~len b
reads the len
bytes of t
at off
to b
.
Raises Errors.Pack_error
and Errors.RO_not_allowed
.
Also raises backend-specific exceptions (e.g. Unix.Unix_error
for the unix backend).
write_exn t ~off b
writes b
to t
at offset off
.
Raises Errors.Pack_error
and Errors.RO_not_allowed
.
Also raises backend-specific exceptions (e.g. Unix.Unix_error
for the unix backend).