reth_static_file/segments/
mod.rs

1//! `StaticFile` segment implementations and utilities.
2
3mod transactions;
4pub use transactions::Transactions;
5
6mod headers;
7pub use headers::Headers;
8
9mod receipts;
10pub use receipts::Receipts;
11
12use alloy_primitives::BlockNumber;
13use reth_provider::StaticFileProviderFactory;
14use reth_static_file_types::StaticFileSegment;
15use reth_storage_errors::provider::ProviderResult;
16use std::ops::RangeInclusive;
17
18/// A segment represents moving some portion of the data to static files.
19pub trait Segment<Provider: StaticFileProviderFactory>: Send + Sync {
20    /// Returns the [`StaticFileSegment`].
21    fn segment(&self) -> StaticFileSegment;
22
23    /// Move data to static files for the provided block range.
24    /// [`StaticFileProvider`](reth_provider::providers::StaticFileProvider) will handle
25    /// the management of and writing to files.
26    fn copy_to_static_files(
27        &self,
28        provider: Provider,
29        block_range: RangeInclusive<BlockNumber>,
30    ) -> ProviderResult<()>;
31}