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