Skip to content

Commit 1e1789f

Browse files
committed
refactor(aggregator): gate DMQ consumer behind 'future_dmq' feature
1 parent d44f5dc commit 1e1789f

File tree

3 files changed

+17
-8
lines changed

3 files changed

+17
-8
lines changed

mithril-aggregator/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ default = ["jemallocator"]
1414

1515
bundle_tls = ["reqwest/native-tls-vendored"]
1616
jemallocator = ["dep:tikv-jemallocator"]
17+
future_dmq = ["dep:mithril-dmq-node"]
1718

1819
[dependencies]
1920
anyhow = { workspace = true }
@@ -29,7 +30,7 @@ mithril-cardano-node-chain = { path = "../internal/cardano-node/mithril-cardano-
2930
mithril-cardano-node-internal-database = { path = "../internal/cardano-node/mithril-cardano-node-internal-database" }
3031
mithril-cli-helper = { path = "../internal/mithril-cli-helper" }
3132
mithril-common = { path = "../mithril-common", features = ["full"] }
32-
mithril-dmq-node = { path = "../internal/mithril-dmq-node" }
33+
mithril-dmq-node = { path = "../internal/mithril-dmq-node", optional = true }
3334
mithril-doc = { path = "../internal/mithril-doc" }
3435
mithril-era = { path = "../internal/mithril-era" }
3536
mithril-metric = { path = "../internal/mithril-metric" }

mithril-aggregator/src/dependency_injection/builder/enablers/misc.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@
77
use std::sync::Arc;
88
use std::time::Duration;
99

10+
#[cfg(feature = "future_dmq")]
1011
use mithril_common::messages::RegisterSignatureMessageDmq;
12+
#[cfg(feature = "future_dmq")]
1113
use mithril_dmq_node::DmqConsumerPallas;
1214
use mithril_signed_entity_lock::SignedEntityTypeLock;
1315

1416
use crate::database::repository::CertificateRepository;
1517
use crate::dependency_injection::{DependenciesBuilder, Result};
1618
use crate::get_dependency;
19+
#[cfg(feature = "future_dmq")]
20+
use crate::services::SignatureConsumerDmq;
1721
use crate::services::{
1822
AggregatorClient, AggregatorHTTPClient, MessageService, MithrilMessageService,
19-
SequentialSignatureProcessor, SignatureConsumer, SignatureConsumerDmq, SignatureConsumerNoop,
20-
SignatureProcessor,
23+
SequentialSignatureProcessor, SignatureConsumer, SignatureConsumerNoop, SignatureProcessor,
2124
};
2225
impl DependenciesBuilder {
2326
async fn build_signed_entity_type_lock(&mut self) -> Result<Arc<SignedEntityTypeLock>> {
@@ -77,17 +80,20 @@ impl DependenciesBuilder {
7780

7881
/// Builds a [SignatureConsumer]
7982
pub async fn build_signature_consumer(&mut self) -> Result<Arc<dyn SignatureConsumer>> {
80-
let signature_consumer =
81-
if let Some(dmq_node_socket_path) = self.configuration.dmq_node_socket_path() {
83+
#[cfg(feature = "future_dmq")]
84+
let signature_consumer = match self.configuration.dmq_node_socket_path() {
85+
Some(dmq_node_socket_path) => {
8286
let dmq_consumer = Arc::new(DmqConsumerPallas::<RegisterSignatureMessageDmq>::new(
8387
dmq_node_socket_path,
8488
self.configuration.get_network()?,
8589
self.root_logger(),
8690
));
8791
Arc::new(SignatureConsumerDmq::new(dmq_consumer)) as Arc<dyn SignatureConsumer>
88-
} else {
89-
Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>
90-
};
92+
}
93+
_ => Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>,
94+
};
95+
#[cfg(not(feature = "future_dmq"))]
96+
let signature_consumer = Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>;
9197

9298
Ok(signature_consumer)
9399
}

mithril-aggregator/src/services/signature_consumer/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
#[cfg(feature = "future_dmq")]
12
mod dmq;
23
mod fake;
34
mod interface;
45
mod noop;
56

7+
#[cfg(feature = "future_dmq")]
68
pub use dmq::*;
79
pub use fake::*;
810
pub use interface::*;

0 commit comments

Comments
 (0)