Module ydb_unofficial::pool
source · Available on crate feature
pool
only.Expand description
Implementation of pool of YdbConnection
.
Uses method list_endpoints
of DiscoveryServiceClient
to create pool on multiple endpoints
§Examples
let db_name = std::env::var("DB_NAME").expect("DB_NAME not set");
let creds = std::env::var("DB_TOKEN").expect("DB_TOKEN not set");
let ep = ydb_unofficial::client::YdbEndpoint {ssl: true, host: "ydb.serverless.yandexcloud.net".to_owned(), port: 2135, load_factor: 0.0};
let pool = ydb_unofficial::pool::YdbPoolBuilder::new(creds, db_name.try_into().unwrap(), ep).build().unwrap();
let mut conn = pool.get().await.unwrap();
let mut table_client = conn.table();
//do something...
let mut conn2 = pool.get().await.unwrap();
//do another staff
pool.close();
Structs§
- Builder for pool of
YdbConnection