//! High-concurrency write support for AiFastDb
//!
//! This module provides components for handling high-throughput write operations:
//!
//! - **WriteQueue**: Async channel-based queue for buffering write requests
//! - **BatchAggregator**: Batches requests for efficient processing
//! - **BackpressureController**: Prevents system overload
//! - **ShardRouter**: Distributes writes across shards
//! - **Metrics**: Real-time monitoring of write performance
//!
//! # Architecture
//!
//! ```text
//! Clients --> BackpressureController --> ShardRouter --> WriteQueue --> BatchAggregator --> WAL --> DocumentStore
//! ```
//!
//! # Example
//!
//! ```ignore
//! use aifastdb_core::storage::concurrent::*;
//!
//! // Create a write queue with default config
//! let config = WriteQueueConfig::default();
//! let metrics = Arc::new(WriteMetrics::new());
//! let queue = WriteQueue::new(config, metrics);
//!
//! // Enqueue a write request
//! let node = MemoryNode::new("Hello, world!");
//! let sequence = queue.enqueue(node).await?;
//! ```

pub mod metrics;
pub mod write_queue;
pub mod batch_aggregator;
pub mod backpressure;
pub mod shard_router;
pub mod write_shard;

// Re-export main types
pub use metrics::{WriteMetrics, MetricsSnapshot, Timer};
pub use write_queue::{
    WriteQueue, WriteQueueConfig, WriteQueueError,
    WriteRequest, WriteResult, WriteBatch,
};
pub use batch_aggregator::{
    BatchAggregator, BatchConfig, BatchWorker,
    BatchFlushHandler, BatchFlushError, FlushReason,
    InMemoryBatchHandler,
};
pub use backpressure::{
    BackpressureController, BackpressureConfig, BackpressureAction,
};
pub use shard_router::{
    ShardRouter, ShardStrategy, ShardRouterConfig,
};
pub use write_shard::{
    WriteShard, WriteShardConfig,
};
