pub trait DataStore {
    type Error;

    fn initialize(&mut self) -> Result<(), Self::Error>;
    fn store_data(&mut self, data: &[u8], key: &str) -> Result<(), Self::Error>;
    fn read_data(&mut self, key: &str) -> Result<Vec<u8>, Self::Error>;
    fn cleanup_data(&mut self, key: &str) -> Result<(), Self::Error>;
    fn detect_anomaly(
        &self,
        execution_time: Duration,
        memory_delta: usize
    ) -> bool; fn collect_anomaly_data(
        &mut self,
        key: &str,
        anomaly_data: AnomalyData<'_>
    ) -> Result<(), Self::Error>; }
Expand description

This trait is used for

  • persisting prev_data between successive calls of an interpreter
  • logging previous, current, and new data in case of spikes

Required Associated Types

Required Methods

Cleanup data that become obsolete.

Returns true if an anomaly happened and it’s necessary to save execution data for debugging purposes. execution_time - is time taken by the interpreter to execute provided script memory_delta - is a count of bytes on which an interpreter heap has been extended during execution of a particle

Implementors