diff options
author | warptangent <warptangent@tutanota.com> | 2016-02-14 13:39:14 -0800 |
---|---|---|
committer | warptangent <warptangent@tutanota.com> | 2016-02-14 16:25:35 -0800 |
commit | 27f76e2ee4ace5a7788f6c543bfe9ce55a2662dc (patch) | |
tree | 08c438db076fc0d32acb031706c2ae8179d9b8e6 /src/blockchain_utilities/blockchain_import.cpp | |
parent | blockchain_import: Add mode argument representing multiple DB flags (diff) | |
download | monero-27f76e2ee4ace5a7788f6c543bfe9ce55a2662dc.tar.xz |
blockchain_import: Build string for db type list
Diffstat (limited to 'src/blockchain_utilities/blockchain_import.cpp')
-rw-r--r-- | src/blockchain_utilities/blockchain_import.cpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp index 8506bd045..daa5db2a3 100644 --- a/src/blockchain_utilities/blockchain_import.cpp +++ b/src/blockchain_utilities/blockchain_import.cpp @@ -78,6 +78,17 @@ using namespace cryptonote; using namespace epee; +std::string join_set_strings(const std::unordered_set<std::string>& db_types_all, const char* delim) +{ + std::string result; + std::ostringstream s; + std::copy(db_types_all.begin(), db_types_all.end(), std::ostream_iterator<std::string>(s, delim)); + result = s.str(); + if (result.length() > 0) + result.erase(result.end()-strlen(delim), result.end()); + return result; +} + // db_type: lmdb, berkeley // db_mode: safe, fast, fastest int get_db_flags_from_mode(const std::string& db_type, const std::string& db_mode) @@ -611,6 +622,9 @@ int main(int argc, char* argv[]) std::unordered_set<std::string> db_types_all = cryptonote::blockchain_db_types; db_types_all.insert("memory"); + std::string available_dbs = join_set_strings(db_types_all, ", "); + available_dbs = "available: " + available_dbs; + uint32_t log_level = LOG_LEVEL_0; uint64_t num_blocks = 0; uint64_t block_stop = 0; @@ -642,8 +656,7 @@ int main(int argc, char* argv[]) , false }; const command_line::arg_descriptor<std::string> arg_database = { - "database", "available: memory, lmdb, berkeley" - , default_db_type + "database", available_dbs.c_str(), default_db_type }; const command_line::arg_descriptor<bool> arg_verify = {"verify", "Verify blocks and transactions during import", true}; |