Expand description
The database API for the block builder’s solution set pool and related storage.
The essential-builder-db
crate provides a simple database API for managing the block
builder’s solution set pool and related storage, using SQLite as the underlying database. It allows
you to store, query, and delete solution sets, as well as manage solution set submissions with
timestamps.
§Overview
create_tables
: Creates all required tables in the database.insert_solution_set_submission
: Inserts a solution set and its associated submission timestamp.insert_solution_set_failure
: Records a failure to apply a solution set to a block.get_solution_set
: Retrieves a solution set by its content address.list_solution_sets
: Lists all solution sets that were submitted within a given time range.list_submissions
: Lists submissions based on timestamp.latest_solution_set_failures
: Queries the latest failures for a given solution set.delete_solution_set
: Deletes a solution set and its submissions given the solution set’s address.delete_oldest_solution_set_failures
: Deletes the oldest solution set failures until the stored number is within a given limit.
Re-exports§
pub use pool::ConnectionPool;
Modules§
- error
- pool
- Provides an async-friendly
ConnectionPool
implementation. - sql
- Provides the SQL statements used by
essential-builder-db
viaconst
str
s.
Functions§
- create_
tables - Create all tables.
- decode
- Decodes the given blob into a value of type
T
. - delete_
oldest_ solution_ set_ failures - Delete the oldest solution set failures until the number of stored failures
is less than or equal to
keep_limit
. - delete_
solution_ set - Delete the solution set with the given CA from the database if it exists.
- delete_
solution_ sets - Delete the solution sets with the given CAs from the database if they exist.
- encode
- Encodes the given value into a blob.
- get_
solution_ set - Fetches a solution set by its content address.
- insert_
solution_ set_ failure - Record a failure to include a solution set in a block.
- insert_
solution_ set_ submission - Insert a submitted solution set and the time it was received into the table.
- latest_
solution_ set_ failures - Query the latest solution set failures for a given solution set content address.
- list_
solution_ set_ failures - List the latest solution set failures.
- list_
solution_ sets - List all solution sets that were submitted within the given time range.
- list_
submissions - List all submissions that were made within the given time range.
- with_tx
- Short-hand for constructing a transaction, providing it as an argument to the given function, then committing the transaction before returning.