fuel_core_compression_service/
config.rs1use fuel_core_types::fuel_types::ChainId;
2use std::{
3 num::NonZeroU32,
4 time::Duration,
5};
6
7#[derive(Debug, Clone, Copy)]
9pub struct CompressionConfig {
10 temporal_registry_retention: Duration,
11 starting_height: Option<NonZeroU32>,
12 metrics: bool,
13 chain_id: ChainId,
14}
15
16impl CompressionConfig {
17 pub fn new(
19 temporal_registry_retention: Duration,
20 starting_height: Option<NonZeroU32>,
21 metrics: bool,
22 chain_id: ChainId,
23 ) -> Self {
24 Self {
25 temporal_registry_retention,
26 starting_height,
27 metrics,
28 chain_id,
29 }
30 }
31
32 pub fn temporal_registry_retention(&self) -> Duration {
34 self.temporal_registry_retention
35 }
36
37 pub fn metrics(&self) -> bool {
39 self.metrics
40 }
41
42 pub fn starting_height(&self) -> Option<u32> {
44 self.starting_height.map(|height| height.get())
45 }
46
47 pub fn chain_id(&self) -> ChainId {
49 self.chain_id
50 }
51}
52
53impl From<&CompressionConfig> for fuel_core_compression::Config {
54 fn from(config: &CompressionConfig) -> Self {
55 Self {
56 temporal_registry_retention: config.temporal_registry_retention(),
57 }
58 }
59}