Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file file_manager_intf.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228(*
* Copyright (c) 2022-2022 Tarides <contact@tarides.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*)openImportmoduletypeS=sig(** Abstraction that governs the lifetime of the various files that are part
of a pack store (except the branch store).
The file manager handles the files one by one and makes explicit all the
interactions between them (except the index which is handled at a high
level). *)moduleIo:Io.SmoduleControl:Control_file.SwithmoduleIo=IomoduleDict:Append_only_file.SwithmoduleIo=IomoduleSuffix:Append_only_file.SwithmoduleIo=IomoduleIndex:Pack_index.SmoduleErrs:Io_errors.SwithmoduleIo=IomoduleMapping_file:Mapping_file.SwithmoduleIo=Iotypetvalcontrol:t->Control.tvaldict:t->Dict.tvalsuffix:t->Suffix.tvalindex:t->Index.tvalmapping:t->Mapping_file.toptionvalprefix:t->Io.toptiontypecreate_error:=[Io.create_error|Io.write_error|Io.open_error|Io.mkdir_error|`Corrupted_mapping_fileofstring|`Not_a_directoryofstring|`Index_failureofstring]valcreate_rw:overwrite:bool->Irmin.Backend.Conf.t->(t,[>create_error])result(** Note on SWMR consistency: It is undefined for a reader to attempt an
opening before [create_rw] is over.
Note on crash consistency: Crashing during [create_rw] leaves the storage
in an undefined state.
Note on errors: If [create_rw] returns an error, the storage is left in an
undefined state and some file descriptors might not be closed. *)typeopen_rw_error:=[`Corrupted_control_file|`Corrupted_mapping_fileofstring|`Double_close|`Closed|`File_existsofstring|`Index_failureofstring|`Invalid_argument|`Invalid_layout|`Io_miscofControl.Io.misc_error|`Migration_needed|`No_such_file_or_directory|`Not_a_directoryofstring|`Not_a_file|`Read_out_of_bounds|`Ro_not_allowed|`Sys_errorofstring|`V3_store_from_the_future|`Only_minimal_indexing_strategy_allowed|`Unknown_major_pack_versionofstring|`Index_failureofstring|`Sys_errorofstring|`Inconsistent_store]valopen_rw:Irmin.Backend.Conf.t->(t,[>open_rw_error])result(** Note on SWMR consistency: It is undefined for a reader to attempt and
opening during an [open_rw].
Note on crash consistency: If [open_rw] crashes during
[open_rw_migrate_from_v1_v2], the storage is left in an undefined state.
Otherwise the storage is unaffected.
Note on errors: If [open_rw] returns an error during
[open_rw_migrate_from_v1_v2], the storage is left in an undefined state.
Otherwise the storage is unaffected. Anyhow, some file descriptors might
not be closed. *)typeopen_ro_error:=[`Corrupted_control_file|`Corrupted_mapping_fileofstring|`File_existsofstring|`Io_miscofIo.misc_error|`Migration_needed|`No_such_file_or_directory|`Not_a_file|`Closed|`V3_store_from_the_future|`Index_failureofstring|`Unknown_major_pack_versionofstring|`Inconsistent_store|`Invalid_argument|`Read_out_of_bounds|`Ro_not_allowed]valopen_ro:Irmin.Backend.Conf.t->(t,[>open_ro_error])result(** Note on SWMR consistency: TODO: doc
Note on crash consistency: The storage is never mutated.
Note on errors: The storage is never mutated. Some file descriptors might
not be closed. *)typeclose_error:=[`Double_close|`Index_failureofstring|`Io_miscofIo.misc_error|`Pending_flush|`Ro_not_allowed]valclose:t->(unit,[>close_error])result(** Close all the files.
This call fails if the append buffers are not in a flushed stated. This
situation will most likely never occur because the append buffers will
contain data only during the scope of a batch function.
After *)typeflush_error:=[`Index_failureofstring|`Io_miscofIo.misc_error|`Ro_not_allowed|`Closed]typeflush_stages:=[`After_dict|`After_suffix]type'ahook:='a->unitvalflush:?hook:flush_stageshook->t->(unit,[>flush_error])resulttypereload_stages:=[`After_index|`After_control|`After_suffix]valreload:?hook:reload_stageshook->t->(unit,[>Errs.t])resultvalregister_mapping_consumer:t->after_reload:(unit->(unit,Errs.t)result)->unitvalregister_dict_consumer:t->after_reload:(unit->(unit,Errs.t)result)->unitvalregister_suffix_consumer:t->after_flush:(unit->unit)->unittypeversion_error:=[`Corrupted_control_file|`Corrupted_legacy_file|`Invalid_layout|`Io_miscofIo.misc_error|`No_such_file_or_directory|`Not_a_directoryofstring|`Unknown_major_pack_versionofstring]valversion:root:string->(Import.Version.t,[>version_error])result(** [version ~root] is the version of the files at [root]. *)valswap:t->generation:int->right_start_offset:int63->right_end_offset:int63->(unit,[>Errs.t])resulttypewrite_gc_output_error:=[`Double_close|`File_existsofstring|`Io_miscofIo.misc_error|`Ro_not_allowed|`Closed]valwrite_gc_output:root:string->generation:int->(int63,Errs.t)result->(unit,[>write_gc_output_error])result(** Used by the gc process at the end to write its output in
store.<generation>.out. *)typeread_gc_output_error=[`Corrupted_gc_result_fileofstring|`Gc_process_errorofstring][@@derivingirmin]valread_gc_output:root:string->generation:int->(int63,[>read_gc_output_error])result(** Used by the main process, after the gc process finished, to read
store.<generation>.out. *)valreadonly:t->boolvalgeneration:t->intvalgc_allowed:t->boolendmoduletypeSigs=sigmoduletypeS=SmoduleMake(Control:Control_file.SwithmoduleIo=Io.Unix)(Dict:Append_only_file.SwithmoduleIo=Control.Io)(Suffix:Append_only_file.SwithmoduleIo=Control.Io)(Index:Pack_index.S)(Errs:Io_errors.SwithmoduleIo=Control.Io):SwithmoduleIo=Control.IoandmoduleControl=ControlandmoduleDict=DictandmoduleSuffix=SuffixandmoduleIndex=Indexend