chengxilo commented on code in PR #3923:
URL: https://github.com/apache/iggy/pull/3923#discussion_r3858812320


##########
core/configs/src/server_config/cluster.rs:
##########
@@ -473,49 +474,80 @@ pub struct AdvertisedAddressSelector {
 /// once, built wherever a roster is assembled for serving clients
 /// (listener/shard start). Per-request resolution never re-parses config
 /// strings: everything is snapshotted here, so mutating the source config
-/// after conversion has no effect on what clients are told. Entries that do
-/// not parse are dropped at build time; validation already rejects them
-/// whenever the cluster is enabled, and a disabled cluster never consults
-/// the roster.
+/// after conversion has no effect on what clients are told.
 #[derive(Debug, Clone)]
 pub struct ResolvedClusterNode {
     config: ClusterNodeConfig,
     /// Truncated, canonicalized selector networks with their parsed
     /// addresses, in declaration order.
     selectors: Vec<(IpNet, AdvertisedAddress)>,
     /// Parsed catch-all: [`ClusterNodeConfig::advertised_address`], else the
-    /// roster [`ClusterNodeConfig::ip`]. `None` when the configured value
-    /// does not parse - a set `advertised_address` never falls through to
-    /// the private roster ip.
-    catch_all: Option<AdvertisedAddress>,
+    /// roster [`ClusterNodeConfig::ip`]. A set `advertised_address` never
+    /// falls through to the private roster ip.
+    catch_all: AdvertisedAddress,
     /// Parsed roster [`ClusterNodeConfig::ip`], the replica-plane dial
-    /// address. `None` when the roster ip is not a literal IP (boot only
-    /// requires it non-empty); internal forwarding then has no dial target.
-    replica_ip: Option<IpAddr>,
+    /// address.
+    replica_ip: IpAddr,
 }
 
-impl From<ClusterNodeConfig> for ResolvedClusterNode {
-    fn from(config: ClusterNodeConfig) -> Self {
-        let selectors = config
-            .advertised_addresses
-            .iter()
-            .filter_map(|selector| {
-                let network = selector.client_cidr.parse::<IpNet>().ok()?;
-                let address = 
selector.address.parse::<AdvertisedAddress>().ok()?;
-                Some((canonical_ip_net(network.trunc()), address))
-            })
-            .collect();
-        let catch_all = match config.advertised_address.as_deref() {
-            Some(advertised_address) => advertised_address.parse().ok(),
-            None => config.ip.parse().ok(),
-        };
-        let replica_ip = config.ip.parse().ok();
-        Self {
+impl TryFrom<ClusterNodeConfig> for ResolvedClusterNode {

Review Comment:
   Now it would call `is_unspecified` to check. Should be ok now.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to