File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ impl Transport {
349349 }
350350
351351 /// Creates a new instance of a [Transport] configured with a
352- /// [StaticNodeListConnectionPool]
352+ /// [MultiNodeConnectionPool] that does not refresh
353353 pub fn static_node_list ( urls : Vec < & str > ) -> Result < Transport , Error > {
354354 let urls: Vec < Url > = urls
355355 . iter ( )
@@ -360,6 +360,23 @@ impl Transport {
360360 Ok ( transport)
361361 }
362362
363+ /// Creates a new instance of a [Transport] configured with a
364+ /// [MultiNodeConnectionPool]
365+ ///
366+ /// * `reseed_frequency` - frequency at which connections should be refreshed in seconds
367+ pub fn sniffing_node_list (
368+ urls : Vec < & str > ,
369+ reseed_frequency : Duration ,
370+ ) -> Result < Transport , Error > {
371+ let urls: Vec < Url > = urls
372+ . iter ( )
373+ . map ( |url| Url :: parse ( url) )
374+ . collect :: < Result < Vec < _ > , _ > > ( ) ?;
375+ let conn_pool = MultiNodeConnectionPool :: round_robin ( urls, Some ( reseed_frequency) ) ;
376+ let transport = TransportBuilder :: new ( conn_pool) . build ( ) ?;
377+ Ok ( transport)
378+ }
379+
363380 /// Creates a new instance of a [Transport] configured for use with
364381 /// [Elasticsearch service in Elastic Cloud](https://www.elastic.co/cloud/).
365382 ///
You can’t perform that action at this time.
0 commit comments