Crate essential_node_db

Source
Expand description

The node’s DB interface and sqlite implementation.

The core capability of the node is to:

  1. Receive blocks from an L1 relayer and validate them.
  2. Receive contracts from the p2p network so that they’re available for validation.

As a part of satisfying these requirements, this crate provides the basic functions required for safely creating the necessary tables and inserting/ querying/updating them as necessary.

Re-exports§

pub use pool::ConnectionPool;

Modules§

address
Addressed queries query for the most recent version of a key less than or equal to a given block address or solution set index. This is useful for querying un-finalized blocks where forks may exist. These queries fall back to finalized queries if the value is not found.
finalized
Finalized queries query for the most recent version of a key less than or equal to a given block number or solution set index for blocks that have been finalized.
pool
Provides the node’s ConnectionPool implementation and related items.
sql
Provides the SQL statements used by essential-node-db via const strs.

Enums§

QueryError
A database or decoding error returned by a query.

Traits§

AcquireConnection
Types that may be provided to subscribe_blocks to provide access to Connections while streaming.
AwaitNewBlock
Types that may be provided to subscribe_blocks to asynchronously await the availability of a new block.

Functions§

blob_from_words
Convert a slice of Words into a blob.
create_tables
Create all tables.
delete_state
Deletes the state for a given contract content address and key.
finalize_block
Finalizes the block with the given hash. This sets the block to be the only block at a particular block number.
get_block
Returns the block with given address.
get_block_header
Given a block address, returns the header for that block.
get_latest_finalized_block_address
Fetches the latest finalized block hash.
get_next_block_addresses
Given a block address, returns the addresses of blocks that have the next block number.
get_parent_block_address
Fetches the parent block address.
get_solution_set
Fetches a solution set by its content address.
get_validation_progress
Fetches the last progress on validation.
insert_block
For the given block:
insert_failed_block
Inserts a failed block.
list_blocks
Lists all blocks in the given range.
list_blocks_by_time
Lists blocks and their solution sets within a specific time range with pagination.
list_failed_blocks
List failed blocks as (block number, solution set hash) within a given range.
list_unchecked_blocks
Lists all unchecked blocks in the given range.
query_state
Fetches the state value for the given contract content address and key pair.
subscribe_blocks
Subscribe to all blocks from the given starting block number.
update_state
Updates the state for a given contract content address and key.
update_validation_progress
Updates the progress on validation.
with_tx
Short-hand for constructing a transaction, providing it as an argument to the given function, then committing the transaction before returning.
with_tx_dropped
Short-hand for constructing a transaction, providing it as an argument to the given function, then dropping the transaction before returning.
words_from_blob
Convert a blob into a vector of Words.