Skip to content

Commit 5f4ff94

Browse files
author
Damien LACHAUME / PALO-IT
committed
PR review: fix typos
1 parent 8931101 commit 5f4ff94

File tree

14 files changed

+30
-54
lines changed

14 files changed

+30
-54
lines changed

docs/website/root/manual/developer-docs/nodes/mithril-client-library.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import CompiledBinaries from '../../../compiled-binaries.md'
1212
Mithril client library can be used by Rust developers to use the Mithril network in their applications.
1313

1414
It is responsible for handling the different types of data certified by Mithril, and available through a Mithril aggregator:
15-
- [**Snapshot**](../../../glossary.md#snapshot): list, get, download tarball and add statistics.
15+
- [**Snapshot**](../../../glossary.md#snapshot): list, get, download tarball and record statistics.
1616
- [**Mithril stake distribution**](../../../glossary.md#stake-distribution): list and get.
1717
- [**Certificate**](../../../glossary.md#certificate): list, get, and chain validation.
1818

@@ -90,7 +90,7 @@ async fn main() -> mithril_client::MithrilResult<()> {
9090
.await?;
9191

9292
if let Err(e) = client.snapshot().add_statistics(&snapshot).await {
93-
println!("Could not POST snapshot download statistics: {:?}", e);
93+
println!("Could not increment snapshot download statistics: {:?}", e);
9494
}
9595

9696
let message = MessageBuilder::new()
@@ -148,7 +148,7 @@ async fn main() -> mithril_client::MithrilResult<()> {
148148
.await?;
149149

150150
if let Err(e) = client.snapshot().add_statistics(&snapshot).await {
151-
println!("Could not POST snapshot download statistics: {:?}", e);
151+
println!("Could not increment snapshot download statistics: {:?}", e);
152152
}
153153

154154
let message = MessageBuilder::new()

examples/client-snapshot/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ In this example, the client interacts with a real aggregator on the network `tes
1111
- verify a certificate chain
1212
- compute a message for a Snapshot
1313
- verify that the certificate signs the computed message
14-
- increments download statistics
14+
- increments snapshot download statistics
1515

1616
The crate [indicatif](https://docs.rs/indicatif/latest/indicatif/) is used to nicely report the progress to the console.
1717

examples/client-snapshot/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ async fn main() -> MithrilResult<()> {
5656
.await?;
5757

5858
if let Err(e) = client.snapshot().add_statistics(&snapshot).await {
59-
println!("Could not POST snapshot download statistics: {:?}", e);
59+
println!("Could not increment snapshot download statistics: {:?}", e);
6060
}
6161

6262
println!("Computing snapshot '{}' message ...", snapshot.digest);

mithril-client-cli/src/commands/snapshot/download.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl SnapshotDownloadCommand {
210210
// The snapshot download does not fail if the statistic call fails.
211211
// It would be nice to implement tests to verify the behavior of `add_statistics`
212212
if let Err(e) = client.snapshot().add_statistics(snapshot_message).await {
213-
warn!("Could not POST snapshot download statistics: {e:?}");
213+
warn!("Could not increment snapshot download statistics: {e:?}");
214214
}
215215

216216
// Append 'clean' file to speedup node bootstrap

mithril-client/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* `mithril-client` defines all the tooling necessary to manipulate Mithril certified types available from a Mithril aggregator.
66

77
* The different types of available data certified by Mithril are:
8-
* Snapshot: list, get, download tarball and add statistics.
8+
* Snapshot: list, get, download tarball and record statistics.
99
* Mithril stake distribution: list and get.
1010
* Certificate: list, get, and chain validation.
1111

@@ -39,7 +39,7 @@ async fn main() -> mithril_client::MithrilResult<()> {
3939
.await?;
4040

4141
if let Err(e) = client.snapshot().add_statistics(&snapshot).await {
42-
println!("Could not POST snapshot download statistics: {:?}", e);
42+
println!("Could not increment snapshot download statistics: {:?}", e);
4343
}
4444

4545
let message = MessageBuilder::new()

mithril-client/src/aggregator_client.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ pub enum AggregatorRequest {
6969
/// Lists the aggregator [snapshots][crate::Snapshot]
7070
ListSnapshots,
7171

72-
/// Increments Aggregator's download statistics
73-
AddStatistics,
72+
/// Increments the aggregator snapshot download statistics
73+
IncrementSnapshotStatistic,
7474
}
7575

7676
impl AggregatorRequest {
@@ -91,7 +91,7 @@ impl AggregatorRequest {
9191
format!("artifact/snapshot/{}", digest)
9292
}
9393
AggregatorRequest::ListSnapshots => "artifact/snapshots".to_string(),
94-
AggregatorRequest::AddStatistics => "statistics/snapshot".to_string(),
94+
AggregatorRequest::IncrementSnapshotStatistic => "statistics/snapshot".to_string(),
9595
}
9696
}
9797
}
@@ -106,7 +106,7 @@ pub trait AggregatorClient: Sync + Send {
106106
request: AggregatorRequest,
107107
) -> Result<String, AggregatorClientError>;
108108

109-
/// Post information to the Aggregator, the URL is a relative path for a resource
109+
/// Post information to the Aggregator
110110
async fn post_content(
111111
&self,
112112
request: AggregatorRequest,

mithril-client/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
//! It handles the different types that can be queried to a Mithril aggregator:
88
//!
9-
//! - [Snapshot][snapshot_client] list, get, download tarball and add statistics.
9+
//! - [Snapshot][snapshot_client] list, get, download tarball and record statistics.
1010
//! - [Mithril stake distribution][mithril_stake_distribution_client] list and get.
1111
//! - [Certificates][certificate_client] list, get, and chain validation.
1212
//!
@@ -47,7 +47,7 @@
4747
//! .await?;
4848
//!
4949
//! if let Err(e) = client.snapshot().add_statistics(&snapshot).await {
50-
//! println!("Could not POST snapshot download statistics: {:?}", e);
50+
//! println!("Could not increment snapshot download statistics: {:?}", e);
5151
//! }
5252
//!
5353
//!

mithril-client/src/snapshot_client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
//! # Add statistics
6767
//! **Note:** _Available on crate feature_ **fs** _only._
6868
//!
69-
//! Increments Aggregator's download statistics using the [ClientBuilder][crate::client::ClientBuilder].
69+
//! Increments the aggregator snapshot download statistics using the [ClientBuilder][crate::client::ClientBuilder].
7070
//!
7171
//! ```no_run
7272
//! # async fn run() -> mithril_client::MithrilResult<()> {
@@ -239,12 +239,12 @@ impl SnapshotClient {
239239
}
240240
}
241241

242-
/// Increments Aggregator's download statistics
242+
/// Increments the aggregator snapshot download statistics
243243
pub async fn add_statistics(&self, snapshot: &Snapshot) -> MithrilResult<()> {
244244
let _response = self
245245
.aggregator_client
246246
.post_content(
247-
AggregatorRequest::AddStatistics,
247+
AggregatorRequest::IncrementSnapshotStatistic,
248248
&serde_json::to_string(snapshot)?,
249249
)
250250
.await?;

mithril-client/tests/extensions/fake.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ impl FakeAggregator {
4848
}
4949

5050
pub async fn store_call_and_return_value(
51-
_params: Vec<String>,
5251
full_path: FullPath,
5352
calls: FakeAggregatorCalls,
5453
returned_value: String,

mithril-client/tests/extensions/routes/certificate.rs

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,7 @@ fn certificate_certificates(
2626
.and(warp::path::full().map(move |p| p))
2727
.and(with_calls_middleware(calls.clone()))
2828
.and_then(move |fullpath, calls| {
29-
FakeAggregator::store_call_and_return_value(
30-
vec![],
31-
fullpath,
32-
calls,
33-
returned_value.clone(),
34-
)
29+
FakeAggregator::store_call_and_return_value(fullpath, calls, returned_value.clone())
3530
})
3631
}
3732

@@ -43,12 +38,7 @@ fn certificate_certificate_hash(
4338
warp::path!("certificate" / String)
4439
.and(warp::path::full().map(move |p| p))
4540
.and(with_calls_middleware(calls.clone()))
46-
.and_then(move |param, fullpath, calls| {
47-
FakeAggregator::store_call_and_return_value(
48-
vec![param],
49-
fullpath,
50-
calls,
51-
returned_value.clone(),
52-
)
41+
.and_then(move |_param, fullpath, calls| {
42+
FakeAggregator::store_call_and_return_value(fullpath, calls, returned_value.clone())
5343
})
5444
}

0 commit comments

Comments
 (0)