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