From 0e200001715c455444489d2c0372360a520ffc0b Mon Sep 17 00:00:00 2001 From: sdong Date: Fri, 27 May 2016 10:31:47 -0700 Subject: [PATCH] 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 > const&, std::map, std::allocator > > const&, std::vector > const&)>(std::vector > const&, rocksdb::Options const&, rocksdb::LDBOptions const&, std::vector > const*, rocksdb::LDBCommand* (*)(std::string const&, std::vector > const&, std::map, std::allocator > > const&, std::vector > 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 --- include/rocksdb/utilities/ldb_cmd.h | 11 +++++++++-- tools/ldb_cmd.cc | 3 +-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/include/rocksdb/utilities/ldb_cmd.h b/include/rocksdb/utilities/ldb_cmd.h index a3ecb03b0..a91505ebe 100644 --- a/include/rocksdb/utilities/ldb_cmd.h +++ b/include/rocksdb/utilities/ldb_cmd.h @@ -53,12 +53,19 @@ class LDBCommand { static const std::string ARG_CREATE_IF_MISSING; static const std::string ARG_NO_VALUE; - template + // parameters: cmd, cmdParams, option_map, flags + // The same interface as SelectCommand() + typedef std::function&, + const std::map&, + const std::vector&)> + RocksDBLDBSelectFunc; + static LDBCommand* InitFromCmdLineArgs( const std::vector& args, const Options& options, const LDBOptions& ldb_options, const std::vector* column_families, - Selector selector = SelectCommand); + const RocksDBLDBSelectFunc& selector = SelectCommand); static LDBCommand* InitFromCmdLineArgs( int argc, char** argv, const Options& options, diff --git a/tools/ldb_cmd.cc b/tools/ldb_cmd.cc index b226614e0..f5758f882 100644 --- a/tools/ldb_cmd.cc +++ b/tools/ldb_cmd.cc @@ -98,12 +98,11 @@ LDBCommand* LDBCommand::InitFromCmdLineArgs( * Command name is not included in args. * Returns nullptr if the command-line cannot be parsed. */ -template LDBCommand* LDBCommand::InitFromCmdLineArgs( const std::vector& args, const Options& options, const LDBOptions& ldb_options, const std::vector* column_families, - Selector selector) { + const RocksDBLDBSelectFunc& selector) { // --x=y command line arguments are added as x->y map entries. std::map option_map; -- GitLab