nautilus_infrastructure/lib.rs
1// -------------------------------------------------------------------------------------------------
2// Copyright (C) 2015-2025 Posei Systems Pty Ltd. All rights reserved.
3// https://poseitrader.io
4//
5// Licensed under the GNU Lesser General Public License Version 3.0 (the "License");
6// You may not use this file except in compliance with the License.
7// You may obtain a copy of the License at https://www.gnu.org/licenses/lgpl-3.0.en.html
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14// -------------------------------------------------------------------------------------------------
15
16//! Database and messaging infrastructure for [PoseiTrader](http://poseitrader.io).
17//!
18//! The *infrastructure* crate provides backend database implementations and message bus adapters
19//! that enable PoseiTrader to scale from development to production deployments. This includes
20//! enterprise-grade data persistence and messaging capabilities:
21//!
22//! - **Redis integration**: Cache database and message bus implementations using Redis.
23//! - **PostgreSQL integration**: SQL-based cache database with comprehensive data models.
24//! - **Connection management**: Robust connection handling with retry logic and health monitoring.
25//! - **Serialization options**: Support for JSON and MessagePack encoding formats.
26//! - **Python bindings**: PyO3 integration for seamless Python interoperability.
27//!
28//! The crate supports multiple database backends through feature flags, allowing users to choose
29//! the appropriate infrastructure components for their specific deployment requirements and scale.
30//!
31//! # Platform
32//!
33//! [PoseiTrader](http://poseitrader.io) is an open-source, high-performance, production-grade
34//! algorithmic trading platform, providing quantitative traders with the ability to backtest
35//! portfolios of automated trading strategies on historical data with an event-driven engine,
36//! and also deploy those same strategies live, with no code changes.
37//!
38//! PoseiTrader's design, architecture, and implementation philosophy prioritizes software correctness and safety at the
39//! highest level, with the aim of supporting mission-critical, trading system backtesting and live deployment workloads.
40//!
41//! # Feature flags
42//!
43//! This crate provides feature flags to control source code inclusion during compilation,
44//! depending on the intended use case, i.e. whether to provide Python bindings
45//! for the [posei_trader](https://pypi.org/project/posei_trader) Python package,
46//! or as part of a Rust only build.
47//!
48//! - `python`: Enables Python bindings from [PyO3](https://pyo3.rs).
49//! - `redis`: Enables the Redis cache database and message bus backing implementations.
50//! - `sql`: Enables the SQL models and cache database.
51
52#![warn(rustc::all)]
53#![deny(unsafe_code)]
54#![deny(nonstandard_style)]
55#![deny(missing_debug_implementations)]
56#![deny(clippy::missing_errors_doc)]
57#![deny(clippy::missing_panics_doc)]
58#![deny(rustdoc::broken_intra_doc_links)]
59
60#[cfg(feature = "python")]
61pub mod python;
62
63#[cfg(feature = "redis")]
64pub mod redis;
65
66#[cfg(feature = "postgres")]
67pub mod sql;