#[non_exhaustive]pub struct BufferStats {
pub pending_count: u64,
pub latest_sequence: u64,
pub head_sequence: u64,
pub next_sequence: u64,
pub approx_disk_bytes: u64,
pub segment_count: u64,
pub max_size_bytes: u64,
pub store_pressure: f32,
}Expand description
Point-in-time snapshot of buffer state, captured atomically under a single lock acquisition so all fields are mutually consistent.
Returned by SegmentBuffer::stats. Useful for metrics endpoints or
dashboards that need to observe multiple values without paying for several
lock/unlock round-trips (and risking a torn read between calls).
This struct is #[non_exhaustive]: new fields may be added in any release
without breaking semver. It is constructed internally by SegmentBuffer::stats;
callers read fields via dot-syntax or pattern-match with .. only.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.pending_count: u64Items waiting in the buffer (on-disk + in-memory pending).
Same value as SegmentBuffer::pending_count.
latest_sequence: u64Highest sequence number assigned (or 0 if the buffer is empty).
Same value as SegmentBuffer::latest_sequence.
head_sequence: u64Oldest unacknowledged sequence number (head_seq).
next_sequence: u64Next sequence number that will be assigned by the next successful
SegmentBuffer::append (next_seq).
approx_disk_bytes: u64Approximate total bytes used by segment files on disk. Decreases when
SegmentBuffer::delete_acked removes files.
segment_count: u64Number of segment files currently on disk. Incremented by
SegmentBuffer::flush, decremented by
SegmentBuffer::delete_acked, and recalibrated by
SegmentBuffer::sync_disk_bytes. Unlike
RecoveryReport::segment_count (a one-time open-time snapshot),
this value is live — call SegmentBuffer::stats to observe it.
max_size_bytes: u64Configured ceiling on disk usage (max_size_bytes). 0 disables the
limit; in that case store_pressure is 0.0.
store_pressure: f32approx_disk_bytes / max_size_bytes, clamped to [0.0, 1.0].
0.0 when no limit is configured.
Trait Implementations§
Source§impl Clone for BufferStats
impl Clone for BufferStats
Source§impl Debug for BufferStats
impl Debug for BufferStats
Source§impl Display for BufferStats
impl Display for BufferStats
Source§fn fmt(&self, f: &mut Formatter<'_>) -> Result
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Human-readable single-line summary suitable for logging.
The format is compact and stable across releases. All eight fields
appear in a fixed order matching the struct declaration. Byte values
(approx_disk_bytes, max_size_bytes) use binary units for
readability (4.0KB, 1.0MB); all other fields are raw numbers.