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:
- Call
Segment::prune
withdelete_limit
ofPruneInput
. - If
Segment::prune
returned aSome
incheckpoint
ofSegmentOutput
, callSegment::save_checkpoint
. - Subtract
pruned
ofSegmentOutput
fromdelete_limit
of nextPruneInput
.
Required Methods§
Sourcefn segment(&self) -> PruneSegment
fn segment(&self) -> PruneSegment
Segment of data that’s pruned.
Sourcefn purpose(&self) -> PrunePurpose
fn purpose(&self) -> PrunePurpose
Purpose of the segment.
Sourcefn prune(
&self,
provider: &Provider,
input: PruneInput,
) -> Result<SegmentOutput, PrunerError>
fn prune( &self, provider: &Provider, input: PruneInput, ) -> Result<SegmentOutput, PrunerError>
Prune data for Self::segment
using the provided input.
Provided Methods§
Sourcefn save_checkpoint(
&self,
provider: &Provider,
checkpoint: PruneCheckpoint,
) -> ProviderResult<()>where
Provider: PruneCheckpointWriter,
fn save_checkpoint(
&self,
provider: &Provider,
checkpoint: PruneCheckpoint,
) -> ProviderResult<()>where
Provider: PruneCheckpointWriter,
Save checkpoint for Self::segment
to the database.