Files
triangles_v5/src/txdb.h
T
Hermes bfdb399772 WIP: modernization applied to DNS2 tree
Brings in uncommitted work from SAMI-PC E:\repos\triangles
cpp20-modernization branch:
- RocksDB default chain DB + auto-migrate from txleveldb
- SQLite default wallet + non-destructive migration from Berkeley
- Boost.Asio removed from RPC (rpc_httpsocket.h)
- Boost removed from all daemon + GUI code
- New: walletdb-base.h, walletdb-batch.h, walletdb-sqlite.{h,cpp},
  walletdb-factory.{h,cpp}, walletmigrate.{h,cpp}
- New tests: chaindb_runtime_tests, chaindb_equivalence_tests,
  snapshotnet_tests
- Docs: BOOST-REMOVAL.md, ROCKSDB-DEFAULT-MIGRATION.md,
  WALLET-SQLITE-MIGRATION.md

Does not yet build — needs CWalletDB->CWalletBatchTyped rebase in
walletdb.cpp/wallet.cpp/db.cpp and merge with origin/master for
v6 source files (checkpointpublisher, tor/, snapshot/, utxosnapshot,
bootstrap.cpp).

Build flags: -DBUILD_QT=OFF -DUSE_I2P_EMBEDDED=OFF
2026-06-29 20:08:06 -07:00

42 lines
1.5 KiB
C++

// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2012 The Bitcoin developers
// Copyright (c) 2026 The Triangles developers
// Distributed under the MIT/X11 software license, see the accompanying
// file license.txt or http://www.opensource.org/licenses/mit-license.php.
#ifndef TRIANGLES_TXDB_H
#define TRIANGLES_TXDB_H
#include "txdb-base.h"
#include "txdb-leveldb.h"
#include "txdb-rocksdb.h"
#include <filesystem>
#include <memory>
// Factory: returns a chain-database handle whose concrete backend is chosen
// by the -chaindb command-line argument:
//
// -chaindb=rocksdb (default)
// -chaindb=leveldb (retained as migration source + fallback; pending
// retirement after live-chain validation)
//
// Callers receive a CTxDBBase*, so the rest of the codebase stays
// backend-agnostic. Mode strings ("r", "r+", "cr+") match the pre-existing
// CTxDB constructor convention.
std::unique_ptr<CTxDBBase> MakeChainDB(const char* pszMode = "r+");
// True when the configured chain-DB backend is RocksDB.
bool IsRocksDbChainBackend();
// On-disk directory of the chain DB for the configured backend, e.g.
// <datadir>/txleveldb (LevelDB) or <datadir>/rocksdb (RocksDB).
std::filesystem::path GetChainDataDir();
// Remove the chain DB directory for the configured backend. Callers that
// need a fresh DB (-reindex, snapshot load) must invoke this BEFORE
// MakeChainDB() opens the global handle for the first time.
void WipeChainDataDir();
#endif // TRIANGLES_TXDB_H