diff options
author | Ryan Ofsky <ryan@ofsky.org> | 2022-08-16 23:32:55 -0400 |
---|---|---|
committer | Ryan Ofsky <ryan@ofsky.org> | 2023-02-10 04:39:11 -0400 |
commit | 2eaeded37f3a07c35eef38d9a80c1e5fbd4d41ee (patch) | |
tree | 3d41da9574698a955573712336ffb52e7badf065 /src/node/database_args.cpp | |
parent | 4f841cbb81ecce6e1aab42e8edb5bf1c6f0c36bb (diff) |
refactor, dbwrapper: Add DBParams and DBOptions structs
Add DBParams and DBOptions structs to remove ArgsManager uses from dbwrapper.
To reduce size of this commit, this moves references to gArgs variable out of
dbwrapper.cpp to calling code in txdb.cpp. But these moves are temporary. The
gArgs references in txdb.cpp are moved out to calling code in init.cpp in later
commits.
This commit does not change behavior.
Diffstat (limited to 'src/node/database_args.cpp')
-rw-r--r-- | src/node/database_args.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/node/database_args.cpp b/src/node/database_args.cpp new file mode 100644 index 0000000000..2c53b4b47e --- /dev/null +++ b/src/node/database_args.cpp @@ -0,0 +1,18 @@ +// Copyright (c) 2022 The Bitcoin Core developers +// Distributed under the MIT software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include <node/database_args.h> + +#include <dbwrapper.h> +#include <util/system.h> + +namespace node { +void ReadDatabaseArgs(const ArgsManager& args, DBOptions& options) +{ + // Settings here apply to all databases (chainstate, blocks, and index + // databases), but it'd be easy to parse database-specific options by adding + // a database_type string or enum parameter to this function. + if (auto value = args.GetBoolArg("-forcecompactdb")) options.force_compact = *value; +} +} // namespace node |