@@ -27,7 +27,7 @@ use tracing::{debug, warn};
2727use uuid:: Uuid ;
2828
2929use super :: locator:: tablets:: { RawTablet , Tablet , TabletsInfo } ;
30- use super :: node:: { KnownNode , NodeAddr } ;
30+ use super :: node:: { InternalKnownNode , NodeAddr } ;
3131use super :: NodeRef ;
3232
3333use super :: locator:: ReplicaLocator ;
@@ -59,12 +59,6 @@ impl<'a> std::fmt::Debug for ClusterNeatDebug<'a> {
5959 }
6060}
6161
62- #[ derive( Clone , Debug ) ]
63- pub struct Datacenter {
64- pub nodes : Vec < Arc < Node > > ,
65- pub rack_count : usize ,
66- }
67-
6862#[ derive( Clone ) ]
6963pub struct ClusterData {
7064 pub ( crate ) known_peers : HashMap < Uuid , Arc < Node > > , // Invariant: nonempty after Cluster::new()
@@ -145,7 +139,7 @@ struct UseKeyspaceRequest {
145139
146140impl Cluster {
147141 pub ( crate ) async fn new (
148- known_nodes : Vec < KnownNode > ,
142+ known_nodes : Vec < InternalKnownNode > ,
149143 pool_config : PoolConfig ,
150144 keyspaces_to_fetch : Vec < String > ,
151145 fetch_schema_metadata : bool ,
@@ -257,18 +251,6 @@ impl Cluster {
257251}
258252
259253impl ClusterData {
260- // Updates information about rack count in each datacenter
261- fn update_rack_count ( datacenters : & mut HashMap < String , Datacenter > ) {
262- for datacenter in datacenters. values_mut ( ) {
263- datacenter. rack_count = datacenter
264- . nodes
265- . iter ( )
266- . filter_map ( |node| node. rack . as_ref ( ) )
267- . unique ( )
268- . count ( ) ;
269- }
270- }
271-
272254 pub ( crate ) async fn wait_until_all_pools_are_initialized ( & self ) {
273255 for node in self . locator . unique_nodes_in_global_ring ( ) . iter ( ) {
274256 node. wait_until_pool_initialized ( ) . await ;
@@ -289,7 +271,6 @@ impl ClusterData {
289271 let mut new_known_peers: HashMap < Uuid , Arc < Node > > =
290272 HashMap :: with_capacity ( metadata. peers . len ( ) ) ;
291273 let mut ring: Vec < ( Token , Arc < Node > ) > = Vec :: new ( ) ;
292- let mut datacenters: HashMap < String , Datacenter > = HashMap :: new ( ) ;
293274
294275 for peer in metadata. peers {
295276 // Take existing Arc<Node> if possible, otherwise create new one
@@ -325,19 +306,6 @@ impl ClusterData {
325306
326307 new_known_peers. insert ( peer_host_id, node. clone ( ) ) ;
327308
328- if let Some ( dc) = & node. datacenter {
329- match datacenters. get_mut ( dc) {
330- Some ( v) => v. nodes . push ( node. clone ( ) ) ,
331- None => {
332- let v = Datacenter {
333- nodes : vec ! [ node. clone( ) ] ,
334- rack_count : 0 ,
335- } ;
336- datacenters. insert ( dc. clone ( ) , v) ;
337- }
338- }
339- }
340-
341309 for token in peer_tokens {
342310 ring. push ( ( token, node. clone ( ) ) ) ;
343311 }
@@ -384,8 +352,6 @@ impl ClusterData {
384352 )
385353 }
386354
387- Self :: update_rack_count ( & mut datacenters) ;
388-
389355 let keyspaces = metadata. keyspaces ;
390356 let ( locator, keyspaces) = tokio:: task:: spawn_blocking ( move || {
391357 let keyspace_strategies = keyspaces. values ( ) . map ( |ks| & ks. strategy ) ;
@@ -409,25 +375,6 @@ impl ClusterData {
409375 & self . keyspaces
410376 }
411377
412- /// Access datacenter details collected by the driver
413- /// Returned `HashMap` is indexed by names of datacenters
414- pub fn get_datacenters_info ( & self ) -> HashMap < String , Datacenter > {
415- self . locator
416- . datacenter_names ( )
417- . iter ( )
418- . map ( |dc_name| {
419- let nodes = self
420- . locator
421- . unique_nodes_in_datacenter_ring ( dc_name)
422- . unwrap ( )
423- . to_vec ( ) ;
424- let rack_count = nodes. iter ( ) . map ( |node| node. rack . as_ref ( ) ) . unique ( ) . count ( ) ;
425-
426- ( dc_name. clone ( ) , Datacenter { nodes, rack_count } )
427- } )
428- . collect ( )
429- }
430-
431378 /// Access details about nodes known to the driver
432379 pub fn get_nodes_info ( & self ) -> & [ Arc < Node > ] {
433380 self . locator . unique_nodes_in_global_ring ( )
0 commit comments