mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-23 19:33:28 +01:00
blockchain_import: Build string for db type list
This commit is contained in:
parent
1aa8a9d26f
commit
27f76e2ee4
@ -78,6 +78,17 @@ using namespace cryptonote;
|
|||||||
using namespace epee;
|
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_type: lmdb, berkeley
|
||||||
// db_mode: safe, fast, fastest
|
// db_mode: safe, fast, fastest
|
||||||
int get_db_flags_from_mode(const std::string& db_type, const std::string& db_mode)
|
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;
|
std::unordered_set<std::string> db_types_all = cryptonote::blockchain_db_types;
|
||||||
db_types_all.insert("memory");
|
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;
|
uint32_t log_level = LOG_LEVEL_0;
|
||||||
uint64_t num_blocks = 0;
|
uint64_t num_blocks = 0;
|
||||||
uint64_t block_stop = 0;
|
uint64_t block_stop = 0;
|
||||||
@ -642,8 +656,7 @@ int main(int argc, char* argv[])
|
|||||||
, false
|
, false
|
||||||
};
|
};
|
||||||
const command_line::arg_descriptor<std::string> arg_database = {
|
const command_line::arg_descriptor<std::string> arg_database = {
|
||||||
"database", "available: memory, lmdb, berkeley"
|
"database", available_dbs.c_str(), default_db_type
|
||||||
, default_db_type
|
|
||||||
};
|
};
|
||||||
const command_line::arg_descriptor<bool> arg_verify = {"verify",
|
const command_line::arg_descriptor<bool> arg_verify = {"verify",
|
||||||
"Verify blocks and transactions during import", true};
|
"Verify blocks and transactions during import", true};
|
||||||
|
Loading…
Reference in New Issue
Block a user