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

refactor(torii): fragment into different modules #2856

Merged
merged 11 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
133 changes: 88 additions & 45 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ katana-trie = { path = "crates/katana/trie" }
# torii
torii-cli = { path = "crates/torii/cli" }
torii-client = { path = "crates/torii/client" }
torii-core = { path = "crates/torii/core" }
torii-indexer = { path = "crates/torii/indexer" }
torii-sqlite = { path = "crates/torii/sqlite" }
torii-graphql = { path = "crates/torii/graphql" }
torii-grpc = { path = "crates/torii/grpc" }
torii-relay = { path = "crates/torii/libp2p" }
Expand Down
3 changes: 2 additions & 1 deletion bin/torii/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ tokio-util = "0.7.7"
tokio.workspace = true
toml.workspace = true
torii-cli.workspace = true
torii-core.workspace = true
torii-indexer.workspace = true
torii-sqlite.workspace = true
torii-graphql.workspace = true
torii-grpc = { workspace = true, features = [ "server" ] }
torii-relay.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/torii/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ dojo-utils.workspace = true
serde.workspace = true
starknet.workspace = true
toml.workspace = true
torii-core.workspace = true
torii-indexer.workspace = true
torii-sqlite.workspace = true
url.workspace = true

[dev-dependencies]
Expand Down
12 changes: 0 additions & 12 deletions crates/torii/core/src/lib.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/torii/core/src/processors/store_update_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use tracing::{info, warn};

use super::{EventProcessor, EventProcessorConfig};
use crate::processors::{ENTITY_ID_INDEX, MODEL_INDEX};
use crate::sql::Sql;
use torii_sqlite::Sql;

pub(crate) const LOG_TARGET: &str = "torii_core::processors::store_update_member";

Expand Down
2 changes: 1 addition & 1 deletion crates/torii/core/src/processors/store_update_record.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use starknet::providers::Provider;
use tracing::{debug, info};

use super::{EventProcessor, EventProcessorConfig};
use crate::sql::Sql;
use torii_sqlite::Sql;

pub(crate) const LOG_TARGET: &str = "torii_core::processors::store_update_record";

Expand Down
2 changes: 1 addition & 1 deletion crates/torii/core/src/sql/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use tokio::sync::broadcast;
use crate::engine::{Engine, EngineConfig, Processors};
use crate::executor::Executor;
use crate::sql::cache::ModelCache;
use crate::sql::Sql;
use torii_sqlite::Sql;
use crate::types::{Contract, ContractType};

pub async fn bootstrap_engine<P>(
Expand Down
82 changes: 0 additions & 82 deletions crates/torii/core/src/utils.rs

This file was deleted.

2 changes: 1 addition & 1 deletion crates/torii/graphql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ strum_macros.workspace = true
thiserror.workspace = true
tokio.workspace = true
tokio-stream = "0.1.11"
torii-core.workspace = true
torii-sqlite.workspace = true
tracing.workspace = true
url.workspace = true
warp.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions crates/torii/grpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ rayon.workspace = true
starknet.workspace = true
starknet-crypto.workspace = true
thiserror.workspace = true
torii-core = { path = "../core", optional = true }
torii-sqlite = { path = "../sqlite", optional = true }

crypto-bigint.workspace = true
serde.workspace = true
Expand Down Expand Up @@ -61,4 +61,4 @@ wasm-tonic-build.workspace = true

[features]
client = [ ]
server = [ "dep:torii-core" ] # this feature can't be build on wasm32
server = [ "dep:torii-sqlite" ] # this feature can't be build on wasm32
8 changes: 4 additions & 4 deletions crates/torii/grpc/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ use tonic::codec::CompressionEncoding;
use tonic::transport::Server;
use tonic::{Request, Response, Status};
use tonic_web::GrpcWebLayer;
use torii_core::error::{Error, ParseError, QueryError};
use torii_core::model::{fetch_entities, map_row_to_ty};
use torii_core::sql::cache::ModelCache;
use torii_core::types::{Token, TokenBalance};
use torii_sqlite::error::{Error, ParseError, QueryError};
use torii_sqlite::model::{fetch_entities, map_row_to_ty};
use torii_sqlite::cache::ModelCache;
use torii_sqlite::types::{Token, TokenBalance};
use tower_http::cors::{AllowOrigin, CorsLayer};

use self::subscriptions::entity::EntityManager;
Expand Down
Loading