Skip to main content

Module write_buffer

Module write_buffer 

Source
Expand description

In-memory write buffer for time-series ingestion: size/time flush policies, WAL integration, backpressure (v2.0.0). In-memory write buffer for time-series data ingestion.

Accumulates incoming data points before flushing them to durable storage. Supports size-based, time-based, and explicit flush policies, WAL integration hooks, out-of-order write handling, backpressure, and partial flushing.

§Example

use oxirs_tsdb::write_buffer::{WriteBufferConfig, WriteBuffer, FlushPolicy, DataPoint};

let config = WriteBufferConfig {
    max_capacity: 1000,
    flush_policy: FlushPolicy::SizeBased { threshold: 500 },
    ..Default::default()
};
let mut buf = WriteBuffer::new(config);
buf.push(DataPoint { series_id: 1, timestamp_ms: 1_000, value: 3.14 }).expect("push failed");
if buf.should_flush() {
    let points = buf.flush().expect("flush failed");
    println!("flushed {} points", points.len());
}

Structs§

BufferStats
Statistics about the current state and historical activity of the buffer.
DataPoint
A single time-series observation.
NoopWalSink
A no-op WAL sink (drops all entries).
WalEntry
A simulated write-ahead log entry produced during a flush.
WriteBuffer
In-memory write buffer for time-series data points.
WriteBufferConfig
Configuration for the write buffer.

Enums§

BufferState
Lifecycle state of the write buffer.
FlushPolicy
Determines when the buffer should be automatically flushed.
WriteBufferError
Errors produced by the write buffer.

Traits§

WalSink
Trait for sinking WAL entries to durable storage.

Type Aliases§

WriteBufferResult
Result alias for write buffer operations.