Migrate the Rust Cachelib bindings to CXX

Summary:
These are undermaintained, and need an update for oncall support. Start by moving to CXX, which makes maintenance easier.

In the process, I've fixed a couple of oddities in the API that were either due to the age of the code, or due to misunderstandings propagating through bindgen that CXX blocks, and fixed up the users of those APIs.

Reviewed By: dtolnay

Differential Revision: D28264737

fbshipit-source-id: d18c3fc5bfce280bd69ea2a5205242607ef23f28
This commit is contained in:
Simon Farnsworth 2021-05-07 12:22:58 -07:00 committed by Facebook GitHub Bot
parent 23cbacd701
commit bef3319996
3 changed files with 3 additions and 3 deletions

View File

@ -248,7 +248,7 @@ blobstore_test_impl! {
#[cfg(fbcode_build)]
fn create_cache(fb: FacebookInit) -> Result<(), Error> {
let config = cachelib::LruCacheConfig::new(128 * 1024 * 1024);
cachelib::init_cache_once(fb, config)?;
cachelib::init_cache(fb, config)?;
Ok(())
}

View File

@ -524,7 +524,7 @@ mod test {
static INSTANCE: OnceCell<()> = OnceCell::new();
INSTANCE.get_or_init(|| {
let config = cachelib::LruCacheConfig::new(64 * 1024 * 1024);
cachelib::init_cache_once(fb, config).unwrap();
cachelib::init_cache(fb, config).unwrap();
});
let blob_pool = cachelib::get_or_create_volatile_pool(blob_pool_name, 8 * 1024 * 1024)?;

View File

@ -244,7 +244,7 @@ async fn get_blob<'a>(
#[cfg(fbcode_build)]
{
let cache_size_bytes = size.parse()?;
cachelib::init_cache_once(fb, cachelib::LruCacheConfig::new(cache_size_bytes))?;
cachelib::init_cache(fb, cachelib::LruCacheConfig::new(cache_size_bytes))?;
let presence_pool = cachelib::get_or_create_pool(
"presence",