提交 0e200001 编写于 作者: S sdong

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
上级 472c06e9
...@@ -53,12 +53,19 @@ class LDBCommand { ...@@ -53,12 +53,19 @@ class LDBCommand {
static const std::string ARG_CREATE_IF_MISSING; static const std::string ARG_CREATE_IF_MISSING;
static const std::string ARG_NO_VALUE; 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( static LDBCommand* InitFromCmdLineArgs(
const std::vector<std::string>& args, const Options& options, const std::vector<std::string>& args, const Options& options,
const LDBOptions& ldb_options, const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families, const std::vector<ColumnFamilyDescriptor>* column_families,
Selector selector = SelectCommand); const RocksDBLDBSelectFunc& selector = SelectCommand);
static LDBCommand* InitFromCmdLineArgs( static LDBCommand* InitFromCmdLineArgs(
int argc, char** argv, const Options& options, int argc, char** argv, const Options& options,
......
...@@ -98,12 +98,11 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs( ...@@ -98,12 +98,11 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs(
* Command name is not included in args. * Command name is not included in args.
* Returns nullptr if the command-line cannot be parsed. * Returns nullptr if the command-line cannot be parsed.
*/ */
template <typename Selector>
LDBCommand* LDBCommand::InitFromCmdLineArgs( LDBCommand* LDBCommand::InitFromCmdLineArgs(
const std::vector<std::string>& args, const Options& options, const std::vector<std::string>& args, const Options& options,
const LDBOptions& ldb_options, const LDBOptions& ldb_options,
const std::vector<ColumnFamilyDescriptor>* column_families, const std::vector<ColumnFamilyDescriptor>* column_families,
Selector selector) { const RocksDBLDBSelectFunc& selector) {
// --x=y command line arguments are added as x->y map entries. // --x=y command line arguments are added as x->y map entries.
std::map<std::string, std::string> option_map; std::map<std::string, std::string> option_map;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册