Mando Workspace
Rust Cargo workspace powering the Alpiq BESS platform.
Workspace Structure
mando/
├── Cargo.toml # Workspace root
├── Cargo.lock
├── rust-toolchain.toml # Rust 1.88.0
├── rustfmt.toml
├── .gitlab-ci.yml # CI/CD pipeline
├── Dockerfile # Production image
├── container.*.Dockerfile # Build/base images (Linux + Windows)
│
├── mando-lib/ # Core library
├── mando-lib-macro/ # Procedural macros
├── mando-bess/ # REST API service
├── py-mando/ # Python bindings (PyO3)
│
├── assets/ # Test/demo data
├── doc/ # Logo, diagrams
├── docs/ # Arrow benchmarks, plans
├── lib/libduckdb/ # Bundled DuckDB 1.4.2 (Linux amd64)
├── scripts/ # Benchmarks, load tests, seed data
└── test/ # Integration tests
Crate Dependency Graph
graph LR MACRO["[[mando-lib-macro]]"] --> LIB["[[mando-lib]]"] LIB --> BESS["[[mando-bess]]"] LIB --> PY["[[py-mando]]"] SCRT["[[mando-scrt]]"] -.-> LIB
mando-scrt
Standalone binary (not workspace member yet). Uses PyO3
auto-initialize(embeds Python) vs py-mando’sextension-module(loaded by Python). See mando-scrt.
All crates share workspace-level dependencies defined in the root Cargo.toml.
Key Workspace Dependencies
Data & Analytics
| Crate | Version | Purpose |
|---|---|---|
| arrow | 56.2.0 | Columnar data (IPC/FFI) |
| polars | 0.49.1 | Lazy DataFrames, JSON, Parquet, IPC |
| apache-avro | 0.17.0 | Avro serialization |
Databases
| Crate | Version | Purpose |
|---|---|---|
| rusqlite | bundled | SQLite with r2d2 pooling |
| deadpool-postgres / tokio-postgres | — | PostgreSQL async |
| duckdb | 1.4.2 | DuckDB with Arrow appender |
| refinery | — | PostgreSQL migrations |
Web & API
| Crate | Version | Purpose |
|---|---|---|
| axum | 0.8.7 | Async web framework |
| reqwest | 0.12.24 | HTTP client |
| cynic | 3.12.0 | GraphQL client codegen |
| utoipa / utoipa-scalar | — | OpenAPI docs |
Python Integration
| Crate | Version | Purpose |
|---|---|---|
| pyo3 | 0.25.1 | Rust ↔ Python FFI |
| pyo3-polars | 0.22.0 | Polars DataFrame bridge |
| pyo3-arrow | 0.11.0 | Arrow bridge |
| maturin | 1.9.2 | Build tool |
Observability
| Crate | Version | Purpose |
|---|---|---|
| opentelemetry | 0.30.0 | OTLP exporter (gRPC/tonic) |
| tracing | 0.1.43 | Structured logging |
| axum-otel-metrics | 0.12.0 | HTTP metrics |
Auth & Security
| Crate | Version | Purpose |
|---|---|---|
| jsonwebtoken | 9.3.1 | JWT (RS256) |
| rustls | 0.23.35 | TLS with native certs |
Feature Flags
The workspace uses feature flags to control compilation:
| Feature | Used By | Purpose |
|---|---|---|
app | mando-lib | Enables Axum + OpenTelemetry (for mando-bess) |
codegen | mando-lib | Code generation utilities |
python | mando-lib | PyO3 bindings (conditional #[pyclass]) |
workflow | mando-lib | Flow execution engine |
Architecture Patterns
Repository Pattern
Trait-based database abstraction with three backends:
- PostgreSQL — primary production store
- DuckDB — analytics/OLAP workloads
- SQLite — lightweight/local development
- Passthrough — optional caching layer
Service Layer
MandoService async trait provides uniform data access. Factory functions create backend-specific instances.
Flow Engine
Versioned workflows (v1, v2, v3) with strategy implementations for trading, auction, scheduling, etc.
Python Bridge
PyO3 extension module with abi3-py38 stable ABI. Uses pyo3-polars and pyo3-arrow for zero-copy data exchange.
Scripts
| Script | Purpose |
|---|---|
cpu_bench.sh | CPU profiling |
fargate_bench.sh | AWS Fargate benchmarks |
load_test.sh | HTTP load testing |
seed_data.py | Test data generation |
seed_scenarios.py | Scenario initialization |
stress_test.py | Stress testing |
scenario_stress_test.py | Scenario-level stress |
bench_chart.py | Benchmark visualization |