Skip to content

Commit

Permalink
docs: add pruning related documentation for db service (paradigmxyz#9711
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Rjected authored Jul 22, 2024
1 parent 3ed132e commit 5c30227
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/engine/tree/src/database.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ pub struct DatabaseService<DB> {
}

impl<DB: Database> DatabaseService<DB> {
/// Create a new database service
/// Create a new database service.
///
/// NOTE: The [`ProviderFactory`] and [`Pruner`] should be built using an identical
/// [`PruneModes`](reth_prune::PruneModes).
pub const fn new(
provider: ProviderFactory<DB>,
incoming: Receiver<DatabaseAction>,
Expand Down
21 changes: 21 additions & 0 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3142,6 +3142,27 @@ impl<DB: Database> BlockExecutionWriter for DatabaseProviderRW<DB> {
}

impl<DB: Database> BlockWriter for DatabaseProviderRW<DB> {
/// Inserts the block into the database, always modifying the following tables:
/// * [`CanonicalHeaders`](tables::CanonicalHeaders)
/// * [`Headers`](tables::Headers)
/// * [`HeaderNumbers`](tables::HeaderNumbers)
/// * [`HeaderTerminalDifficulties`](tables::HeaderTerminalDifficulties)
/// * [`BlockBodyIndices`](tables::BlockBodyIndices)
///
/// If there are transactions in the block, the following tables will be modified:
/// * [`Transactions`](tables::Transactions)
/// * [`TransactionBlocks`](tables::TransactionBlocks)
///
/// If ommers are not empty, this will modify [`BlockOmmers`](tables::BlockOmmers).
/// If withdrawals are not empty, this will modify
/// [`BlockWithdrawals`](tables::BlockWithdrawals).
/// If requests are not empty, this will modify [`BlockRequests`](tables::BlockRequests).
///
/// If the provider has __not__ configured full sender pruning, this will modify
/// [`TransactionSenders`](tables::TransactionSenders).
///
/// If the provider has __not__ configured full transaction lookup pruning, this will modify
/// [`TransactionHashNumbers`](tables::TransactionHashNumbers).
fn insert_block(
&self,
block: SealedBlockWithSenders,
Expand Down

0 comments on commit 5c30227

Please sign in to comment.