pub struct MmapWriter { /* private fields */ }Expand description
Memory-mapped file writer for metrics
Implementations§
Source§impl MmapWriter
impl MmapWriter
Sourcepub fn new(
path: impl AsRef<Path>,
file_size: usize,
enable_compression: bool,
) -> Result<Self>
pub fn new( path: impl AsRef<Path>, file_size: usize, enable_compression: bool, ) -> Result<Self>
Create a new memory-mapped file writer
Sourcepub fn write_snapshot(&self, snapshot: &MetricsSnapshot) -> Result<usize>
pub fn write_snapshot(&self, snapshot: &MetricsSnapshot) -> Result<usize>
Write a metrics snapshot to the memory-mapped file
Sourcepub fn write_metrics(
&self,
metrics: &[Metric],
timestamp_ns: u64,
) -> Result<usize>
pub fn write_metrics( &self, metrics: &[Metric], timestamp_ns: u64, ) -> Result<usize>
Write raw metrics (will aggregate them first)
Sourcepub fn write_position(&self) -> usize
pub fn write_position(&self) -> usize
Get the current write position
Sourcepub fn read_snapshots(&self) -> Result<Vec<MetricsSnapshot>>
pub fn read_snapshots(&self) -> Result<Vec<MetricsSnapshot>>
Read snapshots from the memory-mapped file
Auto Trait Implementations§
impl !Freeze for MmapWriter
impl !RefUnwindSafe for MmapWriter
impl Send for MmapWriter
impl Sync for MmapWriter
impl Unpin for MmapWriter
impl UnwindSafe for MmapWriter
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