pub struct WriteBuffer { /* private fields */ }
Expand description
A sharded write buffer for staging incoming data points before flushing to storage. Uses a HashMap where keys are series names and values are mutex-protected Vecs.
Implementations§
Source§impl WriteBuffer
impl WriteBuffer
Sourcepub fn stage(&mut self, series: &str, point: DataPoint) -> Result<(), DbError>
pub fn stage(&mut self, series: &str, point: DataPoint) -> Result<(), DbError>
Stages a single data point into the buffer for the corresponding series. If the series buffer doesn’t exist, it’s created. Acquires a lock only on the specific series buffer being written to.
Sourcepub fn drain_all_buffers(&mut self) -> HashMap<String, Vec<DataPoint>>
pub fn drain_all_buffers(&mut self) -> HashMap<String, Vec<DataPoint>>
Drains all data from all series buffers, returning it for flushing. This requires acquiring locks on all buffers sequentially. Consider potential performance implications if there are many series. Returns a HashMap mapping series names to their drained data points.
Trait Implementations§
Source§impl Debug for WriteBuffer
impl Debug for WriteBuffer
Source§impl Default for WriteBuffer
impl Default for WriteBuffer
Source§fn default() -> WriteBuffer
fn default() -> WriteBuffer
Returns the “default value” for a type. Read more
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> 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