v0.1.0-pre.011
This commit is contained in:
@@ -45,7 +45,7 @@ kb-core
|
||||
kb-lib ← kb-store
|
||||
```
|
||||
|
||||
`CoreInstructionReplayInput` et sa version de contrat appartiennent à `kb-lib`, car ils sont partagés avec les décodeurs. `kb-store` les consomme et les réexporte. `kb-lib` ne dépend jamais de `kb-store`.
|
||||
`MdCoreInstructionReplayInput` et sa version de contrat appartiennent à `kb-lib`, car ils sont partagés avec les décodeurs. `kb-store` les consomme et les réexporte. `kb-lib` ne dépend jamais de `kb-store`.
|
||||
|
||||
`kb-store` ne dépend pas de `kb-config`. L’application résout sa configuration, puis construit explicitement `PostgresStoreOptions`. Cette séparation évite de coupler la persistance à la forme évolutive des profils.
|
||||
|
||||
|
||||
@@ -764,7 +764,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn replay_input_rejects_empty_key() {
|
||||
let result = crate::CoreInstructionReplayInput::new(
|
||||
let result = crate::MdCoreInstructionReplayInput::new(
|
||||
" ",
|
||||
"abc",
|
||||
1,
|
||||
@@ -786,7 +786,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn replay_input_accepts_ordered_outer_instruction_array() {
|
||||
let result = crate::CoreInstructionReplayInput::new(
|
||||
let result = crate::MdCoreInstructionReplayInput::new(
|
||||
"abc:2",
|
||||
"abc",
|
||||
1,
|
||||
@@ -831,7 +831,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn replay_input_rejects_non_array_outer_instruction_context() {
|
||||
let result = crate::CoreInstructionReplayInput::new(
|
||||
let result = crate::MdCoreInstructionReplayInput::new(
|
||||
"abc:0",
|
||||
"abc",
|
||||
1,
|
||||
|
||||
@@ -54,7 +54,7 @@ pub struct DecodedEventInsert {
|
||||
impl DecodedEventInsert {
|
||||
/// Builds a decoded event insert contract from the shared decoded model.
|
||||
pub fn from_model(
|
||||
event: &kb_lib::DecodedProtocolEvent,
|
||||
event: &kb_lib::MdDecodedProtocolEvent,
|
||||
payload_json: serde_json::Value,
|
||||
) -> kb_core::Result<Self> {
|
||||
if event.signature.0.trim().is_empty() {
|
||||
|
||||
@@ -107,7 +107,7 @@ impl RawTransactionInsert {
|
||||
}
|
||||
|
||||
/// Builds a storage insert from the source-independent canonical transaction model.
|
||||
pub fn from_canonical(transaction: &kb_lib::CanonicalTransaction) -> kb_core::Result<Self> {
|
||||
pub fn from_canonical(transaction: &kb_lib::MdCanonicalTransaction) -> kb_core::Result<Self> {
|
||||
let canonical_json_result = transaction.to_canonical_json();
|
||||
let canonical_json = match canonical_json_result {
|
||||
std::result::Result::Ok(value) => value,
|
||||
@@ -498,18 +498,18 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
}
|
||||
|
||||
fn canonical_transaction_fixture() -> kb_lib::CanonicalTransaction {
|
||||
return kb_lib::CanonicalTransaction {
|
||||
format_version: kb_lib::CANONICAL_TRANSACTION_FORMAT_VERSION,
|
||||
fn canonical_transaction_fixture() -> kb_lib::MdCanonicalTransaction {
|
||||
return kb_lib::MdCanonicalTransaction {
|
||||
format_version: kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION,
|
||||
primary_signature: "2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string(),
|
||||
slot: 9,
|
||||
block_time: std::option::Option::None,
|
||||
version: kb_lib::CanonicalTransactionVersion::Legacy,
|
||||
version: kb_lib::MdCanonicalTransactionVersion::Legacy,
|
||||
signatures: std::vec![
|
||||
"2Ana1pUpv2ZbMVkwF5FXapYeBEjdxDatLn7nvJkhgTSXbs59SyZSx866bXirPgj8QQVB57uxHJBG1YFvkRbFj4T".to_string(),
|
||||
],
|
||||
message: kb_lib::CanonicalTransactionMessage {
|
||||
header: kb_lib::CanonicalMessageHeader {
|
||||
message: kb_lib::MdCanonicalTransactionMessage {
|
||||
header: kb_lib::MdCanonicalMessageHeader {
|
||||
num_required_signatures: 1,
|
||||
num_readonly_signed_accounts: 0,
|
||||
num_readonly_unsigned_accounts: 1,
|
||||
@@ -519,17 +519,17 @@ mod tests {
|
||||
"ComputeBudget111111111111111111111111111111".to_string(),
|
||||
],
|
||||
recent_blockhash: "11111111111111111111111111111111".to_string(),
|
||||
instructions: std::vec![kb_lib::CanonicalCompiledInstruction {
|
||||
instructions: std::vec![kb_lib::MdCanonicalCompiledInstruction {
|
||||
program_id_index: 1,
|
||||
account_indexes: std::vec![0],
|
||||
data_base64: "AQ==".to_string(),
|
||||
stack_height: std::option::Option::Some(1),
|
||||
}],
|
||||
address_table_lookups: std::vec::Vec::new(),
|
||||
loaded_addresses: kb_lib::CanonicalLoadedAddresses::default(),
|
||||
loaded_addresses: kb_lib::MdCanonicalLoadedAddresses::default(),
|
||||
},
|
||||
metadata: std::option::Option::Some(kb_lib::CanonicalTransactionMetadata {
|
||||
status: kb_lib::CanonicalTransactionStatus::Success,
|
||||
metadata: std::option::Option::Some(kb_lib::MdCanonicalTransactionMetadata {
|
||||
status: kb_lib::MdCanonicalTransactionStatus::Success,
|
||||
error: std::option::Option::None,
|
||||
fee: 5000,
|
||||
pre_balances: std::vec![10000, 1],
|
||||
@@ -556,7 +556,10 @@ mod tests {
|
||||
};
|
||||
assert_eq!(insert.signature, transaction.primary_signature);
|
||||
assert_eq!(insert.slot, transaction.slot);
|
||||
assert_eq!(insert.canonical_format_version, kb_lib::CANONICAL_TRANSACTION_FORMAT_VERSION);
|
||||
assert_eq!(
|
||||
insert.canonical_format_version,
|
||||
kb_lib::MD_CANONICAL_TRANSACTION_FORMAT_VERSION
|
||||
);
|
||||
assert_eq!(insert.canonical_json_hash.as_deref().map(|value| return value.len()), Some(64));
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ pub trait RawTransactionStore {
|
||||
/// Returns true when a canonical transaction signature is already stored.
|
||||
async fn has_raw_transaction_signature(
|
||||
&self,
|
||||
signature: &kb_lib::Signature,
|
||||
signature: &kb_lib::MdSignature,
|
||||
) -> kb_core::Result<bool>;
|
||||
|
||||
/// Returns true when a transaction observation key is already stored.
|
||||
@@ -99,7 +99,7 @@ pub trait CoreTransactionStore {
|
||||
&self,
|
||||
filter: &crate::CoreInstructionReplayFilter,
|
||||
page_request: &crate::PageRequest,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>>;
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>>;
|
||||
|
||||
/// Updates one normalized core instruction lifecycle state.
|
||||
async fn mark_core_instruction_lifecycle(
|
||||
@@ -144,7 +144,7 @@ pub trait DecodePipelineStore {
|
||||
async fn list_decode_inputs(
|
||||
&self,
|
||||
filter: &crate::DecodeSelectionFilter,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>>;
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>>;
|
||||
|
||||
/// Returns true when the same processor version already succeeded for the same input hash.
|
||||
async fn is_decode_current(
|
||||
@@ -199,7 +199,7 @@ pub trait ProgramObservationStore {
|
||||
/// Stores program observations.
|
||||
async fn store_observations(
|
||||
&self,
|
||||
observations: &[kb_lib::ProgramObservation],
|
||||
observations: &[kb_lib::MdProgramObservation],
|
||||
) -> kb_core::Result<crate::InsertOutcome>;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,247 +11,247 @@ mod contracts;
|
||||
mod postgres;
|
||||
|
||||
/// Canonical tracing target for storage operations.
|
||||
pub(crate) use crate::constants::TRACING_TARGET;
|
||||
pub(crate) use self::constants::TRACING_TARGET;
|
||||
|
||||
/// Core account key insert contract.
|
||||
pub use crate::contracts::CoreAccountKeyInsert;
|
||||
pub use self::contracts::CoreAccountKeyInsert;
|
||||
/// Core account key SQL-like row contract.
|
||||
pub use crate::contracts::CoreAccountKeyRow;
|
||||
pub use self::contracts::CoreAccountKeyRow;
|
||||
/// Core account key source category.
|
||||
pub use crate::contracts::CoreAccountKeySource;
|
||||
pub use self::contracts::CoreAccountKeySource;
|
||||
/// Core balance change insert contract.
|
||||
pub use crate::contracts::CoreBalanceChangeInsert;
|
||||
pub use self::contracts::CoreBalanceChangeInsert;
|
||||
/// Core balance change kind.
|
||||
pub use crate::contracts::CoreBalanceChangeKind;
|
||||
pub use self::contracts::CoreBalanceChangeKind;
|
||||
/// Core balance change SQL-like row contract.
|
||||
pub use crate::contracts::CoreBalanceChangeRow;
|
||||
pub use self::contracts::CoreBalanceChangeRow;
|
||||
/// Complete normalized core extraction write bundle.
|
||||
pub use crate::contracts::CoreExtractionBundle;
|
||||
pub use self::contracts::CoreExtractionBundle;
|
||||
/// Failure details persisted for one canonical to core extraction attempt.
|
||||
pub use crate::contracts::CoreExtractionFailure;
|
||||
pub use self::contracts::CoreExtractionFailure;
|
||||
/// Bounded canonical transaction selection filter for core extraction.
|
||||
pub use crate::contracts::CoreExtractionSelectionFilter;
|
||||
pub use self::contracts::CoreExtractionSelectionFilter;
|
||||
/// Canonical transaction to core extraction storage behavior.
|
||||
pub use crate::contracts::CoreExtractionStore;
|
||||
pub use self::contracts::CoreExtractionStore;
|
||||
/// Core inner instruction insert contract.
|
||||
pub use crate::contracts::CoreInnerInstructionInsert;
|
||||
pub use self::contracts::CoreInnerInstructionInsert;
|
||||
/// Core inner instruction SQL-like row contract.
|
||||
pub use crate::contracts::CoreInnerInstructionRow;
|
||||
pub use self::contracts::CoreInnerInstructionRow;
|
||||
/// Core instruction insert contract.
|
||||
pub use crate::contracts::CoreInstructionInsert;
|
||||
pub use self::contracts::CoreInstructionInsert;
|
||||
/// Core instruction lifecycle mark request.
|
||||
pub use crate::contracts::CoreInstructionLifecycleMark;
|
||||
pub use self::contracts::CoreInstructionLifecycleMark;
|
||||
/// Core instruction processing state.
|
||||
pub use crate::contracts::CoreInstructionProcessingState;
|
||||
pub use self::contracts::CoreInstructionProcessingState;
|
||||
/// Core instruction replay filter contract.
|
||||
pub use crate::contracts::CoreInstructionReplayFilter;
|
||||
pub use self::contracts::CoreInstructionReplayFilter;
|
||||
/// Core instruction SQL-like row contract.
|
||||
pub use crate::contracts::CoreInstructionRow;
|
||||
pub use self::contracts::CoreInstructionRow;
|
||||
/// Core log insert contract.
|
||||
pub use crate::contracts::CoreLogInsert;
|
||||
pub use self::contracts::CoreLogInsert;
|
||||
/// Core log SQL-like row contract.
|
||||
pub use crate::contracts::CoreLogRow;
|
||||
pub use self::contracts::CoreLogRow;
|
||||
/// Core transaction insert contract.
|
||||
pub use crate::contracts::CoreTransactionInsert;
|
||||
pub use self::contracts::CoreTransactionInsert;
|
||||
/// Core transaction SQL-like row contract.
|
||||
pub use crate::contracts::CoreTransactionRow;
|
||||
pub use self::contracts::CoreTransactionRow;
|
||||
/// Core Solana storage behavior.
|
||||
pub use crate::contracts::CoreTransactionStore;
|
||||
pub use self::contracts::CoreTransactionStore;
|
||||
/// Default repository page size.
|
||||
pub use crate::contracts::DEFAULT_PAGE_SIZE;
|
||||
pub use self::contracts::DEFAULT_PAGE_SIZE;
|
||||
/// One machine-readable decoder coverage declaration row.
|
||||
pub use crate::contracts::DecodeCoverageDeclarationInsert;
|
||||
pub use self::contracts::DecodeCoverageDeclarationInsert;
|
||||
/// One observed coverage classification row owned by one decode attempt.
|
||||
pub use crate::contracts::DecodeCoverageObservationInsert;
|
||||
pub use self::contracts::DecodeCoverageObservationInsert;
|
||||
/// One row of aggregated decoder coverage diagnostics.
|
||||
pub use crate::contracts::DecodeCoverageSummaryRow;
|
||||
pub use self::contracts::DecodeCoverageSummaryRow;
|
||||
/// Failed decode attempt persisted in the common ledger.
|
||||
pub use crate::contracts::DecodeFailure;
|
||||
pub use self::contracts::DecodeFailure;
|
||||
/// One processor-owned decoded observation row.
|
||||
pub use crate::contracts::DecodeObservationInsert;
|
||||
pub use self::contracts::DecodeObservationInsert;
|
||||
/// Atomic persistence bundle for one decoder and one contextual input.
|
||||
pub use crate::contracts::DecodePersistenceBundle;
|
||||
pub use self::contracts::DecodePersistenceBundle;
|
||||
/// Contextual instruction decode and materialization storage behavior.
|
||||
pub use crate::contracts::DecodePipelineStore;
|
||||
pub use self::contracts::DecodePipelineStore;
|
||||
/// Bounded contextual instruction selection filter for decode campaigns.
|
||||
pub use crate::contracts::DecodeSelectionFilter;
|
||||
pub use self::contracts::DecodeSelectionFilter;
|
||||
/// Decoded event insert contract.
|
||||
pub use crate::contracts::DecodedEventInsert;
|
||||
pub use self::contracts::DecodedEventInsert;
|
||||
/// Decoded event SQL-like row contract.
|
||||
pub use crate::contracts::DecodedEventRow;
|
||||
pub use self::contracts::DecodedEventRow;
|
||||
/// Decoded event storage behavior.
|
||||
pub use crate::contracts::DecodedEventStore;
|
||||
pub use self::contracts::DecodedEventStore;
|
||||
/// Insert or upsert result contract returned by repositories.
|
||||
pub use crate::contracts::InsertOutcome;
|
||||
pub use self::contracts::InsertOutcome;
|
||||
/// Maximum number of materialized rows returned by one bounded query.
|
||||
pub use crate::contracts::MAX_MATERIALIZED_EVENT_QUERY_ROWS;
|
||||
pub use self::contracts::MAX_MATERIALIZED_EVENT_QUERY_ROWS;
|
||||
/// Maximum repository page size.
|
||||
pub use crate::contracts::MAX_PAGE_SIZE;
|
||||
pub use self::contracts::MAX_PAGE_SIZE;
|
||||
/// Atomic persistence bundle for one materializer and one decoded observation.
|
||||
pub use crate::contracts::MaterializationPersistenceBundle;
|
||||
pub use self::contracts::MaterializationPersistenceBundle;
|
||||
/// Bounded read-only materialized event selection.
|
||||
pub use crate::contracts::MaterializedEventFilter;
|
||||
pub use self::contracts::MaterializedEventFilter;
|
||||
/// Materialized event insert contract.
|
||||
pub use crate::contracts::MaterializedEventInsert;
|
||||
pub use self::contracts::MaterializedEventInsert;
|
||||
/// One materialized output returned by a bounded query.
|
||||
pub use crate::contracts::MaterializedEventQueryRow;
|
||||
pub use self::contracts::MaterializedEventQueryRow;
|
||||
/// Materialized event SQL-like row contract.
|
||||
pub use crate::contracts::MaterializedEventRow;
|
||||
pub use self::contracts::MaterializedEventRow;
|
||||
/// Materialized event storage behavior.
|
||||
pub use crate::contracts::MaterializedEventStore;
|
||||
pub use self::contracts::MaterializedEventStore;
|
||||
/// One processor-owned materialized output row.
|
||||
pub use crate::contracts::MaterializedOutputInsert;
|
||||
pub use self::contracts::MaterializedOutputInsert;
|
||||
/// Page request contract for repository list operations.
|
||||
pub use crate::contracts::PageRequest;
|
||||
pub use self::contracts::PageRequest;
|
||||
/// Stable processing ledger identity.
|
||||
pub use crate::contracts::ProcessingLedgerIdentity;
|
||||
pub use self::contracts::ProcessingLedgerIdentity;
|
||||
/// Processing ledger mark request contract.
|
||||
pub use crate::contracts::ProcessingLedgerMark;
|
||||
pub use self::contracts::ProcessingLedgerMark;
|
||||
/// Processing ledger SQL-like row contract.
|
||||
pub use crate::contracts::ProcessingLedgerRow;
|
||||
pub use self::contracts::ProcessingLedgerRow;
|
||||
/// Stable processing ledger status.
|
||||
pub use crate::contracts::ProcessingLedgerStatus;
|
||||
pub use self::contracts::ProcessingLedgerStatus;
|
||||
/// Processing ledger storage behavior.
|
||||
pub use crate::contracts::ProcessingLedgerStore;
|
||||
pub use self::contracts::ProcessingLedgerStore;
|
||||
/// Program observation storage behavior.
|
||||
pub use crate::contracts::ProgramObservationStore;
|
||||
pub use self::contracts::ProgramObservationStore;
|
||||
/// Raw payload lifecycle mark request.
|
||||
pub use crate::contracts::RawPayloadLifecycleMark;
|
||||
pub use self::contracts::RawPayloadLifecycleMark;
|
||||
/// Raw payload processing state.
|
||||
pub use crate::contracts::RawPayloadProcessingState;
|
||||
pub use self::contracts::RawPayloadProcessingState;
|
||||
/// Raw payload retention state.
|
||||
pub use crate::contracts::RawPayloadRetentionState;
|
||||
pub use self::contracts::RawPayloadRetentionState;
|
||||
/// Canonical raw Solana transaction insert contract.
|
||||
pub use crate::contracts::RawTransactionInsert;
|
||||
pub use self::contracts::RawTransactionInsert;
|
||||
/// Canonical raw Solana transaction SQL-like row contract.
|
||||
pub use crate::contracts::RawTransactionRow;
|
||||
pub use self::contracts::RawTransactionRow;
|
||||
/// Raw transaction storage behavior.
|
||||
pub use crate::contracts::RawTransactionStore;
|
||||
pub use self::contracts::RawTransactionStore;
|
||||
/// Sort direction for repository list operations.
|
||||
pub use crate::contracts::SortDirection;
|
||||
pub use self::contracts::SortDirection;
|
||||
/// Store backend diagnostic contract.
|
||||
pub use crate::contracts::StoreBackendDescriptor;
|
||||
pub use self::contracts::StoreBackendDescriptor;
|
||||
/// Store backend kind contract.
|
||||
pub use crate::contracts::StoreBackendKind;
|
||||
pub use self::contracts::StoreBackendKind;
|
||||
/// Store backend health snapshot.
|
||||
pub use crate::contracts::StoreHealthSnapshot;
|
||||
pub use self::contracts::StoreHealthSnapshot;
|
||||
/// Store backend health status.
|
||||
pub use crate::contracts::StoreHealthStatus;
|
||||
pub use self::contracts::StoreHealthStatus;
|
||||
/// Store health storage behavior.
|
||||
pub use crate::contracts::StoreHealthStore;
|
||||
pub use self::contracts::StoreHealthStore;
|
||||
/// Store migration diagnostic snapshot contract.
|
||||
pub use crate::contracts::StoreMigrationSnapshot;
|
||||
pub use self::contracts::StoreMigrationSnapshot;
|
||||
/// Store migration status contract.
|
||||
pub use crate::contracts::StoreMigrationStatus;
|
||||
pub use self::contracts::StoreMigrationStatus;
|
||||
/// Transaction acquisition observation insert contract.
|
||||
pub use crate::contracts::TransactionObservationInsert;
|
||||
pub use self::contracts::TransactionObservationInsert;
|
||||
/// Transaction acquisition observation origin.
|
||||
pub use crate::contracts::TransactionObservationOrigin;
|
||||
pub use self::contracts::TransactionObservationOrigin;
|
||||
/// Transaction acquisition observation SQL-like row contract.
|
||||
pub use crate::contracts::TransactionObservationRow;
|
||||
pub use self::contracts::TransactionObservationRow;
|
||||
/// Transaction acquisition observation status.
|
||||
pub use crate::contracts::TransactionObservationStatus;
|
||||
pub use self::contracts::TransactionObservationStatus;
|
||||
/// Storage error helper functions.
|
||||
pub use crate::contracts::storage_contract_error;
|
||||
pub use self::contracts::storage_contract_error;
|
||||
/// Allowed Solana table domains encoded in table names.
|
||||
pub use crate::postgres::ALLOWED_SOLANA_TABLE_DOMAINS;
|
||||
pub use self::postgres::ALLOWED_SOLANA_TABLE_DOMAINS;
|
||||
/// Core account key table name.
|
||||
pub use crate::postgres::CORE_ACCOUNT_KEYS_TABLE_NAME;
|
||||
pub use self::postgres::CORE_ACCOUNT_KEYS_TABLE_NAME;
|
||||
/// Core balance change table name.
|
||||
pub use crate::postgres::CORE_BALANCE_CHANGES_TABLE_NAME;
|
||||
pub use self::postgres::CORE_BALANCE_CHANGES_TABLE_NAME;
|
||||
/// Core inner instruction table name.
|
||||
pub use crate::postgres::CORE_INNER_INSTRUCTIONS_TABLE_NAME;
|
||||
pub use self::postgres::CORE_INNER_INSTRUCTIONS_TABLE_NAME;
|
||||
/// Core instruction table name.
|
||||
pub use crate::postgres::CORE_INSTRUCTIONS_TABLE_NAME;
|
||||
pub use self::postgres::CORE_INSTRUCTIONS_TABLE_NAME;
|
||||
/// Core log table name.
|
||||
pub use crate::postgres::CORE_LOGS_TABLE_NAME;
|
||||
pub use self::postgres::CORE_LOGS_TABLE_NAME;
|
||||
/// Core Solana table names.
|
||||
pub use crate::postgres::CORE_STORE_TABLE_NAMES;
|
||||
pub use self::postgres::CORE_STORE_TABLE_NAMES;
|
||||
/// Core transaction table name.
|
||||
pub use crate::postgres::CORE_TRANSACTIONS_TABLE_NAME;
|
||||
pub use self::postgres::CORE_TRANSACTIONS_TABLE_NAME;
|
||||
/// Machine-readable decoder coverage declaration table name.
|
||||
pub use crate::postgres::DECODE_COVERAGE_DECLARATIONS_TABLE_NAME;
|
||||
pub use self::postgres::DECODE_COVERAGE_DECLARATIONS_TABLE_NAME;
|
||||
/// Observed decoder coverage classification table name.
|
||||
pub use crate::postgres::DECODE_COVERAGE_OBSERVATIONS_TABLE_NAME;
|
||||
pub use self::postgres::DECODE_COVERAGE_OBSERVATIONS_TABLE_NAME;
|
||||
/// Versioned decoded event table name.
|
||||
pub use crate::postgres::DECODE_EVENTS_TABLE_NAME;
|
||||
pub use self::postgres::DECODE_EVENTS_TABLE_NAME;
|
||||
/// Decode and materialization table names.
|
||||
pub use crate::postgres::DECODE_STORE_TABLE_NAMES;
|
||||
pub use self::postgres::DECODE_STORE_TABLE_NAMES;
|
||||
/// Default PostgreSQL schema policy.
|
||||
pub use crate::postgres::DEFAULT_SCHEMA_POLICY;
|
||||
pub use self::postgres::DEFAULT_SCHEMA_POLICY;
|
||||
/// Versioned materialized output table name.
|
||||
pub use crate::postgres::MATERIALIZED_EVENTS_TABLE_NAME;
|
||||
pub use self::postgres::MATERIALIZED_EVENTS_TABLE_NAME;
|
||||
/// Maximum number of rows returned by one replay candidate query.
|
||||
pub use crate::postgres::MAX_REPLAY_CANDIDATE_ROWS;
|
||||
pub use self::postgres::MAX_REPLAY_CANDIDATE_ROWS;
|
||||
/// PostgreSQL migration strategy used by this crate.
|
||||
pub use crate::postgres::MIGRATION_STRATEGY;
|
||||
pub use self::postgres::MIGRATION_STRATEGY;
|
||||
/// Migration table name used by sqlx.
|
||||
pub use crate::postgres::MIGRATION_TABLE_NAME;
|
||||
pub use self::postgres::MIGRATION_TABLE_NAME;
|
||||
/// Processing ledger table name.
|
||||
pub use crate::postgres::PROCESSING_LEDGER_TABLE_NAME;
|
||||
pub use self::postgres::PROCESSING_LEDGER_TABLE_NAME;
|
||||
/// PostgreSQL diagnostic snapshot.
|
||||
pub use crate::postgres::PostgresBackendDiagnostics;
|
||||
pub use self::postgres::PostgresBackendDiagnostics;
|
||||
/// Bounded read-only filter for core entity summaries.
|
||||
pub use crate::postgres::PostgresReplayEntityFilter;
|
||||
pub use self::postgres::PostgresReplayEntityFilter;
|
||||
/// Core entity kind used while filtering replay candidates.
|
||||
pub use crate::postgres::PostgresReplayEntityKind;
|
||||
pub use self::postgres::PostgresReplayEntityKind;
|
||||
/// Aggregated mint, owner or account-key occurrences from core tables.
|
||||
pub use crate::postgres::PostgresReplayEntitySummary;
|
||||
pub use self::postgres::PostgresReplayEntitySummary;
|
||||
/// Bounded read-only filter for program summaries.
|
||||
pub use crate::postgres::PostgresReplayProgramFilter;
|
||||
pub use self::postgres::PostgresReplayProgramFilter;
|
||||
/// Program occurrence scope used while filtering replay candidates.
|
||||
pub use crate::postgres::PostgresReplayProgramScope;
|
||||
pub use self::postgres::PostgresReplayProgramScope;
|
||||
/// Aggregated program occurrences across outer, inner and linked logs.
|
||||
pub use crate::postgres::PostgresReplayProgramSummary;
|
||||
pub use self::postgres::PostgresReplayProgramSummary;
|
||||
/// One raw transaction candidate enriched with core and ledger diagnostics.
|
||||
pub use crate::postgres::PostgresReplayTransactionCandidate;
|
||||
pub use self::postgres::PostgresReplayTransactionCandidate;
|
||||
/// Bounded read-only filter for transaction replay candidates.
|
||||
pub use crate::postgres::PostgresReplayTransactionFilter;
|
||||
pub use self::postgres::PostgresReplayTransactionFilter;
|
||||
/// PostgreSQL store handle.
|
||||
pub use crate::postgres::PostgresStore;
|
||||
pub use self::postgres::PostgresStore;
|
||||
/// PostgreSQL store connection options.
|
||||
pub use crate::postgres::PostgresStoreOptions;
|
||||
pub use self::postgres::PostgresStoreOptions;
|
||||
/// PostgreSQL diagnostic table specification.
|
||||
pub use crate::postgres::PostgresTableDiagnosticSpec;
|
||||
pub use self::postgres::PostgresTableDiagnosticSpec;
|
||||
/// PostgreSQL table diagnostic snapshot.
|
||||
pub use crate::postgres::PostgresTableDiagnostics;
|
||||
pub use self::postgres::PostgresTableDiagnostics;
|
||||
/// PostgreSQL table statistics snapshot.
|
||||
pub use crate::postgres::PostgresTableStatistics;
|
||||
pub use self::postgres::PostgresTableStatistics;
|
||||
/// Canonical transaction acquisition table names.
|
||||
pub use crate::postgres::RAW_STORE_TABLE_NAMES;
|
||||
pub use self::postgres::RAW_STORE_TABLE_NAMES;
|
||||
/// Canonical raw transaction table name.
|
||||
pub use crate::postgres::RAW_TRANSACTIONS_TABLE_NAME;
|
||||
pub use self::postgres::RAW_TRANSACTIONS_TABLE_NAME;
|
||||
/// Solana application table prefix.
|
||||
pub use crate::postgres::SOLANA_TABLE_PREFIX;
|
||||
pub use self::postgres::SOLANA_TABLE_PREFIX;
|
||||
/// Advisory lock id used while initializing store tables.
|
||||
pub use crate::postgres::STORE_SCHEMA_ADVISORY_LOCK_ID;
|
||||
pub use self::postgres::STORE_SCHEMA_ADVISORY_LOCK_ID;
|
||||
/// Transaction acquisition observation table name.
|
||||
pub use crate::postgres::TRANSACTION_OBSERVATIONS_TABLE_NAME;
|
||||
pub use self::postgres::TRANSACTION_OBSERVATIONS_TABLE_NAME;
|
||||
/// Core store SQL statements applied by the idempotent initializer.
|
||||
pub use crate::postgres::core_store_schema_statements;
|
||||
pub use self::postgres::core_store_schema_statements;
|
||||
/// Core table diagnostic specs.
|
||||
pub use crate::postgres::core_store_table_diagnostic_specs;
|
||||
pub use self::postgres::core_store_table_diagnostic_specs;
|
||||
/// Decode and materialization SQL statements applied by the idempotent initializer.
|
||||
pub use crate::postgres::decode_store_schema_statements;
|
||||
pub use self::postgres::decode_store_schema_statements;
|
||||
/// Decode and materialization table diagnostic specs.
|
||||
pub use crate::postgres::decode_store_table_diagnostic_specs;
|
||||
pub use self::postgres::decode_store_table_diagnostic_specs;
|
||||
/// Returns true when a Solana table name follows canonical rules.
|
||||
pub use crate::postgres::is_valid_solana_table_name;
|
||||
pub use self::postgres::is_valid_solana_table_name;
|
||||
/// Returns a DSN masked for logs and UI diagnostics.
|
||||
pub use crate::postgres::mask_postgres_dsn;
|
||||
pub use self::postgres::mask_postgres_dsn;
|
||||
/// Canonical transaction acquisition SQL statements.
|
||||
pub use crate::postgres::raw_store_schema_statements;
|
||||
pub use self::postgres::raw_store_schema_statements;
|
||||
/// Canonical transaction acquisition diagnostic specs.
|
||||
pub use crate::postgres::raw_store_table_diagnostic_specs;
|
||||
pub use self::postgres::raw_store_table_diagnostic_specs;
|
||||
/// Validates core store table names.
|
||||
pub use crate::postgres::validate_core_store_table_names;
|
||||
pub use self::postgres::validate_core_store_table_names;
|
||||
/// Validates decode and materialization store table names.
|
||||
pub use crate::postgres::validate_decode_store_table_names;
|
||||
pub use self::postgres::validate_decode_store_table_names;
|
||||
/// Validates canonical transaction acquisition table names.
|
||||
pub use crate::postgres::validate_raw_store_table_names;
|
||||
pub use self::postgres::validate_raw_store_table_names;
|
||||
/// Validates a canonical Solana table name.
|
||||
pub use crate::postgres::validate_solana_table_name;
|
||||
pub use self::postgres::validate_solana_table_name;
|
||||
/// Current normalized core replay input contract version.
|
||||
pub use kb_lib::CORE_REPLAY_INPUT_CONTRACT_VERSION;
|
||||
pub use kb_lib::MD_CORE_REPLAY_INPUT_CONTRACT_VERSION;
|
||||
/// Decoder replay input containing one instruction plus extracted transaction context.
|
||||
pub use kb_lib::CoreInstructionReplayInput;
|
||||
pub use kb_lib::MdCoreInstructionReplayInput;
|
||||
|
||||
@@ -372,7 +372,7 @@ pub(in crate::postgres) async fn list_core_instruction_replay_inputs(
|
||||
pool: &sqlx::PgPool,
|
||||
filter: &crate::CoreInstructionReplayFilter,
|
||||
page_request: &crate::PageRequest,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>> {
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>> {
|
||||
let instructions_result =
|
||||
crate::postgres::query::core_queries::list_core_instructions_for_replay(
|
||||
pool,
|
||||
@@ -402,7 +402,7 @@ pub(in crate::postgres) async fn list_core_instruction_replay_inputs(
|
||||
pub(in crate::postgres) async fn list_decode_replay_inputs(
|
||||
pool: &sqlx::PgPool,
|
||||
filter: &crate::DecodeSelectionFilter,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>> {
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>> {
|
||||
let min_slot_result =
|
||||
crate::postgres::query::core_queries::optional_sql_slot_from_u64(filter.min_slot);
|
||||
let min_slot = match min_slot_result {
|
||||
@@ -758,7 +758,7 @@ where
|
||||
pub(in crate::postgres) async fn load_replay_input_for_instruction(
|
||||
pool: &sqlx::PgPool,
|
||||
instruction: &crate::CoreInstructionRow,
|
||||
) -> kb_core::Result<crate::CoreInstructionReplayInput> {
|
||||
) -> kb_core::Result<crate::MdCoreInstructionReplayInput> {
|
||||
let transaction_context_result =
|
||||
sqlx::query_as::<sqlx::Postgres, (bool, std::option::Option<serde_json::Value>)>(
|
||||
"SELECT failed, err_json FROM kb_sol_core_transactions WHERE signature = $1 LIMIT 1",
|
||||
@@ -830,7 +830,7 @@ pub(in crate::postgres) async fn load_replay_input_for_instruction(
|
||||
std::result::Result::Ok(value) => value,
|
||||
std::result::Result::Err(error) => return std::result::Result::Err(error),
|
||||
};
|
||||
return crate::CoreInstructionReplayInput::new(
|
||||
return crate::MdCoreInstructionReplayInput::new(
|
||||
replay_input_key,
|
||||
instruction.signature.clone(),
|
||||
slot,
|
||||
|
||||
@@ -69,7 +69,7 @@ pub(in crate::postgres) async fn apply_decode_store_schema(
|
||||
pub(in crate::postgres) async fn list_decode_inputs(
|
||||
pool: &sqlx::PgPool,
|
||||
filter: &crate::DecodeSelectionFilter,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>> {
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>> {
|
||||
tracing::debug!(target: crate::TRACING_TARGET, action = "list_decode_inputs", signature_count = filter.signatures.len(), signature_sample = ?filter.signatures.iter().take(5).map(std::string::String::as_str).collect::<std::vec::Vec<_>>(), processing_states = ?filter.processing_states, min_slot = ?filter.min_slot, max_slot = ?filter.max_slot, program_ids = ?filter.program_ids, instruction_paths = ?filter.instruction_paths, limit = filter.limit, "query PostgreSQL contextual decode inputs");
|
||||
let result =
|
||||
crate::postgres::query::core_queries::list_decode_replay_inputs(pool, filter).await;
|
||||
|
||||
@@ -420,7 +420,7 @@ mod tests {
|
||||
assert_eq!(duplicate_outcome.skipped_count, 1);
|
||||
let has_result = crate::RawTransactionStore::has_raw_transaction_signature(
|
||||
&store,
|
||||
&kb_lib::Signature(signature.clone()),
|
||||
&kb_lib::MdSignature(signature.clone()),
|
||||
)
|
||||
.await;
|
||||
let has_signature = match has_result {
|
||||
|
||||
@@ -96,7 +96,7 @@ impl crate::CoreTransactionStore for crate::PostgresStore {
|
||||
&self,
|
||||
filter: &crate::CoreInstructionReplayFilter,
|
||||
page_request: &crate::PageRequest,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>> {
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>> {
|
||||
return crate::postgres::query::list_core_instruction_replay_inputs(
|
||||
self.pool(),
|
||||
filter,
|
||||
|
||||
@@ -12,7 +12,7 @@ impl crate::DecodePipelineStore for crate::PostgresStore {
|
||||
async fn list_decode_inputs(
|
||||
&self,
|
||||
filter: &crate::DecodeSelectionFilter,
|
||||
) -> kb_core::Result<std::vec::Vec<crate::CoreInstructionReplayInput>> {
|
||||
) -> kb_core::Result<std::vec::Vec<crate::MdCoreInstructionReplayInput>> {
|
||||
return crate::postgres::query::list_decode_inputs(self.pool(), filter).await;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ impl crate::RawTransactionStore for crate::PostgresStore {
|
||||
)]
|
||||
async fn has_raw_transaction_signature(
|
||||
&self,
|
||||
signature: &kb_lib::Signature,
|
||||
signature: &kb_lib::MdSignature,
|
||||
) -> kb_core::Result<bool> {
|
||||
return crate::postgres::query::has_raw_transaction_signature(
|
||||
self.pool(),
|
||||
|
||||
Reference in New Issue
Block a user