diff --git a/crates/sui-indexer-alt-framework/src/handlers/cp_mapping.rs b/crates/sui-indexer-alt-framework/src/handlers/cp_sequence_numbers.rs similarity index 75% rename from crates/sui-indexer-alt-framework/src/handlers/cp_mapping.rs rename to crates/sui-indexer-alt-framework/src/handlers/cp_sequence_numbers.rs index 7cb933bd89b09f..0948c74a9c7895 100644 --- a/crates/sui-indexer-alt-framework/src/handlers/cp_mapping.rs +++ b/crates/sui-indexer-alt-framework/src/handlers/cp_sequence_numbers.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use crate::pipeline::{concurrent::Handler, Processor}; -use crate::schema::cp_mapping; +use crate::schema::cp_sequence_numbers; use anyhow::Result; use diesel::prelude::*; use diesel_async::RunQueryDsl; @@ -13,19 +13,19 @@ use sui_pg_db::{self as db}; use sui_types::full_checkpoint_content::CheckpointData; #[derive(Insertable, Selectable, Queryable, Debug, Clone, FieldCount)] -#[diesel(table_name = cp_mapping)] -pub struct StoredCpMapping { +#[diesel(table_name = cp_sequence_numbers)] +pub struct StoredCpSequenceNumbers { pub cp_sequence_number: i64, pub tx_lo: i64, pub epoch: i64, } -pub struct CpMapping; +pub struct CpSequenceNumbers; -impl Processor for CpMapping { - const NAME: &'static str = "cp_mapping"; +impl Processor for CpSequenceNumbers { + const NAME: &'static str = "cp_sequence_numbers"; - type Value = StoredCpMapping; + type Value = StoredCpSequenceNumbers; fn process(&self, checkpoint: &Arc) -> Result> { let cp_sequence_number = checkpoint.checkpoint_summary.sequence_number as i64; @@ -33,7 +33,7 @@ impl Processor for CpMapping { checkpoint.checkpoint_summary.network_total_transactions as i64; let tx_lo = network_total_transactions - checkpoint.transactions.len() as i64; let epoch = checkpoint.checkpoint_summary.epoch as i64; - Ok(vec![StoredCpMapping { + Ok(vec![StoredCpSequenceNumbers { cp_sequence_number, tx_lo, epoch, @@ -42,9 +42,9 @@ impl Processor for CpMapping { } #[async_trait::async_trait] -impl Handler for CpMapping { +impl Handler for CpSequenceNumbers { async fn commit(values: &[Self::Value], conn: &mut db::Connection<'_>) -> Result { - Ok(diesel::insert_into(cp_mapping::table) + Ok(diesel::insert_into(cp_sequence_numbers::table) .values(values) .on_conflict_do_nothing() .execute(conn) diff --git a/crates/sui-indexer-alt-framework/src/handlers/mod.rs b/crates/sui-indexer-alt-framework/src/handlers/mod.rs index f0a0685a64044f..350ec29d5fd257 100644 --- a/crates/sui-indexer-alt-framework/src/handlers/mod.rs +++ b/crates/sui-indexer-alt-framework/src/handlers/mod.rs @@ -1,4 +1,4 @@ // Copyright (c) Mysten Labs, Inc. // SPDX-License-Identifier: Apache-2.0 -pub mod cp_mapping; +pub mod cp_sequence_numbers; diff --git a/crates/sui-indexer-alt-framework/src/schema.rs b/crates/sui-indexer-alt-framework/src/schema.rs index d6c361f246fce9..4a9d30cf9bbeba 100644 --- a/crates/sui-indexer-alt-framework/src/schema.rs +++ b/crates/sui-indexer-alt-framework/src/schema.rs @@ -3,7 +3,7 @@ // @generated automatically by Diesel CLI. diesel::table! { - cp_mapping (cp_sequence_number) { + cp_sequence_numbers (cp_sequence_number) { cp_sequence_number -> Int8, tx_lo -> Int8, epoch -> Int8, @@ -23,4 +23,4 @@ diesel::table! { } } -diesel::allow_tables_to_appear_in_same_query!(cp_mapping, watermarks,); +diesel::allow_tables_to_appear_in_same_query!(cp_sequence_numbers, watermarks,); diff --git a/crates/sui-indexer-alt/src/config.rs b/crates/sui-indexer-alt/src/config.rs index 5b30464a39c664..22472a1209fc7f 100644 --- a/crates/sui-indexer-alt/src/config.rs +++ b/crates/sui-indexer-alt/src/config.rs @@ -140,7 +140,7 @@ pub struct PipelineLayer { pub coin_balance_buckets_pruner: Option, // All concurrent pipelines - pub cp_mapping: Option, + pub cp_sequence_numbers: Option, pub ev_emit_mod: Option, pub ev_struct_inst: Option, pub kv_checkpoints: Option, @@ -274,7 +274,7 @@ impl PipelineLayer { obj_info_pruner: Some(Default::default()), coin_balance_buckets: Some(Default::default()), coin_balance_buckets_pruner: Some(Default::default()), - cp_mapping: Some(Default::default()), + cp_sequence_numbers: Some(Default::default()), ev_emit_mod: Some(Default::default()), ev_struct_inst: Some(Default::default()), kv_checkpoints: Some(Default::default()), @@ -411,7 +411,7 @@ impl Merge for PipelineLayer { coin_balance_buckets_pruner: self .coin_balance_buckets_pruner .merge(other.coin_balance_buckets_pruner), - cp_mapping: self.cp_mapping.merge(other.cp_mapping), + cp_sequence_numbers: self.cp_sequence_numbers.merge(other.cp_sequence_numbers), ev_emit_mod: self.ev_emit_mod.merge(other.ev_emit_mod), ev_struct_inst: self.ev_struct_inst.merge(other.ev_struct_inst), kv_checkpoints: self.kv_checkpoints.merge(other.kv_checkpoints), diff --git a/crates/sui-indexer-alt/src/lib.rs b/crates/sui-indexer-alt/src/lib.rs index 96023e505e2b38..ba4c59c3052de8 100644 --- a/crates/sui-indexer-alt/src/lib.rs +++ b/crates/sui-indexer-alt/src/lib.rs @@ -16,7 +16,7 @@ use handlers::{ tx_affected_objects::TxAffectedObjects, tx_balance_changes::TxBalanceChanges, tx_calls::TxCalls, tx_digests::TxDigests, tx_kinds::TxKinds, }; -use sui_indexer_alt_framework::handlers::cp_mapping::CpMapping; +use sui_indexer_alt_framework::handlers::cp_sequence_numbers::CpSequenceNumbers; use sui_indexer_alt_framework::ingestion::{ClientArgs, IngestionConfig}; use sui_indexer_alt_framework::pipeline::{ concurrent::{ConcurrentConfig, PrunerConfig}, @@ -63,7 +63,7 @@ pub async fn start_indexer( obj_info_pruner, coin_balance_buckets, coin_balance_buckets_pruner, - cp_mapping, + cp_sequence_numbers, ev_emit_mod, ev_struct_inst, kv_checkpoints, @@ -203,7 +203,7 @@ pub async fn start_indexer( ); // Unpruned concurrent pipelines - add_concurrent!(CpMapping, cp_mapping); + add_concurrent!(CpSequenceNumbers, cp_sequence_numbers); add_concurrent!(EvEmitMod, ev_emit_mod); add_concurrent!(EvStructInst, ev_struct_inst); add_concurrent!(KvCheckpoints, kv_checkpoints);