ircd::db: Fixes for RocksDB 8.1.1 interface changes.

This commit is contained in:
Jason Volk 2023-04-28 13:38:38 -07:00
parent f86fddc3a3
commit 8a705f77a9
3 changed files with 37 additions and 3 deletions

View File

@ -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<struct database::stats>,

View File

@ -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

View File

@ -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