From 7cd34cba0ad2784643e1a51320154db16d12a30d Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Wed, 15 Sep 2021 00:02:26 -0700 Subject: [PATCH] ircd::db: API fixes for RocksDB v6.22+. --- ircd/db.h | 7 +++++++ ircd/db_database.cc | 21 +++++++++++++++++++++ ircd/db_has.h | 12 ++++++++++++ 3 files changed, 40 insertions(+) diff --git a/ircd/db.h b/ircd/db.h index aa95d0dea..974e227d3 100644 --- a/ircd/db.h +++ b/ircd/db.h @@ -224,6 +224,13 @@ ircd::db::database::cache final #ifdef IRCD_DB_HAS_CACHE_GETCHARGE size_t GetCharge(Handle *) const noexcept override; #endif + #ifdef IRCD_DB_HAS_CACHE_GETDELETER + DeleterFn GetDeleter(Handle *) const noexcept override; + #endif + #ifdef IRCD_DB_HAS_CACHE_APPLYTOALL + using callbackstd = std::function; + void ApplyToAllEntries(const callbackstd &, const ApplyToAllEntriesOptions &) noexcept override; + #endif cache(database *const &, std::shared_ptr, diff --git a/ircd/db_database.cc b/ircd/db_database.cc index 41864430e..bf93f41bd 100644 --- a/ircd/db_database.cc +++ b/ircd/db_database.cc @@ -3241,6 +3241,27 @@ const noexcept } #endif +#ifdef IRCD_DB_HAS_CACHE_GETDELETER +rocksdb::Cache::DeleterFn +ircd::db::database::cache::GetDeleter(Handle *const h) +const noexcept +{ + assert(bool(c)); + return c->GetDeleter(h); +} +#endif + +#ifdef IRCD_DB_HAS_CACHE_APPLYTOALL +void +ircd::db::database::cache::ApplyToAllEntries(const callbackstd &cb, + const ApplyToAllEntriesOptions &opts) +noexcept +{ + assert(bool(c)); + return c->ApplyToAllEntries(cb, opts); +} +#endif + /////////////////////////////////////////////////////////////////////////////// // // database::compaction_filter diff --git a/ircd/db_has.h b/ircd/db_has.h index b474d66af..30b15a518 100644 --- a/ircd/db_has.h +++ b/ircd/db_has.h @@ -72,3 +72,15 @@ || (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 10 && ROCKSDB_PATCH >= 0) #define IRCD_DB_HAS_MULTIGET_DIRECT #endif + +#if ROCKSDB_MAJOR > 6 \ +|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 22) \ +|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 22 && ROCKSDB_PATCH >= 1) + #define IRCD_DB_HAS_CACHE_GETDELETER +#endif + +#if ROCKSDB_MAJOR > 6 \ +|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR > 22) \ +|| (ROCKSDB_MAJOR == 6 && ROCKSDB_MINOR == 22 && ROCKSDB_PATCH >= 1) + #define IRCD_DB_HAS_CACHE_APPLYTOALL +#endif