Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Source file store_errors.ml
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022-2023 Nomadic Labs, <contact@nomadic-labs.com> *)(* Copyright (c) 2023 Trili Tech, <contact@trili.tech> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)typeerror+=|Cannot_load_storeof{name:string;path:string}|Cannot_write_to_storeofstring|Cannot_write_key_value_pair_to_storeof{key:string;value:string;name:string;}|Cannot_write_singleton_value_to_storeof{value:string;name:string}|Cannot_remove_key_from_storeof{key:string;name:string}|Cannot_read_from_storeofstring|Cannot_read_key_from_storeof{key:string;name:string}|Decoding_errorofData_encoding.Binary.read_error|Encoding_errorofData_encoding.Binary.write_error|Cannot_close_storeofstring|Cannot_overwrite_key_in_storeof{key:string;old_value:string;new_value:string;name:string;}|Gc_failedofstringletpp_hexppfs=Hex.ppppf(Hex.of_strings)let()=register_error_kind~id:"layer2_store.cannot_load_store"~title:"Store cannot be loaded"~description:"Store cannot be loaded."~pp:(funppf(name,path)->Format.fprintfppf"Store %s cannot be loaded from %s."namepath)`PermanentData_encoding.(obj2(req"name"string)(req"path"string))(functionCannot_load_store{name;path}->Some(name,path)|_->None)(fun(name,path)->Cannot_load_store{name;path})let()=register_error_kind~id:"layer2_store.cannot_write_to_store"~title:"Cannot write to store"~description:"Cannot write to store %s."~pp:(funppfname->Format.fprintfppf"Cannot write to store %s."name)`PermanentData_encoding.(obj1(req"name"string))(functionCannot_write_to_storename->Somename|_->None)(funn->Cannot_write_to_storen)let()=register_error_kind~id:"layer2_store.cannot_write_key_value_pair_to_store"~title:"Cannot write key-value pair to store"~description:"Cannot write key-value pair to store."~pp:(funppf(key,value,name)->Format.fprintfppf"The key-value pair with key %a and value %a cannot be written to \
store %s."pp_hexkeypp_hexvaluename)`PermanentData_encoding.(obj3(req"key"(string'Hex))(req"value"(string'Hex))(req"name"string))(function|Cannot_write_key_value_pair_to_store{key;value;name}->Some(key,value,name)|_->None)(fun(key,value,name)->Cannot_write_key_value_pair_to_store{key;value;name})let()=register_error_kind~id:"layer2_store.cannot_write_singleton_value_to_store"~title:"Cannot write singleton value to store"~description:"Cannot write singleton value to store."~pp:(funppf(value,name)->Format.fprintfppf"The singleton value %a cannot be written to store %s."pp_hexvaluename)`PermanentData_encoding.(obj2(req"value"(string'Hex))(req"name"string))(function|Cannot_write_singleton_value_to_store{value;name}->Some(value,name)|_->None)(fun(value,name)->Cannot_write_singleton_value_to_store{value;name})let()=register_error_kind~id:"layer2_store.cannot_remove_key_from_store"~title:"Cannot remove key from store"~description:"Cannot remove key from store."~pp:(funppf(key,name)->Format.fprintfppf"Cannot remove key %a from store %s"pp_hexkeyname)`PermanentData_encoding.(obj2(req"key"(string'Hex))(req"name"string))(function|Cannot_remove_key_from_store{key;name}->Some(key,name)|_->None)(fun(key,name)->Cannot_remove_key_from_store{key;name})let()=register_error_kind~id:"layer2_store.cannot_close_store"~title:"Store cannot be closed"~description:"Store cannot be closed."~pp:(funppfname->Format.fprintfppf"Store %s cannot be closed."name)`PermanentData_encoding.(obj1(req"name"string))(functionCannot_close_storen->Somen|_->None)(funn->Cannot_close_storen)let()=register_error_kind~id:"layer2_store.cannot_read_from_store"~title:"Value cannot be read from store"~description:"Value cannot be read from store."~pp:(funppfname->Format.fprintfppf"Value cannot be read from store %s."name)`PermanentData_encoding.(obj1(req"name"string))(functionCannot_read_from_storen->Somen|_->None)(funn->Cannot_read_from_storen)let()=register_error_kind~id:"layer2_store.cannot_read_key_from_store"~title:"Cannot read key from store"~description:"Cannot read key from store."~pp:(funppf(key,name)->Format.fprintfppf"Cannot read key %a from store %s"pp_hexkeyname)`PermanentData_encoding.(obj2(req"key"(string'Hex))(req"name"string))(function|Cannot_read_key_from_store{key;name}->Some(key,name)|_->None)(fun(key,name)->Cannot_read_key_from_store{key;name})let()=register_error_kind~id:"layer2_store.decoding_error"~title:"Cannot decode persisted element"~description:"The raw value for a persisted element could not be decoded"~pp:(funppferror->Format.fprintfppf"Decoding error: %a"Data_encoding.Json.pp(Data_encoding.Json.constructData_encoding.Binary.read_error_encodingerror))`PermanentData_encoding.(obj1(req"error"Data_encoding.Binary.read_error_encoding))(functionDecoding_errore->Somee|_->None)(fune->Decoding_errore)let()=register_error_kind~id:"layer2_store.encoding_error"~title:"Cannot encode element"~description:"An element could not be encoded to a raw value."~pp:(funppferror->Format.fprintfppf"Encoding error: %a"Data_encoding.Json.pp(Data_encoding.Json.constructData_encoding.Binary.write_error_encodingerror))`PermanentData_encoding.(obj1(req"error"Data_encoding.Binary.write_error_encoding))(functionEncoding_errore->Somee|_->None)(fune->Encoding_errore)let()=register_error_kind~id:"layer2_store.cannot_overwrite_key_in_store"~title:"Key is already present with a different value in store"~description:"Key is already present with a different value in store."~pp:(funppf(key,old_value,new_value,name)->Format.fprintfppf"Cannot update key %a to value %a in store %s, as a binding for the \
key with a different value %a already exists."pp_hexkeypp_hexnew_valuenamepp_hexold_value)`PermanentData_encoding.(obj4(req"key"(string'Hex))(req"old_value"(string'Hex))(req"new_value"(string'Hex))(req"name"string))(function|Cannot_overwrite_key_in_store{key;old_value;new_value;name}->Some(key,old_value,new_value,name)|_->None)(fun(key,old_value,new_value,name)->Cannot_overwrite_key_in_store{key;old_value;new_value;name})let()=register_error_kind~id:"layer2_store.gc_failed"~title:"GC of store failed"~description:"Garbage collection of store failed."~pp:(funppfname->Format.fprintfppf"Garbage collection of store %s failed."name)`PermanentData_encoding.(obj1(req"name"string))(functionGc_failedn->Somen|_->None)(funn->Gc_failedn)