package octez-internal-libs
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=ddfb5076eeb0b32ac21c1eed44e8fc86a6743ef18ab23fff02d36e365bb73d61
sha512=d22a827df5146e0aa274df48bc2150b098177ff7e5eab52c6109e867eb0a1f0ec63e6bfbb0e3645a6c2112de3877c91a17df32ccbff301891ce4ba630c997a65
doc/irmin_pack_unix/Irmin_pack_unix/File_manager/Make/Control/index.html
Module Make.Control
Source
Abstraction for an irmin-pack control file.
It is parameterized with Io
, a file system abstraction (e.g. unix, mirage, eio_linux).
None of the functions raise exceptions.
val create_rw :
path:string ->
tmp_path:string option ->
overwrite:bool ->
Irmin_pack_unix__.Control_file_intf.Payload.Upper.V5.t ->
(t, [> Io.create_error | Io.write_error ]) Stdlib.result
Create a rw instance of t
by creating a control file.
type open_error := [
| `Corrupted_control_file of string
| `Io_misc of Io.misc_error
| `No_such_file_or_directory of string
| `Not_a_file
| `Closed
| `Unknown_major_pack_version of string
]
val open_ :
path:string ->
tmp_path:string option ->
readonly:bool ->
(t, [> open_error ]) Stdlib.result
Create a rw instance of t
by reading an existing file at path
. tmp_path
will be used by RW instances when updating it's content, it is not required for RO instances or RW instances which will never be updated.
val read_payload :
path:string ->
(Irmin_pack_unix__.Control_file_intf.Payload.Upper.V5.t,
[> open_error | Io.close_error ])
Stdlib.result
val read_raw_payload :
path:string ->
(Irmin_pack_unix__.Control_file_intf.Payload.Upper.raw_payload,
[> open_error | Io.close_error ])
Stdlib.result
payload t
is the payload in t
.
That function doesn't perform IO.
RW mode
payload t
is the payload, as it was written to the file system.
RO mode
payload t
is the payload
, as it was seen during open_
or during the most recent reload
.
RW mode
Always returns an error.
RO mode
Reread the file on disk.
If the file changed since the last read, the payload in t
is updated to match the content of the file.
type set_error := [
| `No_tmp_path_provided
| Io.create_error
| Io.write_error
| move_error
| Io.close_error
]
val set_payload :
t ->
Irmin_pack_unix__.Control_file_intf.Payload.Upper.V5.t ->
(unit, [> set_error ]) Stdlib.result
RW mode
Write a new payload on disk.
RO mode
Always returns an error.
RW mode
Tell the OS to fush its internal buffers.
RO mode
Always returns Error `Ro_not_allowed
.