hyperi-rustlib 2.8.2

There's plenty of sage advice out there about how to run Rust services in production at scale — config cascades, structured logging, masking secrets, multi-backend secrets management, Prometheus, OpenTelemetry, Kafka transports, tiered disk-spillover sinks, adaptive worker pools, graceful shutdown — but almost none of it as code you can just install and use. This is that code. Opinionated, drop-in, working out of the box. The patterns from blog posts, watercooler chats and beers with your Google mates as actual library — not a framework you assemble from twenty crates and 8 weeks of munging.
Documentation
// Project:   hyperi-rustlib
// File:      src/spool/mod.rs
// Purpose:   Disk-backed async FIFO queue with optional compression
// Language:  Rust
//
// License:   BUSL-1.1
// Copyright: (c) 2026 HYPERI PTY LIMITED

//! Disk-backed async FIFO queue with optional zstd compression.
//!
//! This module provides a persistent queue for spooling data to disk,
//! useful for buffering data when downstream systems are unavailable
//! or for implementing store-and-forward patterns.
//!
//! Built on [yaque](https://crates.io/crates/yaque), a fast, async,
//! persistent queue with transactional semantics.
//!
//! ## Features
//!
//! - Persistent storage survives restarts
//! - Transactional writes (crash-safe)
//! - Optional zstd compression for reduced disk usage
//! - Configurable size limits
//! - Async-native API
//!
//! ## Example
//!
//! ```rust,no_run
//! use hyperi_rustlib::spool::{Spool, SpoolConfig};
//!
//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
//! let config = SpoolConfig {
//!     path: "/tmp/my-spool".into(),
//!     compress: true,
//!     ..Default::default()
//! };
//!
//! let mut spool = Spool::open(config).await?;
//!
//! // Add items to the queue
//! spool.push(b"first message").await?;
//! spool.push(b"second message").await?;
//!
//! // Process items (FIFO order)
//! while let Some(data) = spool.pop_front().await? {
//!     println!("Processing: {:?}", data);
//! }
//! # Ok(())
//! # }
//! ```

mod config;
mod error;
mod queue;

pub use config::SpoolConfig;
pub use error::SpoolError;
pub use queue::Spool;

/// Result type for spool operations.
pub type Result<T> = std::result::Result<T, SpoolError>;