Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[indexer-alt] - add genesis checkpoint to indexer args #20788

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/sui-indexer-alt-framework/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,11 @@ pub struct IndexerArgs {
/// Address to serve Prometheus Metrics from.
#[arg(long, default_value_t = Self::default().metrics_address)]
pub metrics_address: SocketAddr,

/// The genesis checkpoint to start ingestion from, this is useful for app indexer which only
/// needs to index checkpoint after the app contract's genesis.
#[arg(long, default_value_t = 0)]
pub genesis_checkpoint: u64,
}

pub struct Indexer {
Expand Down Expand Up @@ -103,6 +108,9 @@ pub struct Indexer {

/// The handles for every task spawned by this indexer, used to manage graceful shutdown.
handles: Vec<JoinHandle<()>>,

/// Default checkpoint lowerbound.
genesis_checkpoint: u64,
}

impl Indexer {
Expand Down Expand Up @@ -135,6 +143,7 @@ impl Indexer {
pipeline,
skip_watermark,
metrics_address,
genesis_checkpoint,
} = indexer_args;

let db = Db::for_write(db_args)
Expand Down Expand Up @@ -173,6 +182,7 @@ impl Indexer {
cancel,
first_checkpoint_from_watermark: u64::MAX,
handles: vec![],
genesis_checkpoint,
})
}

Expand Down Expand Up @@ -427,7 +437,7 @@ impl Indexer {
watermark
.as_ref()
.map(|w| w.checkpoint_hi_inclusive as u64 + 1)
.unwrap_or_default()
.unwrap_or(self.genesis_checkpoint)
};

self.first_checkpoint_from_watermark =
Expand All @@ -445,6 +455,7 @@ impl Default for IndexerArgs {
pipeline: vec![],
skip_watermark: false,
metrics_address: "0.0.0.0:9184".parse().unwrap(),
genesis_checkpoint: 0,
}
}
}
Expand Down
Loading