LDBCommand::InitFromCmdLineArgs() to move from template to function wrapper

Summary:
Build failure with some compiler setting with

tools/reduce_levels_test.cc:97: undefined reference to `rocksdb::LDBCommand* rocksdb::LDBCommand::InitFromCmdLineArgs<rocksdb::LDBCommand* (*)(std::string const&, std::vector<std::string, std::allocator<std::string> > const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::vector<std::string, std::allocator<std::string> > const&)>(std::vector<std::string, std::allocator<std::string> > const&, rocksdb::Options const&, rocksdb::LDBOptions const&, std::vector<rocksdb::ColumnFamilyDescriptor, std::allocator<rocksdb::ColumnFamilyDescriptor> > const*, rocksdb::LDBCommand* (*)(std::string const&, std::vector<std::string, std::allocator<std::string> > const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&, std::vector<std::string, std::allocator<std::string> > const&))'

Fix it by changing to function pointer instead

Test Plan: Run all existing tests

Reviewers: andrewkr, kradhakrishnan, IslamAbdelRahman

Reviewed By: IslamAbdelRahman

Subscribers: adsharma, lightmark, yiwu, leveldb, andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D58905
main
sdong 9 years ago
parent 472c06e903
commit 0e20000171
  1. 11
      include/rocksdb/utilities/ldb_cmd.h
  2. 3
      tools/ldb_cmd.cc

@ -53,12 +53,19 @@ class LDBCommand {
static const std::string ARG_CREATE_IF_MISSING;
static const std::string ARG_NO_VALUE;
template <typename Selector>
// parameters: cmd, cmdParams, option_map, flags
// The same interface as SelectCommand()
typedef std::function<LDBCommand*(const std::string&,
const std::vector<std::string>&,
const std::map<std::string, std::string>&,
const std::vector<std::string>&)>
RocksDBLDBSelectFunc;
static LDBCommand* InitFromCmdLineArgs(
const std::vector<std::string>& args, const Options& options,
const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families,
Selector selector = SelectCommand);
const RocksDBLDBSelectFunc& selector = SelectCommand);
static LDBCommand* InitFromCmdLineArgs(
int argc, char** argv, const Options& options,

@ -98,12 +98,11 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs(
* Command name is not included in args.
* Returns nullptr if the command-line cannot be parsed.
*/
template <typename Selector>
LDBCommand* LDBCommand::InitFromCmdLineArgs(
const std::vector<std::string>& args, const Options& options,
const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families,
Selector selector) {
const RocksDBLDBSelectFunc& selector) {
// --x=y command line arguments are added as x->y map entries.
std::map<std::string, std::string> option_map;

Loading…
Cancel
Save