reth_prune::segments

Trait Segment

Source
pub trait Segment<Provider>:
    Debug
    + Send
    + Sync {
    // Required methods
    fn segment(&self) -> PruneSegment;
    fn mode(&self) -> Option<PruneMode>;
    fn purpose(&self) -> PrunePurpose;
    fn prune(
        &self,
        provider: &Provider,
        input: PruneInput,
    ) -> Result<SegmentOutput, PrunerError>;

    // Provided method
    fn save_checkpoint(
        &self,
        provider: &Provider,
        checkpoint: PruneCheckpoint,
    ) -> ProviderResult<()>
       where Provider: PruneCheckpointWriter { ... }
}
Expand description

A segment represents a pruning of some portion of the data.

Segments are called from Pruner with the following lifecycle:

  1. Call Segment::prune with delete_limit of PruneInput.
  2. If Segment::prune returned a Some in checkpoint of SegmentOutput, call Segment::save_checkpoint.
  3. Subtract pruned of SegmentOutput from delete_limit of next PruneInput.

Required Methods§

Source

fn segment(&self) -> PruneSegment

Segment of data that’s pruned.

Source

fn mode(&self) -> Option<PruneMode>

Prune mode with which the segment was initialized.

Source

fn purpose(&self) -> PrunePurpose

Purpose of the segment.

Source

fn prune( &self, provider: &Provider, input: PruneInput, ) -> Result<SegmentOutput, PrunerError>

Prune data for Self::segment using the provided input.

Provided Methods§

Source

fn save_checkpoint( &self, provider: &Provider, checkpoint: PruneCheckpoint, ) -> ProviderResult<()>
where Provider: PruneCheckpointWriter,

Save checkpoint for Self::segment to the database.

Implementors§

Source§

impl<Provider> Segment<Provider> for AccountHistory
where Provider: DBProvider<Tx: DbTxMut>,

Source§

impl<Provider> Segment<Provider> for ReceiptsByLogs
where Provider: DBProvider<Tx: DbTxMut> + PruneCheckpointWriter + TransactionsProvider + BlockReader + NodePrimitivesProvider<Primitives: NodePrimitives<Receipt: Value>>,

Source§

impl<Provider> Segment<Provider> for SenderRecovery

Source§

impl<Provider> Segment<Provider> for reth_prune::segments::StaticFileReceipts<Provider::Primitives>
where Provider: StaticFileProviderFactory<Primitives: NodePrimitives<Receipt: Value>> + DBProvider<Tx: DbTxMut> + PruneCheckpointWriter + TransactionsProvider + BlockReader,

Source§

impl<Provider> Segment<Provider> for Transactions<Provider::Primitives>
where Provider: DBProvider<Tx: DbTxMut> + TransactionsProvider + BlockReader + StaticFileProviderFactory<Primitives: NodePrimitives<SignedTx: Value>>,

Source§

impl<Provider> Segment<Provider> for StorageHistory
where Provider: DBProvider<Tx: DbTxMut>,

Source§

impl<Provider> Segment<Provider> for TransactionLookup
where Provider: DBProvider<Tx: DbTxMut> + BlockReader<Transaction: Encodable2718>,

Source§

impl<Provider> Segment<Provider> for reth_prune::segments::UserReceipts
where Provider: DBProvider<Tx: DbTxMut> + PruneCheckpointWriter + TransactionsProvider + BlockReader + NodePrimitivesProvider<Primitives: NodePrimitives<Receipt: Value>>,

Source§

impl<Provider: StaticFileProviderFactory + DBProvider<Tx: DbTxMut>> Segment<Provider> for Headers<Provider::Primitives>