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

Create indexer service framework #80

Merged
merged 18 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
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
503 changes: 483 additions & 20 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 1 addition & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
[workspace]
members = [
"common",
"service",
"tap-agent",
]
members = ["common", "service", "tap-agent"]
resolver = "2"

[profile.dev.package."*"]
Expand Down
11 changes: 10 additions & 1 deletion common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ sqlx = { version = "0.7.1", features = [
] }
tokio = { version = "1.32.0", features = ["full", "macros", "rt"] }
thegraph = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
tracing = "0.1.34"
graphql-http = { git = "https://github.com/edgeandnode/toolshed", branch = "main" }
tap_core = "0.7.0"
axum = { version = "0.6.20", default_features = true, features = ["headers"] }
thiserror = "1.0.49"
async-trait = "0.1.74"
headers-derive = "0.1.1"
headers = "0.3.9"
build-info = "0.0.34"
autometrics = { version = "0.6.0", features = ["prometheus-exporter"] }
tracing = "0.1.40"
tower = "0.4.13"
tower_governor = "0.1.0"

[dev-dependencies]
env_logger = "0.9.0"
Expand Down
63 changes: 63 additions & 0 deletions common/src/indexer_service/http/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2023-, GraphOps and Semiotic Labs.
// SPDX-License-Identifier: Apache-2.0

use std::net::SocketAddr;

use alloy_primitives::Address;
use serde::{Deserialize, Serialize};
use thegraph::types::DeploymentId;

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct DatabaseConfig {
pub postgres_url: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct SubgraphConfig {
pub deployment: Option<DeploymentId>,
pub query_url: String,
pub syncing_interval: u64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ServerConfig {
pub host_and_port: SocketAddr,
pub metrics_host_and_port: SocketAddr,
pub url_prefix: String,
pub free_query_auth_token: Option<String>,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IndexerServiceConfig {
hopeyen marked this conversation as resolved.
Show resolved Hide resolved
pub indexer: IndexerConfig,
pub server: ServerConfig,
pub database: DatabaseConfig,
pub graph_node: Option<GraphNodeConfig>,
hopeyen marked this conversation as resolved.
Show resolved Hide resolved
pub network_subgraph: SubgraphConfig,
pub escrow_subgraph: SubgraphConfig,
pub graph_network: GraphNetworkConfig,
pub scalar: ScalarConfig,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GraphNodeConfig {
pub status_url: String,
pub query_base_url: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct GraphNetworkConfig {
pub id: u64,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct IndexerConfig {
pub indexer_address: Address,
pub operator_mnemonic: String,
}

#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct ScalarConfig {
pub chain_id: u64,
pub receipts_verifier_address: Address,
}
Loading