Skip to content

Commit 7c5de55

Browse files
authored
Merge pull request #433 from joshuachp/fix/grpc-store-visibility
fix(grpc): make the store public
2 parents df71edc + ed7729b commit 7c5de55

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/builder.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ where
332332
self,
333333
) -> Result<(DeviceClient<C::Store>, DeviceConnection<C::Store, C::Conn>), crate::Error> {
334334
let channel_size = self.config.channel_size;
335-
// We use the flume channel to have a clonable receiver, see the comment on the DeviceClient for more information.
335+
// We use the flume channel to have a cloneable receiver, see the comment on the DeviceClient for more information.
336336
let (tx_connection, rx_client) = flume::bounded(channel_size);
337337
let (tx_client, rx_connection) = mpsc::channel(channel_size);
338338

@@ -341,19 +341,18 @@ where
341341
.set_capacity(C::volatile_capacity_override().unwrap_or(self.config.volatile_retention))
342342
.await;
343343

344-
let transport = self
345-
.connection_config
346-
.connect(ConnectionBuildConfig {
347-
store: self.store.clone(),
348-
interfaces: &self.interfaces,
349-
config: self.config,
350-
})
351-
.await?;
344+
let config = ConnectionBuildConfig {
345+
store: self.store,
346+
interfaces: &self.interfaces,
347+
config: self.config,
348+
};
349+
352350
let DeviceTransport {
353351
connection,
354352
sender,
355353
store,
356-
} = transport;
354+
} = self.connection_config.connect(config).await?;
355+
357356
let interfaces = Arc::new(RwLock::new(self.interfaces));
358357

359358
let client =

src/transport/grpc/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
//! It defines the `Grpc` struct, which represents a GRPC connection, along with traits for publishing,
2525
//! receiving, and registering interfaces.
2626
27-
pub mod convert;
28-
mod store;
29-
3027
use std::borrow::Borrow;
3128
use std::collections::HashMap;
3229
use std::marker::PhantomData;
@@ -46,12 +43,12 @@ use astarte_message_hub_proto::{
4643
MessageHubEvent, Node,
4744
};
4845
use bytes::Bytes;
49-
use store::GrpcStore;
5046
use sync_wrapper::SyncWrapper;
5147
use tracing::{debug, error, trace, warn};
5248
use uuid::Uuid;
5349

5450
use self::convert::MessageHubProtoError;
51+
use self::store::GrpcStore;
5552
use super::{
5653
Connection, Disconnect, Publish, Receive, ReceivedEvent, Reconnect, Register, TransportError,
5754
};
@@ -77,6 +74,9 @@ use crate::{
7774
Error, Interface, Timestamp,
7875
};
7976

77+
pub mod convert;
78+
pub mod store;
79+
8080
#[cfg(feature = "message-hub")]
8181
#[cfg_attr(docsrs, doc(cfg(feature = "message-hub")))]
8282
pub use astarte_message_hub_proto::tonic;
@@ -571,7 +571,7 @@ where
571571
S: StoreCapabilities + PropertyStore + Send + Sync,
572572
{
573573
type Store = GrpcStore;
574-
type Conn = Grpc<S>;
574+
type Conn = Grpc<GrpcStore>;
575575
type Err = GrpcError;
576576

577577
async fn connect(

0 commit comments

Comments
 (0)