fuel_core_compression::ports

Trait TemporalRegistry

source
pub trait TemporalRegistry<T> {
    // Required methods
    fn read_registry(&self, key: &RegistryKey) -> Result<T>;
    fn read_timestamp(&self, key: &RegistryKey) -> Result<Tai64>;
    fn write_registry(
        &mut self,
        key: &RegistryKey,
        value: &T,
        timestamp: Tai64,
    ) -> Result<()>;
    fn registry_index_lookup(&self, value: &T) -> Result<Option<RegistryKey>>;
}
Expand description

Rolling cache for compression. Holds the latest state which can be event sourced from the compressed blocks. The changes done using this trait in a single call to compress or decompress must be committed atomically, after which block height must be incremented.

Required Methods§

source

fn read_registry(&self, key: &RegistryKey) -> Result<T>

Reads a value from the registry at its current height.

source

fn read_timestamp(&self, key: &RegistryKey) -> Result<Tai64>

Reads timestamp of the value from the registry.

source

fn write_registry( &mut self, key: &RegistryKey, value: &T, timestamp: Tai64, ) -> Result<()>

Writes a value from to the registry. The timestamp is the time of the block, and it is used for key retention.

source

fn registry_index_lookup(&self, value: &T) -> Result<Option<RegistryKey>>

Lookup registry key by the value.

Implementations on Foreign Types§

source§

impl<D, T> TemporalRegistry<T> for &mut D
where D: TemporalRegistry<T>,

source§

fn read_registry(&self, key: &RegistryKey) -> Result<T>

source§

fn read_timestamp(&self, key: &RegistryKey) -> Result<Tai64>

source§

fn write_registry( &mut self, key: &RegistryKey, value: &T, timestamp: Tai64, ) -> Result<()>

source§

fn registry_index_lookup(&self, value: &T) -> Result<Option<RegistryKey>>

Implementors§