fuel_core_compression/
config.rs1use core::time::Duration;
2
3use fuel_core_types::tai64::{
4 Tai64,
5 Tai64N,
6};
7
8#[derive(Debug, Clone, Copy)]
9pub struct Config {
10 pub temporal_registry_retention: Duration,
14}
15
16impl Config {
17 pub fn is_timestamp_accessible(
22 &self,
23 block_timestamp: Tai64,
24 key_timestamp: Tai64,
25 ) -> anyhow::Result<bool> {
26 let block = Tai64N(block_timestamp, 0);
27 let key = Tai64N(key_timestamp, 0);
28 let duration = block
29 .duration_since(&key)
30 .map_err(|_| anyhow::anyhow!("Invalid timestamp ordering"))?;
31 Ok(duration <= self.temporal_registry_retention)
32 }
33}