pub struct WriteBuffer { /* private fields */ }Expand description
Write buffer for time-series data
Provides thread-safe buffering with automatic flush triggers.
Implementations§
Source§impl WriteBuffer
impl WriteBuffer
Sourcepub fn new(config: BufferConfig) -> Self
pub fn new(config: BufferConfig) -> Self
Create new write buffer
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create with default configuration
Sourcepub async fn insert(&self, series_id: u64, point: DataPoint) -> TsdbResult<bool>
pub async fn insert(&self, series_id: u64, point: DataPoint) -> TsdbResult<bool>
Insert a data point into the buffer
Returns true if buffer should be flushed
Sourcepub async fn insert_batch(
&self,
entries: &[(u64, DataPoint)],
) -> TsdbResult<bool>
pub async fn insert_batch( &self, entries: &[(u64, DataPoint)], ) -> TsdbResult<bool>
Insert multiple points in a batch
Sourcepub async fn flush_series(&self, series_id: u64) -> TsdbResult<Vec<DataPoint>>
pub async fn flush_series(&self, series_id: u64) -> TsdbResult<Vec<DataPoint>>
Flush all buffers for a specific series
Sourcepub async fn flush_all(&self) -> TsdbResult<HashMap<u64, Vec<DataPoint>>>
pub async fn flush_all(&self) -> TsdbResult<HashMap<u64, Vec<DataPoint>>>
Flush all buffers
Returns map of series_id → data points
Sourcepub async fn stats(&self) -> BufferStats
pub async fn stats(&self) -> BufferStats
Get buffer statistics
Sourcepub async fn series_needing_flush(&self) -> Vec<u64>
pub async fn series_needing_flush(&self) -> Vec<u64>
Check which series need flushing
Auto Trait Implementations§
impl Freeze for WriteBuffer
impl !RefUnwindSafe for WriteBuffer
impl Send for WriteBuffer
impl Sync for WriteBuffer
impl Unpin for WriteBuffer
impl !UnwindSafe for WriteBuffer
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more