signet_cold_sql/lib.rs
1//! SQL backend for cold storage.
2//!
3//! This crate provides SQL-based implementations of the [`ColdStorage`] trait
4//! for storing historical blockchain data in relational databases. All data is
5//! stored in fully decomposed SQL columns for rich queryability.
6//!
7//! # Supported Databases
8//!
9//! - **PostgreSQL** (feature `postgres`): Production-ready backend using
10//! connection pooling.
11//! - **SQLite** (feature `sqlite`): Lightweight backend for testing and
12//! single-binary deployments.
13//!
14//! # Feature Flags
15//!
16//! - **`postgres`**: Enables the PostgreSQL backend.
17//! - **`sqlite`**: Enables the SQLite backend.
18//! - **`test-utils`**: Enables both backends and propagates
19//! `signet-cold/test-utils` for conformance testing.
20//!
21//! [`ColdStorage`]: signet_cold::ColdStorage
22
23#![warn(
24 missing_copy_implementations,
25 missing_debug_implementations,
26 missing_docs,
27 unreachable_pub,
28 clippy::missing_const_for_fn,
29 rustdoc::all
30)]
31#![cfg_attr(not(test), warn(unused_crate_dependencies))]
32#![deny(unused_must_use, rust_2018_idioms)]
33#![cfg_attr(docsrs, feature(doc_cfg))]
34
35mod error;
36pub use error::SqlColdError;
37
38#[cfg(any(feature = "sqlite", feature = "postgres"))]
39mod columns;
40#[cfg(any(feature = "sqlite", feature = "postgres"))]
41mod convert;
42
43#[cfg(any(feature = "sqlite", feature = "postgres"))]
44mod backend;
45#[cfg(any(feature = "sqlite", feature = "postgres"))]
46pub use backend::SqlColdBackend;
47
48/// Backward-compatible alias for [`SqlColdBackend`] when using SQLite.
49#[cfg(feature = "sqlite")]
50pub type SqliteColdBackend = SqlColdBackend;
51
52/// Backward-compatible alias for [`SqlColdBackend`] when using PostgreSQL.
53#[cfg(feature = "postgres")]
54pub type PostgresColdBackend = SqlColdBackend;