/Users/deen/code/yugabyte-db/src/yb/rocksdb/ldb_tool.h
Line | Count | Source (jump to first uncovered line) |
1 | | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved. |
2 | | // This source code is licensed under the BSD-style license found in the |
3 | | // LICENSE file in the root directory of this source tree. An additional grant |
4 | | // of patent rights can be found in the PATENTS file in the same directory. |
5 | | // |
6 | | // The following only applies to changes made to this file as part of YugaByte development. |
7 | | // |
8 | | // Portions Copyright (c) YugaByte, Inc. |
9 | | // |
10 | | // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except |
11 | | // in compliance with the License. You may obtain a copy of the License at |
12 | | // |
13 | | // http://www.apache.org/licenses/LICENSE-2.0 |
14 | | // |
15 | | // Unless required by applicable law or agreed to in writing, software distributed under the License |
16 | | // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express |
17 | | // or implied. See the License for the specific language governing permissions and limitations |
18 | | // under the License. |
19 | | // |
20 | | #ifndef ROCKSDB_LITE |
21 | | #pragma once |
22 | | #include <string> |
23 | | #include <vector> |
24 | | #include "yb/rocksdb/db.h" |
25 | | #include "yb/rocksdb/options.h" |
26 | | |
27 | | namespace rocksdb { |
28 | | |
29 | | // An interface for converting a slice to a readable string |
30 | | class SliceFormatter { |
31 | | public: |
32 | 0 | virtual ~SliceFormatter() {} |
33 | | virtual std::string Format(const Slice& s) const = 0; |
34 | | }; |
35 | | |
36 | | // Options for customizing ldb tool (beyond the DB Options) |
37 | | struct LDBOptions { |
38 | | // Create LDBOptions with default values for all fields |
39 | | LDBOptions(); |
40 | | |
41 | | // Key formatter that converts a slice to a readable string. |
42 | | // Default: Slice::ToString() |
43 | | std::shared_ptr<SliceFormatter> key_formatter; |
44 | | }; |
45 | | |
46 | | class LDBTool { |
47 | | public: |
48 | | void Run( |
49 | | int argc, char** argv, Options db_options = Options(), |
50 | | const LDBOptions& ldb_options = LDBOptions(), |
51 | | const std::vector<ColumnFamilyDescriptor>* column_families = nullptr); |
52 | | }; |
53 | | |
54 | | } // namespace rocksdb |
55 | | |
56 | | #endif // ROCKSDB_LITE |