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§
Sourcefn read_registry(&self, key: &RegistryKey) -> Result<T>
fn read_registry(&self, key: &RegistryKey) -> Result<T>
Reads a value from the registry at its current height.
Sourcefn read_timestamp(&self, key: &RegistryKey) -> Result<Tai64>
fn read_timestamp(&self, key: &RegistryKey) -> Result<Tai64>
Reads timestamp of the value from the registry.
Sourcefn write_registry(
&mut self,
key: &RegistryKey,
value: &T,
timestamp: Tai64,
) -> Result<()>
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.
Sourcefn registry_index_lookup(&self, value: &T) -> Result<Option<RegistryKey>>
fn registry_index_lookup(&self, value: &T) -> Result<Option<RegistryKey>>
Lookup registry key by the value.