Skip to content

Commit 7af94b6

Browse files
committed
refactor: move common service to proper crate
Signed-off-by: Gustavo Inacio <[email protected]>
1 parent b0d2cd8 commit 7af94b6

File tree

15 files changed

+149
-70
lines changed

15 files changed

+149
-70
lines changed

Cargo.lock

Lines changed: 28 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"crates/query",
77
"crates/service",
88
"crates/tap-agent",
9+
"crates/test-vector",
910
]
1011
resolver = "2"
1112

crates/common/Cargo.toml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,6 @@ serde_json = { workspace = true }
2929
tokio = { workspace = true, features = ["fs", "tokio-macros"] }
3030
cost-model = { git = "https://github.com/graphprotocol/agora", rev = "3ed34ca" }
3131
regex = "1.7.1"
32-
axum-extra = { version = "0.9.3", features = [
33-
"typed-header",
34-
], default-features = false }
35-
autometrics = { version = "1.0.1", features = ["prometheus-exporter"] }
36-
tower_governor = "0.4.0"
37-
tower-http = { version = "0.5.2", features = [
38-
"cors",
39-
"normalize-path",
40-
"trace",
41-
] }
4232
tokio-util = "0.7.10"
4333
bip39 = "2.0.0"
4434

crates/common/src/indexer_service/http/mod.rs

Lines changed: 0 additions & 13 deletions
This file was deleted.

crates/common/src/indexer_service/mod.rs

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/common/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ pub mod attestations;
77
pub mod cost_model;
88
pub mod escrow_accounts;
99
pub mod graphql;
10-
pub mod indexer_service;
1110
pub mod subgraph_client;
1211
pub mod tap;
1312
pub mod watcher;

crates/service/Cargo.toml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ license = "Apache-2.0"
1010
indexer-common = { path = "../common" }
1111
indexer-config = { path = "../config" }
1212
indexer-dips = { path = "../dips" }
13+
indexer-query = { path = "../query" }
1314
anyhow = { workspace = true }
1415
prometheus = { workspace = true }
1516
reqwest = { workspace = true }
@@ -22,6 +23,7 @@ axum.workspace = true
2223
sqlx.workspace = true
2324
thegraph-core.workspace = true
2425
thegraph-graphql-http.workspace = true
26+
graphql_client.workspace = true
2527
tracing-subscriber = { workspace = true, features = ["fmt"] }
2628
clap = { workspace = true, features = ["derive"] }
2729
build-info.workspace = true
@@ -30,11 +32,23 @@ async-graphql = { version = "7.0.11", default-features = false }
3032
async-graphql-axum = "7.0.11"
3133
base64.workspace = true
3234
graphql = { git = "https://github.com/edgeandnode/toolshed", tag = "graphql-v0.3.0" }
35+
tap_core.workspace = true
3336
uuid.workspace = true
3437
alloy.workspace = true
35-
38+
tower_governor = "0.4.0"
39+
tower-http = { version = "0.5.2", features = [
40+
"cors",
41+
"normalize-path",
42+
"trace",
43+
] }
44+
autometrics = { version = "1.0.1", features = ["prometheus-exporter"] }
45+
axum-extra = { version = "0.9.3", features = [
46+
"typed-header",
47+
], default-features = false }
48+
3649
[dev-dependencies]
3750
hex-literal = "0.4.1"
51+
test-vector = { path = "../test-vector" }
3852

3953
[build-dependencies]
4054
build-info-build = { version = "0.0.39", default-features = false }

crates/service/src/service.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ use axum::{
1313
routing::{post, post_service},
1414
Json, Router,
1515
};
16-
use indexer_common::indexer_service::http::{
17-
AttestationOutput, IndexerServiceImpl, IndexerServiceResponse,
18-
};
1916
use indexer_config::{Config, DipsConfig};
2017
use reqwest::Url;
2118
use serde::{de::DeserializeOwned, Serialize};
@@ -31,14 +28,20 @@ use crate::{
3128
dips::{AgreementStore, InMemoryAgreementStore},
3229
},
3330
routes::dips::Price,
31+
service::indexer_service::{
32+
AttestationOutput, IndexerService, IndexerServiceImpl, IndexerServiceOptions,
33+
IndexerServiceRelease, IndexerServiceResponse,
34+
},
3435
};
35-
3636
use clap::Parser;
37-
use indexer_common::indexer_service::http::{
38-
IndexerService, IndexerServiceOptions, IndexerServiceRelease,
39-
};
4037
use tracing::error;
4138

39+
mod health;
40+
mod indexer_service;
41+
mod request_handler;
42+
mod static_subgraph;
43+
mod tap_receipt_header;
44+
4245
#[derive(Debug)]
4346
struct SubgraphServiceResponse {
4447
inner: String,

crates/common/src/indexer_service/http/indexer_service.rs renamed to crates/service/src/service/indexer_service.rs

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@ use axum::{
1414
};
1515
use axum::{serve, ServiceExt};
1616
use build_info::BuildInfo;
17+
use indexer_common::{
18+
address::public_key,
19+
escrow_accounts::{EscrowAccounts, EscrowAccountsError},
20+
prelude::{
21+
attestation_signers, dispute_manager, escrow_accounts, indexer_allocations,
22+
AttestationSigner, DeploymentDetails, SubgraphClient,
23+
},
24+
tap::IndexerTapContext,
25+
};
1726
use prometheus::TextEncoder;
1827
use reqwest::StatusCode;
1928
use serde::{de::DeserializeOwned, Serialize};
@@ -30,22 +39,10 @@ use tokio::signal;
3039
use tokio::sync::watch::Receiver;
3140
use tower_governor::{governor::GovernorConfigBuilder, GovernorLayer};
3241
use tower_http::{cors, cors::CorsLayer, normalize_path::NormalizePath, trace::TraceLayer};
33-
use tracing::error;
34-
use tracing::{info, info_span};
42+
use tracing::{error, info, info_span};
3543

3644
use super::request_handler::request_handler;
37-
use crate::escrow_accounts::EscrowAccounts;
38-
use crate::escrow_accounts::EscrowAccountsError;
39-
use crate::indexer_service::http::health::health;
40-
use crate::{
41-
address::public_key,
42-
indexer_service::http::static_subgraph::static_subgraph_request_handler,
43-
prelude::{
44-
attestation_signers, dispute_manager, escrow_accounts, indexer_allocations,
45-
AttestationSigner, DeploymentDetails, SubgraphClient,
46-
},
47-
tap::IndexerTapContext,
48-
};
45+
use super::{health::health, static_subgraph::static_subgraph_request_handler};
4946
use indexer_config::Config;
5047

5148
pub trait IndexerServiceResponse {

0 commit comments

Comments
 (0)