1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
//! Database pipeline for training artifacts.
//!
//! Bulk data movement between Rust structures and PostgreSQL, optimized for
//! the large-scale writes required during abstraction and blueprint training.
//!
//! ## Connectivity
//!
//! - [`db()`] — Establishes a database connection from `DB_URL`
//!
//! ## Serialization Traits
//!
//! - [`Schema`] — Table metadata and DDL generation
//! - [`Derive`] — INSERT statement generation for enumerable types
//! - [`Hydrate`] — Binary format decoding from rows
//! - [`Row`] — Binary row serialization for COPY protocol
//! - [`Streamable`] — Bulk data upload via COPY
//!
//! ## Core Types
//!
//! - [`Stage`] — Temporary staging table management
//! - [`Check`] — Schema validation and migration status
//!
//! ## Table Names
//!
//! Constants for all persistent entities: abstractions, blueprints,
//! metrics, hands, sessions, and more.
pub use *;
pub use *;
// schema module provides trait impls, no items to re-export
pub use *;
use Arc;
use Client;
/// Establishes a database connection.
///
/// Connects to PostgreSQL using the `DB_URL` environment variable.
/// Returns an `Arc<Client>` suitable for sharing across async tasks.
///
/// # Environment
///
/// Requires `DB_URL` to be set (e.g., `postgres://user:pass@host:port/db`).
///
/// # Panics
///
/// Panics if `DB_URL` is not set or if connection fails.
pub async
/// PostgreSQL error type alias.
pub type PgErr = Error;
/// Table for abstraction bucket definitions.
pub const ABSTRACTION: &str = "abstraction";
/// Table for game actions (bets, raises, folds, etc.).
pub const ACTIONS: &str = "actions";
/// Table for MCCFR blueprint strategies (policy + regret).
pub const BLUEPRINT: &str = "blueprint";
/// Table for training epoch metadata and progress.
pub const EPOCH: &str = "epoch";
/// Table for completed poker hands.
pub const HANDS: &str = "hands";
/// Table for isomorphism → abstraction mappings.
pub const ISOMORPHISM: &str = "isomorphism";
/// Table for pairwise abstraction distances.
pub const METRIC: &str = "metric";
/// Table for player participation in hands.
pub const PLAYERS: &str = "players";
/// Table for active game rooms.
pub const ROOMS: &str = "rooms";
/// Table for user authentication sessions.
pub const SESSIONS: &str = "sessions";
/// Table for staging data during bulk operations.
pub const STAGING: &str = "staging";
/// Table for street-specific metadata.
pub const STREET: &str = "street";
/// Table for abstraction transition probabilities.
pub const TRANSITIONS: &str = "transitions";
/// Table for registered user accounts.
pub const USERS: &str = "users";