Thrift Pool
This library provides a simple way implement bb8
and/or r2d2 Connection Pools
for any TThriftClient
Documenation
-
This library is primarily documented on its docs.rs page
-
Here is a quick example
use ;
use ;
use ;
// A typical generated client
// implement this trait so that `MakeThriftConnectionFromAddrs` can create it
// implement this trait so that `ThriftConnectionManager` can manage it
// the actual connection type
type Client = ;
// this works because we implemented FromProtocol for the client
// AND
// because the `Protocol` and `Transport` types used here satisfy the contraints
let manager = new;
// this works because we implemented ThriftConnection for the client
let pool = builder.build?;
// this also works after enabling the `impl-bb8` feature
let pool = builder.build.await?;
// the pool can be used just like in r2d2/bb8 documentation
let mut client = pool.get?;
Examples
- hbase-thrift: the project from which this library was extracted. implements Connection Pools for the client generated from the HBase Thrift Spec
- thrift-pool-tutorial: implements Connection Pools for the client used in the official thrift tutorial