Skip to content

Commit e2781ed

Browse files
committed
refactor(dmq): rename 'DmqConsumerPallas' to 'DmqConsumerClientPallas'
1 parent 1f9583b commit e2781ed

File tree

6 files changed

+25
-24
lines changed

6 files changed

+25
-24
lines changed

internal/mithril-dmq/src/consumer/client/interface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use std::fmt::Debug;
22

33
use mithril_common::{StdResult, crypto_helper::TryFromBytes, entities::PartyId};
44

5-
/// Trait for consuming messages from a DMQ node.
5+
/// Trait for the client side of consuming messages from a DMQ node.
66
#[cfg_attr(test, mockall::automock)]
77
#[async_trait::async_trait]
8-
pub trait DmqConsumer<M: TryFromBytes + Debug + Send + Sync>: Send + Sync {
8+
pub trait DmqConsumerClient<M: TryFromBytes + Debug + Send + Sync>: Send + Sync {
99
/// Consume messages from the DMQ node.
1010
async fn consume_messages(&self) -> StdResult<Vec<(M, PartyId)>>;
1111
}

internal/mithril-dmq/src/consumer/client/pallas.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ use mithril_common::{
1212
logging::LoggerExtensions,
1313
};
1414

15-
use crate::DmqConsumer;
15+
use crate::DmqConsumerClient;
1616

17-
/// A DMQ consumer implementation.
17+
/// A DMQ client consumer implementation.
1818
///
1919
/// This implementation is built upon the n2c mini-protocols DMQ implementation in Pallas.
20-
pub struct DmqConsumerPallas<M: TryFromBytes + Debug> {
20+
pub struct DmqConsumerClientPallas<M: TryFromBytes + Debug> {
2121
socket: PathBuf,
2222
network: CardanoNetwork,
2323
client: Mutex<Option<DmqClient>>,
2424
logger: Logger,
2525
phantom: PhantomData<M>,
2626
}
2727

28-
impl<M: TryFromBytes + Debug> DmqConsumerPallas<M> {
29-
/// Creates a new `DmqConsumerPallas` instance.
28+
impl<M: TryFromBytes + Debug> DmqConsumerClientPallas<M> {
29+
/// Creates a new `DmqConsumerClientPallas` instance.
3030
pub fn new(socket: PathBuf, network: CardanoNetwork, logger: Logger) -> Self {
3131
Self {
3232
socket,
@@ -47,7 +47,7 @@ impl<M: TryFromBytes + Debug> DmqConsumerPallas<M> {
4747
);
4848
DmqClient::connect(&self.socket, self.network.code())
4949
.await
50-
.with_context(|| "DmqConsumerPallas failed to create a new client")
50+
.with_context(|| "DmqConsumerClientPallas failed to create a new client")
5151
}
5252

5353
/// Gets the cached `DmqClient`, creating a new one if it does not exist.
@@ -128,7 +128,7 @@ impl<M: TryFromBytes + Debug> DmqConsumerPallas<M> {
128128
}
129129

130130
#[async_trait::async_trait]
131-
impl<M: TryFromBytes + Debug + Sync + Send> DmqConsumer<M> for DmqConsumerPallas<M> {
131+
impl<M: TryFromBytes + Debug + Sync + Send> DmqConsumerClient<M> for DmqConsumerClientPallas<M> {
132132
async fn consume_messages(&self) -> StdResult<Vec<(M, PartyId)>> {
133133
let messages = self.consume_messages_internal().await;
134134
if messages.is_err() {
@@ -245,7 +245,7 @@ mod tests {
245245
let reply_messages = fake_msgs();
246246
let server = setup_dmq_server(socket_path.clone(), reply_messages);
247247
let client = tokio::spawn(async move {
248-
let consumer = DmqConsumerPallas::new(
248+
let consumer = DmqConsumerClientPallas::new(
249249
socket_path,
250250
CardanoNetwork::TestNet(0),
251251
TestLogger::stdout(),
@@ -278,7 +278,7 @@ mod tests {
278278
let reply_messages = vec![];
279279
let server = setup_dmq_server(socket_path.clone(), reply_messages);
280280
let client = tokio::spawn(async move {
281-
let consumer = DmqConsumerPallas::<DmqMessageTestPayload>::new(
281+
let consumer = DmqConsumerClientPallas::<DmqMessageTestPayload>::new(
282282
socket_path,
283283
CardanoNetwork::TestNet(0),
284284
TestLogger::stdout(),
@@ -302,7 +302,7 @@ mod tests {
302302
let reply_messages = fake_msgs();
303303
let server = setup_dmq_server(socket_path.clone(), reply_messages);
304304
let client = tokio::spawn(async move {
305-
let consumer = DmqConsumerPallas::<DmqMessageTestPayload>::new(
305+
let consumer = DmqConsumerClientPallas::<DmqMessageTestPayload>::new(
306306
socket_path,
307307
CardanoNetwork::TestNet(0),
308308
TestLogger::stdout(),

internal/mithril-dmq/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mod message;
66
mod publisher;
77
pub mod test;
88

9-
pub use consumer::{DmqConsumer, DmqConsumerPallas};
9+
pub use consumer::{DmqConsumerClient, DmqConsumerClientPallas};
1010
pub use message::DmqMessageBuilder;
1111
pub use publisher::{DmqPublisher, DmqPublisherPallas};
1212

internal/mithril-dmq/src/test/double/consumer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use tokio::sync::Mutex;
44

55
use mithril_common::{StdResult, crypto_helper::TryFromBytes, entities::PartyId};
66

7-
use crate::DmqConsumer;
7+
use crate::DmqConsumerClient;
88

99
type ConsumerReturn<M> = StdResult<Vec<(M, PartyId)>>;
1010

@@ -23,7 +23,7 @@ impl<M: TryFromBytes + Debug + Send + Sync> DmqConsumerFake<M> {
2323
}
2424

2525
#[async_trait::async_trait]
26-
impl<M: TryFromBytes + Debug + Send + Sync> DmqConsumer<M> for DmqConsumerFake<M> {
26+
impl<M: TryFromBytes + Debug + Send + Sync> DmqConsumerClient<M> for DmqConsumerFake<M> {
2727
async fn consume_messages(&self) -> ConsumerReturn<M> {
2828
let mut results = self.results.lock().await;
2929

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use std::time::Duration;
1010
#[cfg(feature = "future_dmq")]
1111
use mithril_common::messages::RegisterSignatureMessageDmq;
1212
#[cfg(feature = "future_dmq")]
13-
use mithril_dmq::DmqConsumerPallas;
13+
use mithril_dmq::DmqConsumerClientPallas;
1414
use mithril_signed_entity_lock::SignedEntityTypeLock;
1515

1616
use crate::database::repository::CertificateRepository;
@@ -81,11 +81,12 @@ impl DependenciesBuilder {
8181
#[cfg(feature = "future_dmq")]
8282
let signature_consumer = match self.configuration.dmq_node_socket_path() {
8383
Some(dmq_node_socket_path) => {
84-
let dmq_consumer = Arc::new(DmqConsumerPallas::<RegisterSignatureMessageDmq>::new(
85-
dmq_node_socket_path,
86-
self.configuration.get_network()?,
87-
self.root_logger(),
88-
));
84+
let dmq_consumer =
85+
Arc::new(DmqConsumerClientPallas::<RegisterSignatureMessageDmq>::new(
86+
dmq_node_socket_path,
87+
self.configuration.get_network()?,
88+
self.root_logger(),
89+
));
8990
Arc::new(SignatureConsumerDmq::new(dmq_consumer)) as Arc<dyn SignatureConsumer>
9091
}
9192
_ => Arc::new(SignatureConsumerNoop) as Arc<dyn SignatureConsumer>,

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,18 @@ use mithril_common::{
99
messages::RegisterSignatureMessageDmq,
1010
};
1111

12-
use mithril_dmq::DmqConsumer;
12+
use mithril_dmq::DmqConsumerClient;
1313

1414
use super::SignatureConsumer;
1515

1616
/// DMQ implementation of the [SignatureConsumer] trait.
1717
pub struct SignatureConsumerDmq {
18-
dmq_consumer: Arc<dyn DmqConsumer<RegisterSignatureMessageDmq>>,
18+
dmq_consumer: Arc<dyn DmqConsumerClient<RegisterSignatureMessageDmq>>,
1919
}
2020

2121
impl SignatureConsumerDmq {
2222
/// Creates a new instance of [SignatureConsumerDmq].
23-
pub fn new(dmq_consumer: Arc<dyn DmqConsumer<RegisterSignatureMessageDmq>>) -> Self {
23+
pub fn new(dmq_consumer: Arc<dyn DmqConsumerClient<RegisterSignatureMessageDmq>>) -> Self {
2424
Self { dmq_consumer }
2525
}
2626
}

0 commit comments

Comments
 (0)