Skip to main content

hyperi_rustlib/io/
mod.rs

1// Project:   hyperi-rustlib
2// File:      src/io/mod.rs
3// Purpose:   Shared NDJSON file I/O module
4// Language:  Rust
5//
6// License:   BUSL-1.1
7// Copyright: (c) 2026 HYPERI PTY LIMITED
8
9//! Shared NDJSON file I/O primitives.
10//!
11//! Provides [`NdjsonWriter`] -- a rotating file writer for newline-delimited JSON.
12//! Used by both the DLQ file backend and the file output sink.
13//!
14//! ## Design
15//!
16//! `NdjsonWriter` is a thin wrapper around `file-rotate` that handles:
17//! - Rotating NDJSON files by time (hourly/daily)
18//! - Optional gzip compression of rotated files
19//! - Age-based cleanup of old files
20//! - Atomic write counters for metrics
21//!
22//! It knows nothing about DLQ or output semantics -- callers serialise their
23//! own types and hand raw `&[u8]` lines to the writer.
24
25mod config;
26mod ndjson_writer;
27
28pub use config::{FileWriterConfig, RotationPeriod};
29pub use ndjson_writer::{AsyncNdjsonWriter, NdjsonWriter};