pub struct CompressedReplayLog {
pub frequency_sketch: CountMinSketch,
pub entry_sample: ReservoirSampler<String>,
pub error_sample: ReservoirSampler<String>,
pub schema_version: String,
}Expand description
Compressed replay log combining count-min sketch and reservoir sampling.
Tracks both frequency estimates (via CMS) and representative samples (via reservoir) for efficient log analysis.
Fields§
§frequency_sketch: CountMinSketchFrequency sketch for operation counts.
entry_sample: ReservoirSampler<String>Sample of recent log entries.
error_sample: ReservoirSampler<String>Sample of error messages.
schema_version: StringSchema version for serialization compatibility.
Implementations§
Source§impl CompressedReplayLog
impl CompressedReplayLog
Sourcepub fn with_params(
sketch_width: usize,
sketch_depth: usize,
entry_sample_size: usize,
error_sample_size: usize,
) -> Self
pub fn with_params( sketch_width: usize, sketch_depth: usize, entry_sample_size: usize, error_sample_size: usize, ) -> Self
Create with custom parameters.
sketch_width: Width of frequency sketchsketch_depth: Depth of frequency sketchentry_sample_size: Number of log entries to retainerror_sample_size: Number of error messages to retain
Sourcepub fn record_operation(&mut self, operation: &str)
pub fn record_operation(&mut self, operation: &str)
Record an operation.
Sourcepub fn record_entry(&mut self, entry: String)
pub fn record_entry(&mut self, entry: String)
Record a log entry.
Sourcepub fn record_error(&mut self, error: String)
pub fn record_error(&mut self, error: String)
Record an error.
Sourcepub fn estimate_frequency(&self, operation: &str) -> u64
pub fn estimate_frequency(&self, operation: &str) -> u64
Estimate the frequency of an operation.
Sourcepub fn sampled_entries(&self) -> &[String]
pub fn sampled_entries(&self) -> &[String]
Get sampled log entries.
Sourcepub fn sampled_errors(&self) -> &[String]
pub fn sampled_errors(&self) -> &[String]
Get sampled errors.
Sourcepub fn total_operations(&self) -> u64
pub fn total_operations(&self) -> u64
Get total operation count.
Trait Implementations§
Source§impl Clone for CompressedReplayLog
impl Clone for CompressedReplayLog
Source§impl Debug for CompressedReplayLog
impl Debug for CompressedReplayLog
Source§impl Default for CompressedReplayLog
impl Default for CompressedReplayLog
Source§impl<'de> Deserialize<'de> for CompressedReplayLog
impl<'de> Deserialize<'de> for CompressedReplayLog
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CompressedReplayLog
impl RefUnwindSafe for CompressedReplayLog
impl Send for CompressedReplayLog
impl Sync for CompressedReplayLog
impl Unpin for CompressedReplayLog
impl UnsafeUnpin for CompressedReplayLog
impl UnwindSafe for CompressedReplayLog
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more