experimental.cc 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright (c) 2011-present, Facebook, Inc. 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/experimental.h"
  6. #include "db/db_impl/db_impl.h"
  7. namespace ROCKSDB_NAMESPACE {
  8. namespace experimental {
  9. #ifndef ROCKSDB_LITE
  10. Status SuggestCompactRange(DB* db, ColumnFamilyHandle* column_family,
  11. const Slice* begin, const Slice* end) {
  12. if (db == nullptr) {
  13. return Status::InvalidArgument("DB is empty");
  14. }
  15. return db->SuggestCompactRange(column_family, begin, end);
  16. }
  17. Status PromoteL0(DB* db, ColumnFamilyHandle* column_family, int target_level) {
  18. if (db == nullptr) {
  19. return Status::InvalidArgument("Didn't recognize DB object");
  20. }
  21. return db->PromoteL0(column_family, target_level);
  22. }
  23. #else // ROCKSDB_LITE
  24. Status SuggestCompactRange(DB* /*db*/, ColumnFamilyHandle* /*column_family*/,
  25. const Slice* /*begin*/, const Slice* /*end*/) {
  26. return Status::NotSupported("Not supported in RocksDB LITE");
  27. }
  28. Status PromoteL0(DB* /*db*/, ColumnFamilyHandle* /*column_family*/,
  29. int /*target_level*/) {
  30. return Status::NotSupported("Not supported in RocksDB LITE");
  31. }
  32. #endif // ROCKSDB_LITE
  33. Status SuggestCompactRange(DB* db, const Slice* begin, const Slice* end) {
  34. return SuggestCompactRange(db, db->DefaultColumnFamily(), begin, end);
  35. }
  36. } // namespace experimental
  37. } // namespace ROCKSDB_NAMESPACE