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§
- Buffer
Stats - Statistics about the current state and historical activity of the buffer.
- Data
Point - A single time-series observation.
- Noop
WalSink - A no-op WAL sink (drops all entries).
- WalEntry
- A simulated write-ahead log entry produced during a flush.
- Write
Buffer - In-memory write buffer for time-series data points.
- Write
Buffer Config - Configuration for the write buffer.
Enums§
- Buffer
State - Lifecycle state of the write buffer.
- Flush
Policy - Determines when the buffer should be automatically flushed.
- Write
Buffer Error - Errors produced by the write buffer.
Traits§
- WalSink
- Trait for sinking WAL entries to durable storage.
Type Aliases§
- Write
Buffer Result - Result alias for write buffer operations.