1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889(*
* Copyright (c) 2018-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.
*)open!Import(** A [Pack_store.S] is a closeable, persistent implementation of {!Indexable.S}
that uses an append-only file of variable-length data blocks.
Certain values in the data file are indexed by hash via a {!Pack_index.S}
implementation, but not all of them need be. *)moduletypeS=sigincludeIrmin_pack.Indexable.Stypefile_managertypedicttypedispatchervalv:config:Irmin.Backend.Conf.t->fm:file_manager->dict:dict->dispatcher:dispatcher->readtvalcast:readt->read_writet(** @inline *)includeIrmin_pack.Checkablewithtype'at:='atandtypehash:=hashmoduleEntry_prefix:sigtypet={hash:hash;kind:Pack_value.Kind.t;size_of_value_and_length_header:intoption;(** Remaining bytes in the entry after reading the hash and the kind
(i.e. the length of the length header + the value of the length
header), if the entry has a length header (otherwise [None]).
NOTE: the length stored in the index and in direct pack keys is
the {!total_entry_length} (including the hash and the kind). *)}valtotal_entry_length:t->intoptionendvalread_and_decode_entry_prefix:off:int63->dispatcher->Entry_prefix.t(** Read the entry prefix at offset [off]. *)valindex_direct_with_kind:'at->hash->(key*Pack_value.Kind.t)option(** Returns the key and the kind of an object indexed by hash. *)valpurge_lru:'at->unitendmoduletypeSigs=sigexceptionInvalid_readofstringmoduletypeS=SmoduleMake(Fm:File_manager.S)(Dict:Dict.SwithmoduleFm=Fm)(Dispatcher:Dispatcher.SwithmoduleFm=Fm)(Hash:Irmin.Hash.Swithtypet=Fm.Index.key)(Val:Pack_value.Persistentwithtypehash:=Hash.tandtypekey:=Hash.tPack_key.t)(Errs:Io_errors.SwithmoduleIo=Fm.Io):Swithtypekey=Hash.tPack_key.tandtypehash=Hash.tandtypevalue=Val.tandtypefile_manager=Fm.tandtypedispatcher=Dispatcher.tandtypedict=Dict.tend