mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 08:18:15 +03:00
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:
parent
23cbacd701
commit
bef3319996
@ -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(())
|
||||
}
|
||||
|
||||
|
@ -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)?;
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user