[ldb] Export LDBCommandRunner

Summary:
The implementation remains where it is. Only the
header is exported. This is so that a customized
ldb tool can print help along with its own
extra commands

Test Plan: make ldb

Reviewers: sdong, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D57255
main
Arun Sharma 9 years ago
parent c1af07ce84
commit 49815e3841
  1. 9
      include/rocksdb/utilities/ldb_cmd.h
  2. 22
      tools/ldb_tool.cc

@ -230,6 +230,15 @@ class LDBCommand {
const std::vector<std::string>& flags);
};
class LDBCommandRunner {
public:
static void PrintHelp(const char* exec_name);
static void RunCommand(
int argc, char** argv, Options options, const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families);
};
} // namespace rocksdb
#endif // ROCKSDB_LITE

@ -12,10 +12,7 @@ namespace rocksdb {
LDBOptions::LDBOptions() {}
class LDBCommandRunner {
public:
static void PrintHelp(const char* exec_name) {
void LDBCommandRunner::PrintHelp(const char* exec_name) {
std::string ret;
ret.append("ldb - LevelDB Tool");
@ -23,7 +20,8 @@ public:
ret.append("commands MUST specify --" + LDBCommand::ARG_DB +
"=<full_path_to_db_directory> when necessary\n");
ret.append("\n");
ret.append("The following optional parameters control if keys/values are "
ret.append(
"The following optional parameters control if keys/values are "
"input/output as hex or as plain strings:\n");
ret.append(" --" + LDBCommand::ARG_KEY_HEX +
" : Keys are input/output as hex\n");
@ -37,7 +35,8 @@ public:
"family\n");
ret.append("\n");
ret.append("The following optional parameters control the database "
ret.append(
"The following optional parameters control the database "
"internals:\n");
ret.append(" --" + LDBCommand::ARG_TTL +
" with 'put','get','scan','dump','query','batchput'"
@ -48,8 +47,7 @@ public:
"=<no|snappy|zlib|bzip2|lz4|lz4hc|xpress|zstd>\n");
ret.append(" --" + LDBCommand::ARG_COMPRESSION_MAX_DICT_BYTES +
"=<int,e.g.:14>\n");
ret.append(" --" + LDBCommand::ARG_BLOCK_SIZE +
"=<block_size_in_bytes>\n");
ret.append(" --" + LDBCommand::ARG_BLOCK_SIZE + "=<block_size_in_bytes>\n");
ret.append(" --" + LDBCommand::ARG_AUTO_COMPACTION + "=<true|false>\n");
ret.append(" --" + LDBCommand::ARG_DB_WRITE_BUFFER_SIZE +
"=<int,e.g.:16777216>\n");
@ -83,9 +81,9 @@ public:
RepairCommand::Help(ret);
fprintf(stderr, "%s\n", ret.c_str());
}
}
static void RunCommand(
void LDBCommandRunner::RunCommand(
int argc, char** argv, Options options, const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families) {
if (argc <= 2) {
@ -111,9 +109,7 @@ public:
delete cmdObj;
exit(ret.IsFailed());
}
};
}
void LDBTool::Run(int argc, char** argv, Options options,
const LDBOptions& ldb_options,

Loading…
Cancel
Save