tool_hooks.cc 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // Copyright (c) Meta Platforms, Inc. and affiliates. All rights reserved.
  2. // This source code is licensed under both the GPLv2 (found in the
  3. // COPYING file in the root directory) and Apache 2.0 License
  4. // (found in the LICENSE.Apache file in the root directory).
  5. #include "rocksdb/tool_hooks.h"
  6. #include "rocksdb/convenience.h"
  7. #include "rocksdb/db.h"
  8. #include "rocksdb/options.h"
  9. #include "rocksdb/utilities/optimistic_transaction_db.h"
  10. #include "rocksdb/utilities/options_type.h"
  11. #include "rocksdb/utilities/transaction_db.h"
  12. #include "utilities/blob_db/blob_db.h"
  13. namespace ROCKSDB_NAMESPACE {
  14. Status DefaultHooks::Open(const Options& db_options, const std::string& name,
  15. DB** dbptr) {
  16. return DB::Open(db_options, name, dbptr);
  17. };
  18. Status DefaultHooks::Open(
  19. const DBOptions& db_options, const std::string& name,
  20. const std::vector<ColumnFamilyDescriptor>& column_families,
  21. std::vector<ColumnFamilyHandle*>* handles, DB** dbptr) {
  22. return DB::Open(db_options, name, column_families, handles, dbptr);
  23. };
  24. Status DefaultHooks::OpenForReadOnly(const Options& options,
  25. const std::string& name, DB** dbptr,
  26. bool error_if_wal_file_exists = false) {
  27. return DB::OpenForReadOnly(options, name, dbptr, error_if_wal_file_exists);
  28. };
  29. Status DefaultHooks::OpenForReadOnly(
  30. const Options& options, const std::string& name,
  31. const std::vector<ColumnFamilyDescriptor>& column_families,
  32. std::vector<ColumnFamilyHandle*>* handles, DB** dbptr) {
  33. return DB::OpenForReadOnly(options, name, column_families, handles, dbptr);
  34. };
  35. Status DefaultHooks::OpenTransactionDB(
  36. const Options& db_options, const TransactionDBOptions& txn_db_options,
  37. const std::string& dbname, TransactionDB** dbptr) {
  38. return TransactionDB::Open(db_options, txn_db_options, dbname, dbptr);
  39. };
  40. Status DefaultHooks::OpenTransactionDB(
  41. const DBOptions& db_options, const TransactionDBOptions& txn_db_options,
  42. const std::string& dbname,
  43. const std::vector<ColumnFamilyDescriptor>& column_families,
  44. std::vector<ColumnFamilyHandle*>* handles, TransactionDB** dbptr) {
  45. return TransactionDB::Open(db_options, txn_db_options, dbname,
  46. column_families, handles, dbptr);
  47. };
  48. Status DefaultHooks::OpenOptimisticTransactionDB(
  49. const Options& options, const std::string& dbname,
  50. OptimisticTransactionDB** dbptr) {
  51. return OptimisticTransactionDB::Open(options, dbname, dbptr);
  52. };
  53. Status DefaultHooks::OpenOptimisticTransactionDB(
  54. const DBOptions& db_options, const std::string& dbname,
  55. const std::vector<ColumnFamilyDescriptor>& column_families,
  56. std::vector<ColumnFamilyHandle*>* handles,
  57. OptimisticTransactionDB** dbptr) {
  58. return OptimisticTransactionDB::Open(db_options, dbname, column_families,
  59. handles, dbptr);
  60. }
  61. Status DefaultHooks::OpenAsSecondary(const Options& options,
  62. const std::string& name,
  63. const std::string& secondary_path,
  64. DB** dbptr) {
  65. return DB::OpenAsSecondary(options, name, secondary_path, dbptr);
  66. }
  67. Status DefaultHooks::OpenAsFollower(const Options& options,
  68. const std::string& name,
  69. const std::string& leader_path,
  70. std::unique_ptr<DB>* dbptr) {
  71. return DB::OpenAsFollower(options, name, leader_path, dbptr);
  72. };
  73. Status DefaultHooks::Open(const Options& options,
  74. const blob_db::BlobDBOptions& bdb_options,
  75. const std::string& dbname,
  76. blob_db::BlobDB** blob_db) {
  77. return blob_db::BlobDB::Open(options, bdb_options, dbname, blob_db);
  78. }
  79. DefaultHooks defaultHooks;
  80. } // namespace ROCKSDB_NAMESPACE