123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173(*
* Copyright (c) 2018-2021 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!ImportmoduletypeStore=sigincludeIrmin_layers.SincludeIrmin_pack.Specificswithtyperepo:=repoandtypecommit:=commitvalintegrity_check:?ppf:Format.formatter->auto_repair:bool->repo->(([>`Fixedofint|`No_error],[>`Cannot_fixofstring|`Corruptedofint])result*Irmin_layers.Layer_id.t)listendmoduletypeMaker=functor(M:Irmin.Metadata.S)(C:Irmin.Contents.S)(P:Irmin.Path.S)(B:Irmin.Branch.S)(H:Irmin.Hash.S)->Storewithtypekey=P.tandtypestep=P.stepandtypemetadata=M.tandtypecontents=C.tandtypebranch=B.tandtypehash=H.tmoduletypeLayered_general=sigtype'atvalclose:_t->unitLwt.tvalupdate_flip:flip:bool->_t->unitvalflip_upper:_t->unitendmoduletypeLayered=sigtypetincludeLayered_generalwithtype_t:=tendmoduletypeAtomic_write=sigopenIrmin_pack.Atomic_writeincludeSmoduleU:PersistentmoduleL:Persistentvalv:U.t->U.t->L.toption->flip:bool->freeze_in_progress:(unit->bool)->tvalcopy:mem_commit_lower:(value->boolLwt.t)->mem_commit_upper:(value->boolLwt.t)->t->unitLwt.tincludeLayeredwithtypet:=tvalflush_next_lower:t->unitvalclear_previous_upper:?keep_generation:unit->t->unitLwt.tvalcopy_newies_to_next_upper:t->unitLwt.tendmoduletypeContent_addressable=sigopenIrmin_pack.Pack_storeincludeSmoduleU:Swithtypevalue=valueandtypeindex:=indexmoduleL:Swithtypeindex:=indexvalv:readU.t->readU.t->readL.toption->flip:bool->freeze_in_progress:(unit->bool)->readtvallayer_id:readt->key->Irmin_layers.Layer_id.tLwt.ttype'alayer_type=|Upper:readU.tlayer_type|Lower:readL.tlayer_typevalcopy:'llayer_type*'l->readt->string->key->unitvalcopy_from_lower:readt->dst:'aU.t->?aux:(value->unitLwt.t)->string->key->unitLwt.tvalmem_lower:'at->key->boolLwt.tvalmem_next:[>read]t->key->boolLwt.tvalcurrent_upper:'at->readU.tvalnext_upper:'at->readU.tvallower:'at->readL.tvalclear_previous_upper:?keep_generation:unit->'at->unitLwt.tvalsync:?on_generation_change:(unit->unit)->?on_generation_change_next_upper:(unit->unit)->'at->boolincludeLayered_generalwithtype'at:='atvalclear_caches_next_upper:'at->unitvalunsafe_append:ensure_unique:bool->overcommit:bool->'at->key->value->unitvalflush_next_lower:'at->unitvalintegrity_check:offset:int63->length:int->layer:Irmin_layers.Layer_id.t->key->_t->(unit,Irmin_pack.Checks.integrity_error)resultvalconsume_newies:'at->keylistvalcheck:'at->?none:(unit->unitLwt.t)->?some:(value->unitLwt.t)->key->unitLwt.tendmoduletypeContent_addressable_maker=sigtypekeytypeindexmoduleMake(V:Irmin_pack.Pack_value.Swithtypehash:=key):Content_addressablewithtypekey=keyandtypevalue=V.tandtypeindex=indexandtypeU.key=keyandtypeL.key=keyandtypeU.value=V.tandtypeL.value=V.tend