File tree 1 file changed +18
-1
lines changed
1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -349,7 +349,7 @@ impl Transport {
349
349
}
350
350
351
351
/// Creates a new instance of a [Transport] configured with a
352
- /// [StaticNodeListConnectionPool]
352
+ /// [MultiNodeConnectionPool] that does not refresh
353
353
pub fn static_node_list ( urls : Vec < & str > ) -> Result < Transport , Error > {
354
354
let urls: Vec < Url > = urls
355
355
. iter ( )
@@ -360,6 +360,23 @@ impl Transport {
360
360
Ok ( transport)
361
361
}
362
362
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
+
363
380
/// Creates a new instance of a [Transport] configured for use with
364
381
/// [Elasticsearch service in Elastic Cloud](https://www.elastic.co/cloud/).
365
382
///
You can’t perform that action at this time.
0 commit comments