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