This commit is contained in:
2026-07-23 16:37:12 +02:00
parent 99c345f2f2
commit 0da75c1311
2159 changed files with 230833 additions and 0 deletions

View File

@@ -0,0 +1,118 @@
// file: kb_store_pg/src/lib.rs
// version: 15
//! PostgreSQL storage implementation boundary.
#![warn(missing_docs)]
#![deny(unreachable_pub)]
#![forbid(unsafe_code)]
mod constants;
mod migrations;
mod pg_store;
mod queries;
mod replay_candidates;
mod repositories;
#[cfg(test)]
mod test_serial;
/// Canonical tracing target for this crate.
pub(crate) use crate::constants::TRACING_TARGET;
/// Allowed Solana table domains encoded in table names.
pub use crate::migrations::ALLOWED_SOLANA_TABLE_DOMAINS;
/// Core account key table name.
pub use crate::migrations::CORE_ACCOUNT_KEYS_TABLE_NAME;
/// Core balance change table name.
pub use crate::migrations::CORE_BALANCE_CHANGES_TABLE_NAME;
/// Core inner instruction table name.
pub use crate::migrations::CORE_INNER_INSTRUCTIONS_TABLE_NAME;
/// Core instruction table name.
pub use crate::migrations::CORE_INSTRUCTIONS_TABLE_NAME;
/// Core log table name.
pub use crate::migrations::CORE_LOGS_TABLE_NAME;
/// Core Solana table names introduced by `0.2.4`.
pub use crate::migrations::CORE_STORE_TABLE_NAMES;
/// Core transaction table name.
pub use crate::migrations::CORE_TRANSACTIONS_TABLE_NAME;
/// Machine-readable decoder coverage declaration table name.
pub use crate::migrations::DECODE_COVERAGE_DECLARATIONS_TABLE_NAME;
/// Observed decoder coverage classification table name.
pub use crate::migrations::DECODE_COVERAGE_OBSERVATIONS_TABLE_NAME;
/// Versioned decoded event table name.
pub use crate::migrations::DECODE_EVENTS_TABLE_NAME;
/// Decode and materialization table names introduced by `0.4.0`.
pub use crate::migrations::DECODE_STORE_TABLE_NAMES;
/// Default PostgreSQL schema policy.
pub use crate::migrations::DEFAULT_SCHEMA_POLICY;
/// Versioned materialized output table name.
pub use crate::migrations::MATERIALIZED_EVENTS_TABLE_NAME;
/// PostgreSQL migration strategy used by this crate.
pub use crate::migrations::MIGRATION_STRATEGY;
/// Migration table name used by sqlx when migrations are enabled later.
pub use crate::migrations::MIGRATION_TABLE_NAME;
/// Processing ledger table name.
pub use crate::migrations::PROCESSING_LEDGER_TABLE_NAME;
/// Table diagnostic metadata.
pub use crate::migrations::PostgresTableDiagnosticSpec;
/// Canonical transaction acquisition table names active since `0.3.1`.
pub use crate::migrations::RAW_STORE_TABLE_NAMES;
/// Canonical raw transaction table name.
pub use crate::migrations::RAW_TRANSACTIONS_TABLE_NAME;
/// Solana application table prefix.
pub use crate::migrations::SOLANA_TABLE_PREFIX;
/// Advisory lock id used while initializing store schemas.
pub use crate::migrations::STORE_SCHEMA_ADVISORY_LOCK_ID;
/// Transaction acquisition observation table name.
pub use crate::migrations::TRANSACTION_OBSERVATIONS_TABLE_NAME;
/// Core store SQL statements applied by the idempotent initializer.
pub use crate::migrations::core_store_schema_statements;
/// Core table diagnostic specs.
pub use crate::migrations::core_store_table_diagnostic_specs;
/// Decode and materialization SQL statements applied by the idempotent initializer.
pub use crate::migrations::decode_store_schema_statements;
/// Decode and materialization table diagnostic specs.
pub use crate::migrations::decode_store_table_diagnostic_specs;
/// Returns true when a Solana table name follows the canonical prefix and domain rules.
pub use crate::migrations::is_valid_solana_table_name;
/// Canonical transaction acquisition SQL statements applied by the initializer.
pub use crate::migrations::raw_store_schema_statements;
/// Canonical transaction acquisition diagnostic specs.
pub use crate::migrations::raw_store_table_diagnostic_specs;
/// Validates core store table names.
pub use crate::migrations::validate_core_store_table_names;
/// Validates decode and materialization store table names.
pub use crate::migrations::validate_decode_store_table_names;
/// Validates canonical transaction acquisition table names.
pub use crate::migrations::validate_raw_store_table_names;
/// Validates a canonical Solana table name.
pub use crate::migrations::validate_solana_table_name;
/// PostgreSQL diagnostic snapshot.
pub use crate::pg_store::PostgresBackendDiagnostics;
/// Minimal PostgreSQL store handle.
pub use crate::pg_store::PostgresStore;
/// PostgreSQL store connection options.
pub use crate::pg_store::PostgresStoreOptions;
/// PostgreSQL table diagnostic snapshot.
pub use crate::pg_store::PostgresTableDiagnostics;
/// PostgreSQL table statistics snapshot.
pub use crate::pg_store::PostgresTableStatistics;
/// Returns a DSN masked for logs and UI diagnostics.
pub use crate::pg_store::mask_postgres_dsn;
/// Maximum number of rows returned by one replay candidate query.
pub use crate::replay_candidates::MAX_REPLAY_CANDIDATE_ROWS;
/// Bounded read-only filter for core entity summaries.
pub use crate::replay_candidates::PostgresReplayEntityFilter;
/// Core entity kind used while filtering replay candidates.
pub use crate::replay_candidates::PostgresReplayEntityKind;
/// Aggregated mint, owner or account-key occurrences from core tables.
pub use crate::replay_candidates::PostgresReplayEntitySummary;
/// Bounded read-only filter for program summaries.
pub use crate::replay_candidates::PostgresReplayProgramFilter;
/// Program occurrence scope used while filtering replay candidates.
pub use crate::replay_candidates::PostgresReplayProgramScope;
/// Aggregated program occurrences across outer, inner and linked logs.
pub use crate::replay_candidates::PostgresReplayProgramSummary;
/// One raw transaction candidate enriched with core and ledger diagnostics.
pub use crate::replay_candidates::PostgresReplayTransactionCandidate;
/// Bounded read-only filter for transaction replay candidates.
pub use crate::replay_candidates::PostgresReplayTransactionFilter;