diff --git a/ircd/db.h b/ircd/db.h index 3d228e3dc..ed9c99df1 100644 --- a/ircd/db.h +++ b/ircd/db.h @@ -224,7 +224,9 @@ ircd::db::database::cache final #else Status Insert(const Slice &key, void *value, size_t charge, deleter, Handle **, Priority) noexcept override; #endif - #ifdef IRCD_DB_HAS_CACHE_ITEMHELPER + #if defined(IRCD_DB_HAS_CACHE_ASYNC) + Handle *Lookup(const Slice &key, const CacheItemHelper *, CreateContext *, Priority, Statistics *) noexcept override; + #elif defined(IRCD_DB_HAS_CACHE_ITEMHELPER) Handle *Lookup(const Slice &key, const CacheItemHelper *, CreateContext *, Priority, bool, Statistics *) noexcept override; #else Handle *Lookup(const Slice &key, Statistics *) noexcept override; @@ -263,6 +265,9 @@ ircd::db::database::cache final #ifdef IRCD_DB_HAS_CACHE_ITEMHELPER const CacheItemHelper *GetCacheItemHelper(Handle *) const noexcept override; #endif + #ifdef IRCD_DB_HAS_CACHE_ASYNC + Handle *CreateStandalone(const Slice &, ObjectPtr, const CacheItemHelper *, size_t, bool) noexcept override; + #endif cache(database *const &, std::shared_ptr, diff --git a/ircd/db_database.cc b/ircd/db_database.cc index 8e0a395c6..3a763fb48 100644 --- a/ircd/db_database.cc +++ b/ircd/db_database.cc @@ -3321,7 +3321,14 @@ noexcept return ret; } -#ifdef IRCD_DB_HAS_CACHE_ITEMHELPER +#if defined(IRCD_DB_HAS_CACHE_ASYNC) +rocksdb::Cache::Handle * +ircd::db::database::cache::Lookup(const Slice &key, + const CacheItemHelper *const helper, + CreateContext *const cc, + Priority pri, + Statistics *const statistics) +#elif defined(IRCD_DB_HAS_CACHE_ITEMHELPER) rocksdb::Cache::Handle * ircd::db::database::cache::Lookup(const Slice &key, const CacheItemHelper *const helper, @@ -3355,7 +3362,9 @@ noexcept auto *const &ret { - #ifdef IRCD_DB_HAS_CACHE_ITEMHELPER + #if defined(IRCD_DB_HAS_CACHE_ASYNC) + c->Lookup(key, helper, cc, pri, statistics) + #elif defined(IRCD_DB_HAS_CACHE_ITEMHELPER) c->Lookup(key, helper, cc, pri, wait, statistics) #else c->Lookup(key, s) @@ -3559,6 +3568,20 @@ const noexcept } #endif +#if defined(IRCD_DB_HAS_CACHE_ASYNC) +rocksdb::Cache::Handle * +ircd::db::database::cache::CreateStandalone(const Slice &key, + ObjectPtr ptr, + const CacheItemHelper *const helper, + size_t charge, + bool allow_uncharged) +noexcept +{ + assert(bool(c)); + return c->CreateStandalone(key, ptr, helper, charge, allow_uncharged); +} +#endif + /////////////////////////////////////////////////////////////////////////////// // // database::compaction_filter diff --git a/ircd/db_has.h b/ircd/db_has.h index a11826fbc..977561fd9 100644 --- a/ircd/db_has.h +++ b/ircd/db_has.h @@ -193,3 +193,9 @@ || (ROCKSDB_MAJOR == 8 && ROCKSDB_MINOR == 0 && ROCKSDB_PATCH >= 0) #define IRCD_DB_HAS_CACHE_WRAPPER #endif + +#if ROCKSDB_MAJOR > 8 \ +|| (ROCKSDB_MAJOR == 8 && ROCKSDB_MINOR > 1) \ +|| (ROCKSDB_MAJOR == 8 && ROCKSDB_MINOR == 1 && ROCKSDB_PATCH >= 1) + #define IRCD_DB_HAS_CACHE_ASYNC +#endif