Skip to content

Commit

Permalink
chore(torii-core): cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Nov 19, 2024
1 parent 85c0b02 commit 850df2b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 194 deletions.
4 changes: 3 additions & 1 deletion bin/torii/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ async fn main() -> anyhow::Result<()> {
if args.events.raw {
flags.insert(IndexingFlags::RAW_EVENTS);
}
if args.indexing.pending {
flags.insert(IndexingFlags::PENDING_BLOCKS);
}

let mut engine: Engine<Arc<JsonRpcClient<HttpTransport>>> = Engine::new(
world,
Expand All @@ -148,7 +151,6 @@ async fn main() -> anyhow::Result<()> {
start_block: 0,
blocks_chunk_size: args.indexing.blocks_chunk_size,
events_chunk_size: args.indexing.events_chunk_size,
index_pending: args.indexing.pending,
polling_interval: Duration::from_millis(args.indexing.polling_interval),
flags,
event_processor_config: EventProcessorConfig {
Expand Down
5 changes: 2 additions & 3 deletions crates/torii/core/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ bitflags! {
pub struct IndexingFlags: u32 {
const TRANSACTIONS = 0b00000001;
const RAW_EVENTS = 0b00000010;
const PENDING_BLOCKS = 0b00000100;
}
}

Expand All @@ -145,7 +146,6 @@ pub struct EngineConfig {
pub start_block: u64,
pub blocks_chunk_size: u64,
pub events_chunk_size: u64,
pub index_pending: bool,
pub max_concurrent_tasks: usize,
pub flags: IndexingFlags,
pub event_processor_config: EventProcessorConfig,
Expand All @@ -158,7 +158,6 @@ impl Default for EngineConfig {
start_block: 0,
blocks_chunk_size: 10240,
events_chunk_size: 1024,
index_pending: true,
max_concurrent_tasks: 100,
flags: IndexingFlags::empty(),
event_processor_config: EventProcessorConfig::default(),
Expand Down Expand Up @@ -324,7 +323,7 @@ impl<P: Provider + Send + Sync + std::fmt::Debug + 'static> Engine<P> {
let data = self.fetch_range(from, to, &cursors.cursor_map).await?;
debug!(target: LOG_TARGET, duration = ?instant.elapsed(), from = %from, to = %to, "Fetched data for range.");
FetchDataResult::Range(data)
} else if self.config.index_pending {
} else if self.config.flags.contains(IndexingFlags::PENDING_BLOCKS) {
let data =
self.fetch_pending(latest_block.clone(), cursors.last_pending_block_tx).await?;
debug!(target: LOG_TARGET, duration = ?instant.elapsed(), latest_block_number = %latest_block.block_number, "Fetched pending data.");
Expand Down
7 changes: 5 additions & 2 deletions crates/torii/core/src/sql/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ pub const FELT_DELIMITER: &str = "/";

pub mod cache;
pub mod erc;
pub mod query_queue;
#[cfg(test)]
#[path = "test.rs"]
mod test;
Expand Down Expand Up @@ -830,7 +829,11 @@ impl Sql {
Ty::Enum(e) => {
if e.options.iter().all(
|o| {
if let Ty::Tuple(t) = &o.ty { t.is_empty() } else { false }
if let Ty::Tuple(t) = &o.ty {
t.is_empty()
} else {
false
}
},
) {
return Ok(());
Expand Down
188 changes: 0 additions & 188 deletions crates/torii/core/src/sql/query_queue.rs

This file was deleted.

0 comments on commit 850df2b

Please sign in to comment.