container: plugins: root: bitcoin: support Pluggable entrypoint

This commit is contained in:
2026-01-08 14:28:30 -08:00
parent 31054b86ea
commit 1adb305417

View File

@@ -1,6 +1,6 @@
// docker-finance | modern accounting for the power-user // docker-finance | modern accounting for the power-user
// //
// Copyright (C) 2025 Aaron Fiore (Founder, Evergreen Crypto LLC) // Copyright (C) 2025-2026 Aaron Fiore (Founder, Evergreen Crypto LLC)
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@@ -43,12 +43,26 @@ inline std::string get_repo_path()
+ "/bitcoin/"; + "/bitcoin/";
} }
//! \brief Pluggable entrypoint
//! \ingroup cpp_plugin_impl
//! \since docker-finance 1.1.0
class bitcoin_cc
{
public:
bitcoin_cc() = default;
~bitcoin_cc() = default;
bitcoin_cc(const bitcoin_cc&) = default;
bitcoin_cc& operator=(const bitcoin_cc&) = default;
bitcoin_cc(bitcoin_cc&&) = default;
bitcoin_cc& operator=(bitcoin_cc&&) = default;
public:
//! \brief Initialize this bitcoin plugin //! \brief Initialize this bitcoin plugin
//! \details Bare-essential initializations, will require manual loading for any further functionality //! \details Bare-essential initializations, will require manual loading for any further functionality
//! \warning Initializations *MUST* occur here before any other bitcoin lib use //! \warning Initializations *MUST* occur here before any other bitcoin lib use
//! \ingroup cpp_plugin_impl static void load(const std::string& arg = {})
//! \since docker-finance 1.1.0
void load(const std::string& arg = {})
{ {
namespace common = ::dfi::common; namespace common = ::dfi::common;
@@ -73,12 +87,10 @@ void load(const std::string& arg = {})
//! \brief Deinitialize this bitcoin plugin //! \brief Deinitialize this bitcoin plugin
//! \details Bare-essential deinitializations, will require manual unloading for any other previously loaded functionality //! \details Bare-essential deinitializations, will require manual unloading for any other previously loaded functionality
//! \warning Unloading certain bitcoin headers may result in Cling segfault due to bitcoin library design //! \warning Unloading certain bitcoin headers may result in Cling segfault due to bitcoin library design
//! \ingroup cpp_plugin_impl
//! \since docker-finance 1.1.0
//! \todo It appears that, due to bitcoin design, unloading will result in //! \todo It appears that, due to bitcoin design, unloading will result in
//! Cling segfault "*** Break *** illegal instruction". With that said, it's //! Cling segfault "*** Break *** illegal instruction". With that said, it's
//! best to exit `root` if you want a clean workspace (instead of unloading this plugin). //! best to exit `root` if you want a clean workspace (instead of unloading this plugin).
void unload(const std::string& arg = {}) static void unload(const std::string& arg = {})
{ {
namespace common = ::dfi::common; namespace common = ::dfi::common;
@@ -98,6 +110,7 @@ void unload(const std::string& arg = {})
// TODO(unassigned): remove_include_dir() // TODO(unassigned): remove_include_dir()
common::remove_linked_lib(repo + "build/lib/libbitcoinkernel.so"); common::remove_linked_lib(repo + "build/lib/libbitcoinkernel.so");
} }
};
} // namespace bitcoin } // namespace bitcoin
} // namespace dfi::plugin } // namespace dfi::plugin