File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,14 @@ impl NodeConnectionPool {
200200        } 
201201    } 
202202
203+     pub  fn  sharder ( & self )  -> Option < Sharder >  { 
204+         self . with_connections ( |pool_conns| match  pool_conns { 
205+             PoolConnections :: NotSharded ( _)  => None , 
206+             PoolConnections :: Sharded  {  sharder,  .. }  => Some ( sharder. clone ( ) ) , 
207+         } ) 
208+         . unwrap_or ( None ) 
209+     } 
210+ 
203211    pub  fn  connection_for_token ( & self ,  token :  Token )  -> Result < Arc < Connection > ,  QueryError >  { 
204212        trace ! ( token = token. value,  "Selecting connection for token" ) ; 
205213        self . with_connections ( |pool_conns| match  pool_conns { 
Original file line number Diff line number Diff line change 11/// Node represents a cluster node along with it's data and connections 
2- use  crate :: routing:: Token ; 
2+ use  crate :: routing:: { Sharder ,   Token } ; 
33use  crate :: transport:: connection:: Connection ; 
44use  crate :: transport:: connection:: VerifiedKeyspaceName ; 
55use  crate :: transport:: connection_pool:: { NodeConnectionPool ,  PoolConfig } ; 
@@ -53,6 +53,10 @@ impl Node {
5353        } 
5454    } 
5555
56+     pub  fn  sharder ( & self )  -> Option < Sharder >  { 
57+         self . pool . sharder ( ) 
58+     } 
59+ 
5660    /// Get connection which should be used to connect using given token 
5761     /// If this connection is broken get any random connection to this Node 
5862     pub ( crate )  async  fn  connection_for_token ( 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments