Skip to content

Commit 38a8b45

Browse files
chore: reduce public APIs
1 parent df7b557 commit 38a8b45

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

ic-agent/src/agent/http_transport/dynamic_routing/health_check.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,12 @@ impl HealthCheckActor {
157157
}
158158

159159
/// The name of the health manager actor.
160-
pub const HEALTH_MANAGER_ACTOR: &str = "HealthManagerActor";
160+
pub(super) const HEALTH_MANAGER_ACTOR: &str = "HealthManagerActor";
161161

162162
/// A struct managing the health checks of the nodes.
163163
/// It receives the fetched nodes from the `NodesFetchActor` and starts the health checks for them.
164164
/// It also receives the health status of the nodes from the `HealthCheckActor/s` and updates the routing snapshot.
165-
pub struct HealthManagerActor<S> {
165+
pub(super) struct HealthManagerActor<S> {
166166
/// The health checker.
167167
checker: Arc<dyn HealthCheck>,
168168
/// The period of the health check.

ic-agent/src/agent/http_transport/dynamic_routing/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@ pub mod dynamic_route_provider;
33
/// Health check implementation.
44
pub mod health_check;
55
/// Messages used in dynamic routing.
6-
pub mod messages;
6+
pub(super) mod messages;
77
/// Node implementation.
88
pub mod node;
99
/// Nodes fetch implementation.
1010
pub mod nodes_fetch;
1111
/// Routing snapshot implementation.
1212
pub mod snapshot;
1313
#[cfg(test)]
14-
pub mod test_utils;
14+
pub(super) mod test_utils;
1515
/// Type aliases used in dynamic routing.
16-
pub mod type_aliases;
16+
pub(super) mod type_aliases;

ic-agent/src/agent/http_transport/dynamic_routing/node.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use url::Url;
22

3-
use crate::agent::ApiBoundaryNode;
4-
5-
use super::dynamic_route_provider::DynamicRouteProviderError;
3+
use crate::agent::{
4+
http_transport::dynamic_routing::dynamic_route_provider::DynamicRouteProviderError,
5+
ApiBoundaryNode,
6+
};
67

78
/// Represents a node in the dynamic routing.
89
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
@@ -52,7 +53,7 @@ impl TryFrom<&ApiBoundaryNode> for Node {
5253
}
5354

5455
/// Checks if the given domain is a valid URL.
55-
pub fn is_valid_domain<S: AsRef<str>>(domain: S) -> bool {
56+
fn is_valid_domain<S: AsRef<str>>(domain: S) -> bool {
5657
// Prepend scheme to make it a valid URL
5758
let url_string = format!("http://{}", domain.as_ref());
5859
Url::parse(&url_string).is_ok()

ic-agent/src/agent/http_transport/dynamic_routing/nodes_fetch.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl Fetch for NodesFetcher {
8383
}
8484

8585
/// A struct representing the actor responsible for fetching existing nodes and communicating it with the listener.
86-
pub struct NodesFetchActor<S> {
86+
pub(super) struct NodesFetchActor<S> {
8787
/// The fetcher object responsible for fetching the nodes.
8888
fetcher: Arc<dyn Fetch>,
8989
/// Time period between fetches.

ic-agent/src/agent/http_transport/dynamic_routing/test_utils.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,17 @@ use crate::agent::http_transport::{
1717
route_provider::RouteProvider,
1818
};
1919

20-
pub fn route_n_times(n: usize, f: Arc<impl RouteProvider + ?Sized>) -> Vec<String> {
20+
pub(super) fn route_n_times(n: usize, f: Arc<impl RouteProvider + ?Sized>) -> Vec<String> {
2121
(0..n)
2222
.map(|_| f.route().unwrap().domain().unwrap().to_string())
2323
.collect()
2424
}
2525

26-
pub fn assert_routed_domains<T>(actual: Vec<T>, expected: Vec<T>, expected_repetitions: usize)
27-
where
26+
pub(super) fn assert_routed_domains<T>(
27+
actual: Vec<T>,
28+
expected: Vec<T>,
29+
expected_repetitions: usize,
30+
) where
2831
T: AsRef<str> + Eq + Hash + Debug + Ord,
2932
{
3033
fn build_count_map<T>(items: &[T]) -> HashMap<&T, usize>
@@ -54,7 +57,7 @@ where
5457
}
5558

5659
#[derive(Debug)]
57-
pub struct NodesFetcherMock {
60+
pub(super) struct NodesFetcherMock {
5861
// A set of nodes, existing in the topology.
5962
pub nodes: AtomicSwap<Vec<Node>>,
6063
}
@@ -86,7 +89,7 @@ impl NodesFetcherMock {
8689
}
8790

8891
#[derive(Debug)]
89-
pub struct NodeHealthCheckerMock {
92+
pub(super) struct NodeHealthCheckerMock {
9093
healthy_nodes: Arc<ArcSwap<HashSet<Node>>>,
9194
}
9295

ic-agent/src/agent/http_transport/dynamic_routing/type_aliases.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ use std::sync::Arc;
33
use tokio::sync::{mpsc, watch};
44

55
/// A type alias for the sender end of a watch channel.
6-
pub type SenderWatch<T> = watch::Sender<Option<T>>;
6+
pub(super) type SenderWatch<T> = watch::Sender<Option<T>>;
77

88
/// A type alias for the receiver end of a watch channel.
9-
pub type ReceiverWatch<T> = watch::Receiver<Option<T>>;
9+
pub(super) type ReceiverWatch<T> = watch::Receiver<Option<T>>;
1010

1111
/// A type alias for the sender end of a multi-producer, single-consumer channel.
12-
pub type SenderMpsc<T> = mpsc::Sender<T>;
12+
pub(super) type SenderMpsc<T> = mpsc::Sender<T>;
1313

1414
/// A type alias for the receiver end of a multi-producer, single-consumer channel.
15-
pub type ReceiverMpsc<T> = mpsc::Receiver<T>;
15+
pub(super) type ReceiverMpsc<T> = mpsc::Receiver<T>;
1616

1717
/// A type alias for an atomic swap operation on a shared value.
18-
pub type AtomicSwap<T> = Arc<ArcSwap<T>>;
18+
pub(super) type AtomicSwap<T> = Arc<ArcSwap<T>>;

0 commit comments

Comments
 (0)