Evm_node_lib_dev.Evm_store
The EVM node’s store is built around and SQLite database.
include module type of Octez_sqlite.Sqlite
Permission mode for database access.
Note that SQLite uses file-level locking for write operations. When using Read_write
mode, write operations will acquire an exclusive lock on the database file, preventing other processes from writing to it simultaneously. In this case the pool size is always 1. In Read_only
mode, multiple processes can read concurrently.
val close : t -> unit Lwt.t
val vacuum :
conn:conn ->
output_db_file:string ->
unit Tezos_error_monad.Error_monad.tzresult Lwt.t
Rebuild the database in output_db_file
using the VACUUM
sqlite command. This function is useful to backup the database.
val vacuum_self :
conn:conn ->
unit Tezos_error_monad.Error_monad.tzresult Lwt.t
Vacuums the database itself after removing lot of data VACUUM
sqlite command.
val use :
t ->
(conn -> 'a Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'a Tezos_error_monad.Error_monad.tzresult Lwt.t
use db k
executes k
with a fresh connection to db
.
val with_transaction :
conn ->
(conn -> 'a Tezos_error_monad.Error_monad.tzresult Lwt.t) ->
'a Tezos_error_monad.Error_monad.tzresult Lwt.t
with_transaction conn k
wraps the accesses to the database from conn
made in the continuation k
within a SQL transaction. If k
fails, the transaction is rollbacked. Otherwise, the transaction is committed.
val assert_in_transaction : conn -> unit
assert_in_transaction conn
raises an exception if a transaction has not been started with conn
.
module Request : sig ... end
Module for creating SQL requests with metadata for tracing and debugging. This is a wrapper around Caqti's request system with additional metadata.
module Db : sig ... end
Caqti convenience functions wrapped in the Tezos error monad. See Caqti_connection_sig.Convenience
.
with_connection conn k
allows to wraps atomic low level accesses to the database from conn
. with_connection
can be used in the continuation of with_transaction
.
val init :
?max_conn_reuse_count:int ->
data_dir:string ->
perm:perm ->
unit ->
t Tezos_base.TzPervasives.tzresult Lwt.t
init ?max_conn_reuse_count ~data_dir ~perm ()
returns a handler to the EVM node store located under data_dir
. If no store is located in data_dir
, an empty store is created. Also returns if the store was created (true
) or was already existing (false
).
If perm
is Read_only
, then SQL requests requiring write access will fail. With Read_write
, they will succeed as expected.
module Schemas : sig ... end
module Blueprints : sig ... end
module Context_hashes : sig ... end
type pending_kernel_upgrade = {
kernel_upgrade : Evm_node_lib_dev_encoding.Evm_events.Upgrade.t;
injected_before : Evm_node_lib_dev_encoding.Ethereum_types.quantity;
}
type pending_sequencer_upgrade = {
sequencer_upgrade : Evm_node_lib_dev_encoding.Evm_events.Sequencer_upgrade.t;
injected_before : Evm_node_lib_dev_encoding.Ethereum_types.quantity;
}
module Kernel_upgrades : sig ... end
module Sequencer_upgrades : sig ... end
module Delayed_transactions : sig ... end
module Blocks : sig ... end
module Block_storage_mode : sig ... end
val context_hash_of_block_hash :
conn ->
Evm_node_lib_dev_encoding.Ethereum_types.block_hash ->
Tezos_layer2_irmin_context.Irmin_context.hash option
Tezos_base.TzPervasives.tzresult
Lwt.t
module Transactions : sig ... end
module Irmin_chunks : sig ... end
module Pending_confirmations : sig ... end
module L1_l2_levels_relationships : sig ... end
module L1_l2_finalized_levels : sig ... end
type metadata = {
smart_rollup_address : Octez_smart_rollup.Address.t;
history_mode : Evm_node_config.Configuration.history_mode;
}
module Metadata : sig ... end
val reset_after :
conn ->
l2_level:Evm_node_lib_dev_encoding.Ethereum_types.quantity ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
reset_after conn ~l2_level
clear the table that has information related to l2 level after l2_level
val reset_before :
conn ->
l2_level:Evm_node_lib_dev_encoding.Ethereum_types.quantity ->
history_mode:Evm_node_config.Configuration.history_mode ->
unit Tezos_base.TzPervasives.tzresult Lwt.t
reset_before conn ~l2_level
clear the table that has information related to l2 level before l2_level
, if history_mode
is set to Full
keep block-related information and clear the rest