Skip to content

Commit 6cf2eb5

Browse files
Feature flag server framework (#149)
1 parent e8047bc commit 6cf2eb5

File tree

5 files changed

+58
-56
lines changed

5 files changed

+58
-56
lines changed

aptos-indexer-processors-sdk/Cargo.toml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,13 @@ testcontainers = "0.20.1"
8787
thiserror = "1.0.61"
8888
tiny-keccak = { version = "2.0.2", features = ["keccak", "sha3"] }
8989
tracing = "0.1.34"
90-
tokio = { version = "1.37.0", features = ["full"] }
90+
tokio = { version = "1.37.0", features = [
91+
"rt",
92+
"rt-multi-thread",
93+
"sync",
94+
"time",
95+
"macros",
96+
] }
9197
tokio-retry = { version = "0.3.0" }
9298
toml = "0.7.4"
9399
tonic = { version = "0.12.3", features = [

aptos-indexer-processors-sdk/sdk/Cargo.toml

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ aptos-indexer-transaction-stream = { workspace = true }
1818
aptos-protos = { workspace = true }
1919
aptos-transaction-filter = { workspace = true }
2020
async-trait = { workspace = true }
21-
autometrics = { workspace = true }
22-
axum = { workspace = true }
23-
backtrace = { workspace = true }
21+
autometrics = { workspace = true, optional = true }
22+
axum = { workspace = true, optional = true }
23+
backtrace = { workspace = true, optional = true }
2424
bcs = { workspace = true }
2525
bigdecimal = { workspace = true }
2626
chrono = { workspace = true }
27-
clap = { workspace = true }
27+
clap = { workspace = true, optional = true }
2828
derive_builder = { workspace = true }
2929
diesel = { workspace = true, optional = true }
3030
diesel-async = { workspace = true, optional = true }
@@ -56,28 +56,46 @@ tokio = { workspace = true }
5656
tokio-postgres = { workspace = true, optional = true }
5757
tokio-retry = { workspace = true, optional = true }
5858
tokio-stream = { workspace = true, optional = true }
59-
toml = { workspace = true }
59+
toml = { workspace = true, optional = true }
6060
tonic = { workspace = true, optional = true }
6161
tracing = { workspace = true }
62-
tracing-subscriber = { workspace = true }
62+
tracing-subscriber = { workspace = true, optional = true }
6363
url = { workspace = true }
6464

6565
[target.'cfg(target_os = "linux")'.dependencies]
6666
aptos-system-utils = { workspace = true }
6767

6868
[features]
69+
# Server framework feature enables the HTTP server with metrics and health check endpoints.
70+
# This requires tokio net features for the TCP listener.
71+
server_framework = [
72+
"autometrics",
73+
"axum",
74+
"backtrace",
75+
"clap",
76+
"toml",
77+
"tracing-subscriber",
78+
"tokio/net",
79+
]
6980
postgres_partial = [
7081
"diesel",
7182
"diesel-async",
7283
"diesel_migrations",
7384
"field_count",
7485
"postgres-native-tls",
7586
"native-tls",
87+
"server_framework",
7688
"tokio-postgres",
7789
]
7890
# When using the postgres_full features we enable the diesel/postgres feature. We configure
7991
# it in a feature so the CLI can opt out, since it cannot tolerate the libpq dep.
8092
# Recall that features should always be additive.
8193
postgres_full = ["postgres_partial", "diesel/postgres"]
82-
testing_framework = ["testcontainers", "tonic", "tokio-retry", "tokio-stream"]
94+
testing_framework = [
95+
"testcontainers",
96+
"tonic",
97+
"tokio-retry",
98+
"tokio-stream",
99+
"tokio/net",
100+
]
83101
default = []

aptos-indexer-processors-sdk/sdk/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ pub mod builder;
22
pub mod common_steps; // TODO: Feature gate this?
33
#[cfg(feature = "postgres_partial")]
44
pub mod postgres;
5+
#[cfg(feature = "server_framework")]
56
pub mod server_framework;
67
pub mod test;
78
#[cfg(feature = "testing_framework")]

examples/Cargo.lock

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

examples/postgres-basic-events-example/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ rust-version = { workspace = true }
1313

1414
[dependencies]
1515
anyhow = { workspace = true }
16-
aptos-indexer-processor-sdk = { workspace = true }
16+
aptos-indexer-processor-sdk = { workspace = true, features = ["postgres_full"] }
1717
async-trait = { workspace = true }
1818
clap = { workspace = true }
1919
diesel = { workspace = true }

0 commit comments

Comments
 (0)