Skip to content

Commit 4811355

Browse files
committed
feat(grpc): Add GrpcStore that requests updated properties
Properties are requested to the message hub server to ensure they are updated in the eventuality of multiple clients with the same property interface modifying them. BREAKING CHANGE: Move a builder method to make it available to Mqtt config only Signed-off-by: Luca Arato <luca.arato@secomind.com>
1 parent d5a0e4b commit 4811355

File tree

26 files changed

+1147
-392
lines changed

26 files changed

+1147
-392
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ rustc-args = ["--cfg=docsrs"]
107107
[workspace.dependencies]
108108
astarte-device-sdk = { path = "./", version = "=0.9.3" }
109109
astarte-device-sdk-derive = { version = "=0.9.3", path = "./astarte-device-sdk-derive" }
110-
astarte-message-hub-proto = { git = "https://github.com/astarte-platform/astarte-message-hub-proto.git", rev = "5ff0672d8fdc8cba5a2ff023895ae505d75c3d1a" }
110+
astarte-message-hub-proto = { git = "https://github.com/astarte-platform/astarte-message-hub-proto.git", rev = "370be08ff90236a25b15af6e27d5363739566f2f" }
111111
async-trait = "0.1.67"
112112
base64 = "0.22.0"
113113
bson = "2.7.0"

docs/get-started.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,9 @@ async fn init() -> eyre::Result<(DeviceClient<SqliteStore>, DeviceConnection<Sql
166166
.store(store)
167167
// NOTE: here we are not defining any Astarte interface, thus the device will not be able to
168168
// send or receive data to/from Astarte
169-
.connect(mqtt_config)
170-
.await?
169+
.connection(mqtt_config)
171170
.build()
172-
.await;
171+
.await?;
173172
174173
Ok((client, connection))
175174
}
@@ -424,8 +423,7 @@ async fn main() -> eyre::Result<()> {
424423
let (client, connection) = DeviceBuilder::new()
425424
.store(store)
426425
.interface_directory("interfaces")?
427-
.connect(mqtt_config)
428-
.await?
426+
.connection(mqtt_config)
429427
.build()
430428
.await;
431429
*/

e2e-test/src/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,9 @@ async fn main() -> eyre::Result<()> {
166166
.store_dir(&test_cfg.store_directory)
167167
.await?
168168
.interface_directory(&test_cfg.interfaces_fld)?
169-
.connect(mqtt_config)
170-
.await?
169+
.connection(mqtt_config)
171170
.build()
172-
.await;
171+
.await?;
173172

174173
let rx_data_ind_datastream = Arc::new(Mutex::new(HashMap::new()));
175174
let rx_data_agg_datastream = Arc::new(Mutex::new((String::new(), HashMap::new())));

examples/individual_datastream/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ async fn main() -> Result<(), DynError> {
6060
let (client, connection) = DeviceBuilder::new()
6161
.store(MemoryStore::new())
6262
.interface_directory("./examples/individual_datastream/interfaces")?
63-
.connect(mqtt_config)
64-
.await?
63+
.connection(mqtt_config)
6564
.build()
66-
.await;
65+
.await?;
6766

6867
let client_cl = client.clone();
6968
println!("Connection to Astarte established.");

examples/individual_properties/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ async fn main() -> Result<(), DynError> {
8282
let (client, connection) = DeviceBuilder::new()
8383
.interface_directory("./examples/individual_properties/interfaces")?
8484
.store(db)
85-
.connect(mqtt_config)
86-
.await?
85+
.connection(mqtt_config)
8786
.build()
88-
.await;
87+
.await?;
8988
let device_cpy = client.clone();
9089

9190
println!("Connection to Astarte established.");

examples/object_datastream/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,9 @@ async fn main() -> Result<(), Error> {
6565
let (client, connection) = DeviceBuilder::new()
6666
.store(MemoryStore::new())
6767
.interface_directory("./examples/object_datastream/interfaces")?
68-
.connect(mqtt_config)
69-
.await?
68+
.connection(mqtt_config)
7069
.build()
71-
.await;
70+
.await?;
7271

7372
// Create an thread to transmit
7473
tokio::task::spawn(async move {

examples/retention/main.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,9 @@ async fn main() -> Result<(), DynError> {
7272
.await?
7373
.interface_str(INTERFACE_STORED)?
7474
.interface_str(INTERFACE_VOLATILE)?
75-
.connect(mqtt_config)
76-
.await?
75+
.connection(mqtt_config)
7776
.build()
78-
.await;
77+
.await?;
7978

8079
let mut tasks = tokio::task::JoinSet::new();
8180

0 commit comments

Comments
 (0)