0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-05-28 15:53:46 +02:00

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 #else
Status Insert(const Slice &key, void *value, size_t charge, deleter, Handle **, Priority) noexcept override; Status Insert(const Slice &key, void *value, size_t charge, deleter, Handle **, Priority) noexcept override;
#endif #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; Handle *Lookup(const Slice &key, const CacheItemHelper *, CreateContext *, Priority, bool, Statistics *) noexcept override;
#else #else
Handle *Lookup(const Slice &key, Statistics *) noexcept override; Handle *Lookup(const Slice &key, Statistics *) noexcept override;
@ -263,6 +265,9 @@ ircd::db::database::cache final
#ifdef IRCD_DB_HAS_CACHE_ITEMHELPER #ifdef IRCD_DB_HAS_CACHE_ITEMHELPER
const CacheItemHelper *GetCacheItemHelper(Handle *) const noexcept override; const CacheItemHelper *GetCacheItemHelper(Handle *) const noexcept override;
#endif #endif
#ifdef IRCD_DB_HAS_CACHE_ASYNC
Handle *CreateStandalone(const Slice &, ObjectPtr, const CacheItemHelper *, size_t, bool) noexcept override;
#endif
cache(database *const &, cache(database *const &,
std::shared_ptr<struct database::stats>, std::shared_ptr<struct database::stats>,

View file

@ -3321,7 +3321,14 @@ noexcept
return ret; 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 * rocksdb::Cache::Handle *
ircd::db::database::cache::Lookup(const Slice &key, ircd::db::database::cache::Lookup(const Slice &key,
const CacheItemHelper *const helper, const CacheItemHelper *const helper,
@ -3355,7 +3362,9 @@ noexcept
auto *const &ret 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) c->Lookup(key, helper, cc, pri, wait, statistics)
#else #else
c->Lookup(key, s) c->Lookup(key, s)
@ -3559,6 +3568,20 @@ const noexcept
} }
#endif #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 // database::compaction_filter

View file

@ -193,3 +193,9 @@
|| (ROCKSDB_MAJOR == 8 && ROCKSDB_MINOR == 0 && ROCKSDB_PATCH >= 0) || (ROCKSDB_MAJOR == 8 && ROCKSDB_MINOR == 0 && ROCKSDB_PATCH >= 0)
#define IRCD_DB_HAS_CACHE_WRAPPER #define IRCD_DB_HAS_CACHE_WRAPPER
#endif #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