//! Data sharding for horizontal scalability.
//!
//! This module implements consistent hashing and range management for
//! distributing data across cluster nodes:
//!
//! - **Types**: `ShardId`, `RangeDescriptor`, `MetaRange` for shard metadata
//! - **Router**: Subject→shard mapping using jump hash
//! - **Manager**: Split/merge operations for dynamic rebalancing
//!
//! # Sharding Algorithm
//!
//! StemeDB uses Google's jump consistent hash algorithm:
//!
//! 1. Subject string is hashed using BLAKE3
//! 2. Hash is mapped to shard ID using jump hash
//! 3. Jump hash provides:
//!    - O(1) time and space complexity
//!    - Minimal disruption when shard count changes
//!    - Even distribution across shards
//!
//! # Range Management
//!
//! Shards can dynamically split and merge based on data size:
//!
//! - **Split**: When shard exceeds 64MB, split into two
//! - **Merge**: When adjacent shards are <20MB combined, merge
//!
//! This maintains balanced shard sizes without manual intervention.

mod manager;
mod router;
mod types;

pub use manager::RangeManager;
pub use router::{RangeRouter, SharedRangeRouter};
pub use types::{MetaRange, RangeDescriptor, ShardId, ShardRole};
