Skip to content

Commit 4075171

Browse files
authored
Merge pull request #2738 from input-output-hk/djo/2640/deprecate_client_lib_aggregator_client
chore(client-lib): deprecate current aggregator client and related builder functions
2 parents 69c9769 + d60bb5e commit 4075171

9 files changed

+35
-14
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.

mithril-client/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "mithril-client"
3-
version = "0.12.32"
3+
version = "0.12.33"
44
description = "Mithril client library"
55
authors = { workspace = true }
66
edition = { workspace = true }

mithril-client/src/client.rs

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ impl ClientBuilder {
204204
///
205205
/// Use [ClientBuilder::aggregator] if you don't need to set a custom [AggregatorClient]
206206
/// to request data from the aggregator.
207+
#[deprecated(since = "0.12.33", note = "Will be removed in 0.13.0")]
207208
pub fn new(genesis_verification_key: &str) -> ClientBuilder {
208209
Self {
209210
aggregator_endpoint: None,
@@ -382,6 +383,7 @@ impl ClientBuilder {
382383
}
383384

384385
/// Set the [AggregatorClient] that will be used to request data to the aggregator.
386+
#[deprecated(since = "0.12.33", note = "Will be removed in 0.13.0")]
385387
pub fn with_aggregator_client(
386388
mut self,
387389
aggregator_client: Arc<dyn AggregatorClient>,
@@ -485,7 +487,7 @@ mod tests {
485487
#[tokio::test]
486488
async fn compute_http_headers_returns_options_http_headers() {
487489
let http_headers = default_headers();
488-
let client_builder = ClientBuilder::new("").with_options(ClientOptions {
490+
let client_builder = ClientBuilder::aggregator("", "").with_options(ClientOptions {
489491
http_headers: Some(http_headers.clone()),
490492
});
491493

@@ -497,7 +499,7 @@ mod tests {
497499
#[tokio::test]
498500
async fn compute_http_headers_with_origin_tag_returns_options_http_headers_with_origin_tag() {
499501
let http_headers = default_headers();
500-
let client_builder = ClientBuilder::new("")
502+
let client_builder = ClientBuilder::aggregator("", "")
501503
.with_options(ClientOptions {
502504
http_headers: Some(http_headers.clone()),
503505
})
@@ -514,14 +516,14 @@ mod tests {
514516

515517
#[tokio::test]
516518
async fn test_with_origin_tag_not_overwrite_other_client_options_attributes() {
517-
let builder = ClientBuilder::new("")
519+
let builder = ClientBuilder::aggregator("", "")
518520
.with_options(ClientOptions { http_headers: None })
519521
.with_origin_tag(Some("TEST".to_string()));
520522
assert_eq!(None, builder.options.http_headers);
521523
assert_eq!(Some("TEST".to_string()), builder.origin_tag);
522524

523525
let http_headers = HashMap::from([("Key".to_string(), "Value".to_string())]);
524-
let builder = ClientBuilder::new("")
526+
let builder = ClientBuilder::aggregator("", "")
525527
.with_options(ClientOptions {
526528
http_headers: Some(http_headers.clone()),
527529
})
@@ -536,7 +538,7 @@ mod tests {
536538
let client_options = ClientOptions {
537539
http_headers: Some(http_headers.clone()),
538540
};
539-
let builder = ClientBuilder::new("")
541+
let builder = ClientBuilder::aggregator("", "")
540542
.with_options(client_options)
541543
.with_origin_tag(None);
542544

@@ -547,7 +549,7 @@ mod tests {
547549
#[tokio::test]
548550
async fn compute_http_headers_with_client_type_returns_options_http_headers_with_client_type() {
549551
let http_headers = HashMap::from([("Key".to_string(), "Value".to_string())]);
550-
let client_builder = ClientBuilder::new("")
552+
let client_builder = ClientBuilder::aggregator("", "")
551553
.with_options(ClientOptions {
552554
http_headers: Some(http_headers.clone()),
553555
})
@@ -573,7 +575,7 @@ mod tests {
573575
MITHRIL_CLIENT_TYPE_HEADER.to_string(),
574576
"client type from options".to_string(),
575577
)]);
576-
let client_builder = ClientBuilder::new("").with_options(ClientOptions {
578+
let client_builder = ClientBuilder::aggregator("", "").with_options(ClientOptions {
577579
http_headers: Some(http_headers.clone()),
578580
});
579581

@@ -584,14 +586,14 @@ mod tests {
584586

585587
#[tokio::test]
586588
async fn test_with_client_type_not_overwrite_other_client_options_attributes() {
587-
let builder = ClientBuilder::new("")
589+
let builder = ClientBuilder::aggregator("", "")
588590
.with_options(ClientOptions { http_headers: None })
589591
.with_client_type(Some("TEST".to_string()));
590592
assert_eq!(None, builder.options.http_headers);
591593
assert_eq!(Some("TEST".to_string()), builder.client_type);
592594

593595
let http_headers = HashMap::from([("Key".to_string(), "Value".to_string())]);
594-
let builder = ClientBuilder::new("")
596+
let builder = ClientBuilder::aggregator("", "")
595597
.with_options(ClientOptions {
596598
http_headers: Some(http_headers.clone()),
597599
})
@@ -603,7 +605,7 @@ mod tests {
603605
#[tokio::test]
604606
async fn test_given_a_none_client_type_compute_http_headers_will_set_client_type_to_default_value()
605607
{
606-
let builder_without_client_type = ClientBuilder::new("");
608+
let builder_without_client_type = ClientBuilder::aggregator("", "");
607609
let computed_headers = builder_without_client_type.compute_http_headers();
608610

609611
assert_eq!(
@@ -614,7 +616,8 @@ mod tests {
614616
)])
615617
);
616618

617-
let builder_with_none_client_type = ClientBuilder::new("").with_client_type(None);
619+
let builder_with_none_client_type =
620+
ClientBuilder::aggregator("", "").with_client_type(None);
618621
let computed_headers = builder_with_none_client_type.compute_http_headers();
619622

620623
assert_eq!(
@@ -633,7 +636,7 @@ mod tests {
633636
MITHRIL_CLIENT_TYPE_HEADER.to_string(),
634637
"client type from options".to_string(),
635638
)]);
636-
let client_builder = ClientBuilder::new("")
639+
let client_builder = ClientBuilder::aggregator("", "")
637640
.with_options(ClientOptions {
638641
http_headers: Some(http_headers.clone()),
639642
})

mithril-client/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![warn(missing_docs)]
22
#![cfg_attr(docsrs, feature(doc_cfg))]
3+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
4+
#![allow(deprecated)]
35

46
//! Define all the tooling necessary to manipulate Mithril certified types from a
57
//! [Mithril Aggregator](https://mithril.network/rust-doc/mithril_aggregator/index.html).
@@ -120,6 +122,7 @@ macro_rules! cfg_fs_unstable {
120122
}
121123
}
122124

125+
#[deprecated(since = "0.12.33", note = "Will be removed soon")]
123126
pub mod aggregator_client;
124127
pub mod cardano_database_client;
125128
pub mod cardano_stake_distribution_client;

mithril-client/tests/cardano_db_snapshot_list_get_download_verify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
2+
#![allow(deprecated)]
3+
14
mod extensions;
25

36
use std::sync::Arc;

mithril-client/tests/cardano_transaction_proof.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
2+
#![allow(deprecated)]
3+
14
mod extensions;
25

36
use mithril_client::{ClientBuilder, MessageBuilder, aggregator_client::AggregatorRequest};

mithril-client/tests/certificate_get_list.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
2+
#![allow(deprecated)]
3+
14
mod extensions;
25

36
use mithril_client::{ClientBuilder, aggregator_client::AggregatorRequest};

mithril-client/tests/mithril_stake_distribution_list_get_show_verify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
2+
#![allow(deprecated)]
3+
14
mod extensions;
25

36
use mithril_client::{ClientBuilder, MessageBuilder, aggregator_client::AggregatorRequest};

mithril-client/tests/snapshot_list_get_show_download_verify.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// TODO: Remove this allow once migration from deprecated AggregatorClient types is complete
2+
#![allow(deprecated)]
3+
14
mod extensions;
25

36
use std::sync::Arc;

0 commit comments

Comments
 (0)