//! Core Rust implementation of the PD TSO service behavior.
//! The crate keeps strict compatibility-oriented allocation logic while
//! remaining runtime-agnostic (no concrete gRPC transport dependency).

/// Administrative API state machine and gRPC handlers.
pub mod admin;
/// Group allocator implementation and configuration.
pub mod allocator;
/// In-memory election state model.
pub mod election;
/// Service and transport error models.
pub mod error;
/// Etcd-backed persistence adapter.
pub mod etcd_store;
/// Legacy forwarding transport helpers shared by compatibility surfaces.
pub(crate) mod forwarding;
/// gRPC transport adapters for `tsopb` and legacy `pdpb`.
pub mod grpc;
/// Internal protobuf conversion/status mapping helpers for gRPC transports.
pub(crate) mod grpc_codec;
/// Etcd keypath helpers.
pub mod keypath;
/// Lease model and checks.
pub mod lease;
/// Structured logging initialization and runtime level updates.
pub mod logging;
/// Keyspace-group manager and routing/state transitions.
pub mod manager;
/// Prometheus metrics registry and helpers.
pub mod metrics;
/// Timestamp oracle logic.
pub mod oracle;
/// Persistence abstractions and in-memory store.
pub mod persistence;
/// Background runtime loops (watch/election/cleanup).
pub mod runtime;
/// Hot-reload runtime configuration model.
pub mod runtime_config;
/// Core service facade.
pub mod service;
/// Trace-context extraction and propagation helpers.
pub(crate) mod trace_context;

pub use admin::{AdminConfigState, AdminGrpcService};
pub use allocator::{AllocatorConfig, GroupAllocator};
pub use error::{GrpcCode, GrpcStatus, ServiceError};
pub use etcd_store::EtcdTimestampStore;
pub use forwarding::LegacyForwarder;
/// Bench helper that exercises legacy forwarding merged-count/split-response hot paths.
pub use forwarding::benchmark_forwarding_merge_and_split;
pub use grpc::{LegacyPdGrpcService, TsoGrpcService};
pub use logging::{init_runtime_logging, set_runtime_log_level};
pub use manager::KeyspaceGroupManager;
pub use persistence::{InMemoryEtcdStore, TimestampStore};
pub use runtime::{TsoRuntime, TsoRuntimeConfig};
pub use runtime_config::RuntimeConfigState;
pub use service::TsoService;
